MOD Player for 32X - the Good Enough release

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Chilly Willy
Very interested
Posts: 2522
Joined: Fri Aug 17, 2007 9:33 pm

MOD Player for 32X - the Good Enough release

Post by Chilly Willy » Tue Mar 01, 2011 9:37 am

Okay, here's my latest source and binaries for playing MOD format music on the 32X. For those just tuning in, this runs completely on the Slave SH2, and uses DMA to play the audio. The module player handles 4, 6, and 8 channel modules; the sample rate is 22kHz, which allows a 10-bit sample; this release does simple stereo (channels 0/3/4/7 to left, others to right), but can handle full panning, or add cross talk to the simple stereo.

The sample voice system that actually plays the audio is set for eight voices, but can be easily changed for more or fewer. The current code is aimed at playing four channel MODs while using the other four voices for sound effects. The sound effects can be set as looping, can be stereo panned, and can be one-shot or persistent. Sound effects should be mono 8-bit signed samples up to 256KB in length; they can be any sample rate, and played back at different rates for pitch changes. The mixer sums the channels as 16-bit stereo samples for maximum quality, only scaling to 10-bit PWM samples when filling the DMA buffer. This gives very clean sound; bass instruments and sound effects in particular are much clearer in this release than previous ones.

The source archive contains all the latest code as well as the MODs used in the different rom images. Most of them were obtained from The Mod Archive. The binary archive contains three test rom images that can be played on a real 32X via flash carts like the Neo Myth, Everdrive-MD, or the MD-Pro. The 3MB rom can be played on the MegaCart. If you've made the DMA PWM modification to Gens/GS, then they will also work fine with that emulator. They do NOT work properly with the stock Gens/GS r7, or with KEGA Fusion, although Fusion at least plays SOMETHING.

Controls: UP/DOWN = next/prev MOD, RIGHT/LEFT = raise/lower volume, START = pause/resume

ModTest32X-20110228.7z
ModTest32X-src-20110228.7z

Chilly Willy
Very interested
Posts: 2522
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Mar 02, 2011 10:43 am

While I didn't expect a parade and dancing in the streets, I'd hoped for more of a reaction than this... :?

Okay, let's up the ante... here's the mod player and some sounds stuck in the Yeti3D demo. I'll be expecting a marching band in that parade, now. :lol:

Yeti3D with sound and music and dancing girls... okay, no dancing girls.

A = fire, B = jump, X = look up, Y = look down

Note: Like the mod player, this requires working DMA PWM - Fusion doesn't quite work. Don't complain to me about it - it's not my emulator. For you folks using linux, here's my private compile (32-bit x86) of Gens/GS r7 with my DMA PWM fixes. Both the mod player and the yeti demo above work fine with it. Your only other choice is a real 32X and a flash cart.

Gens/GS r7 with DMA PWM.

User avatar
KanedaFr
Administrateur
Posts: 1114
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Wed Mar 02, 2011 11:17 am

ah ah, sorry if I don't react.
I, personnaly, don't like the 32X... :twisted:

But, after these 3 ports, I wonder if it's not possible to run *almost* anything made fro DOS before 90's ? with some/lot of works, of course...
if you were able to port a game engine, a sound engine and a 3D engine... it might be possible to port Windows 3.11 :D :lol:
It's even surprising I didn't find a Linux port yet....since everyone machine got its Linux port.....

Chilly Willy
Very interested
Posts: 2522
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Mar 02, 2011 7:30 pm

KanedaFr wrote:ah ah, sorry if I don't react.
I, personnaly, don't like the 32X... :twisted:
No problem. A lot of people don't. :lol:

I've always had a fondness for the little mushroom. Most of my releases so far have all been aimed at encouraging 32X homebrew.
But, after these 3 ports, I wonder if it's not possible to run *almost* anything made fro DOS before 90's ? with some/lot of works, of course...
if you were able to port a game engine, a sound engine and a 3D engine... it might be possible to port Windows 3.11 :D :lol:
It's even surprising I didn't find a Linux port yet....since everyone machine got its Linux port.....
As I've mentioned to others a number of times, the main limitation is the small amount of ram. If it had even had just a single MB, things would be far easier. Squeezing things into 256KB is the biggest problem for 32X software, followed by optimizing for better speed.

There is a newer, better version of Yeti3D, but it requires more work to convert over to the 32X because it requires twice the ram as this version. I'm working on that as I get the chance. Since I had this version going pretty well (short of assembly optimizations), it made sense to stick my sound system in it for a better demo.

User avatar
Stef
Very interested
Posts: 2661
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Mar 02, 2011 7:57 pm

Chilly Willy wrote:
KanedaFr wrote:ah ah, sorry if I don't react.
I, personnaly, don't like the 32X... :twisted:
No problem. A lot of people don't. :lol:

I've always had a fondness for the little mushroom. Most of my releases so far have all been aimed at encouraging 32X homebrew.
But, after these 3 ports, I wonder if it's not possible to run *almost* anything made fro DOS before 90's ? with some/lot of works, of course...
if you were able to port a game engine, a sound engine and a 3D engine... it might be possible to port Windows 3.11 :D :lol:
It's even surprising I didn't find a Linux port yet....since everyone machine got its Linux port.....
As I've mentioned to others a number of times, the main limitation is the small amount of ram. If it had even had just a single MB, things would be far easier. Squeezing things into 256KB is the biggest problem for 32X software, followed by optimizing for better speed.

There is a newer, better version of Yeti3D, but it requires more work to convert over to the 32X because it requires twice the ram as this version. I'm working on that as I get the chance. Since I had this version going pretty well (short of assembly optimizations), it made sense to stick my sound system in it for a better demo.
The Yeti3D engine is really impressive, you made a very nice port of it :)
By the way i got some sort of sound with Fusion but i can't get anything from Gens GS R7 (i'm on a win system).

Chilly Willy
Very interested
Posts: 2522
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Mar 02, 2011 8:24 pm

Stef wrote:The Yeti3D engine is really impressive, you made a very nice port of it :)
Thanks!
By the way i got some sort of sound with Fusion but i can't get anything from Gens GS R7 (i'm on a win system).
The official R7 doesn't work, you need my DMA PWM patches. I made a post about it over at the Gens/GS home forum at SonicRetro.

This thread talks about compiling Gens/GS R7 with my patch on a current linux system. It has a link to where I posted the fixed pwm.c file.

I imagine compiling it for Windows would go about the same. There's a thread on compiling the upcoming Gens/GS II for Windows, but that doesn't have the 32X support enabled yet. If you can compile Gens/GS R7 yourself, here's the link to my post of the fixed pwm.c file.

User avatar
Stef
Very interested
Posts: 2661
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Mar 02, 2011 8:38 pm

The official R7 doesn't work, you need my DMA PWM patches. I made a post about it over at the Gens/GS home forum at SonicRetro.

This thread talks about compiling Gens/GS R7 with my patch on a current linux system. It has a link to where I posted the fixed pwm.c file.

I imagine compiling it for Windows would go about the same. There's a thread on compiling the upcoming Gens/GS II for Windows, but that doesn't have the 32X support enabled yet. If you can compile Gens/GS R7 yourself, here's the link to my post of the fixed pwm.c file.
Huu sorry i though your fix was included in the official Gens GS R7 :p
well i guess i'll have to test that on the real hardware, even better =)

To talk about ports of old DOS stuff, it's true that 32X really miss some extra MB of memory, we have a lot of horse power with the 2 SH2 cpu, but not enough ram to correctly exploit them...

Chilly Willy
Very interested
Posts: 2522
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Mar 02, 2011 8:53 pm

Stef wrote:Huu sorry i though your fix was included in the official Gens GS R7 :p
It was originally going to be, but GerbilSoft had trouble deciding on the audio level and left it out.
well i guess i'll have to test that on the real hardware, even better =)

To talk about ports of old DOS stuff, it's true that 32X really miss some extra MB of memory, we have a lot of horse power with the 2 SH2 cpu, but not enough ram to correctly exploit them...
Yeah, especially as the 32X was supposedly made to combat the Jaguar. The primary difference in power between the two is the Jaguar has 2MB of ram and the 32X has 256KB. It's the primary reason Doom for the 32X wasn't as good as the Jaguar version - they could have been identical, but the 32X lacked the ram needed.

ob1
Very interested
Posts: 403
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Wed Mar 02, 2011 8:57 pm

Chilly Willy wrote:Yeah, especially as the 32X was supposedly made to combat the Jaguar. The primary difference in power between the two is the Jaguar has 2MB of ram and the 32X has 256KB. It's the primary reason Doom for the 32X wasn't as good as the Jaguar version - they could have been identical, but the 32X lacked the ram needed.
I never knew that.
Explain a lot of things to me.

Chilly Willy
Very interested
Posts: 2522
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Mar 02, 2011 9:16 pm

ob1 wrote:
Chilly Willy wrote:Yeah, especially as the 32X was supposedly made to combat the Jaguar. The primary difference in power between the two is the Jaguar has 2MB of ram and the 32X has 256KB. It's the primary reason Doom for the 32X wasn't as good as the Jaguar version - they could have been identical, but the 32X lacked the ram needed.
I never knew that.
Explain a lot of things to me.
If you look at the released Doom for Jaguar source, you'll find conditionals for MARS around parts of the code. The games used the exact same code and data except for system specific parts like sound and video. That's why saxman was able to convert the Jaguar Doom wad file over to the 32X giving it all the levels it should have had if they hadn't been rushing to get it out for xmas 94.

Most of the games that were in the works for the 32X (before SEGA put a halt to all work except the Saturn) were all in the works for the Jaguar at the same time. It's too bad - I was looking forward to Rayman on the 32X (among other games).

ob1
Very interested
Posts: 403
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Wed Mar 02, 2011 9:45 pm

Chilly Willy wrote:It's too bad - I was looking forward to Rayman on the 32X (among other games).
Rayman !!!!

I wanted to make a demo of it for the SuperVDP but I did not find any good enough sprites.
But gimme some shiny Rayman background data and my SuperVDP will roar, I swear !!!

Chilly Willy
Very interested
Posts: 2522
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Thu Mar 03, 2011 1:40 am

ob1 wrote:
Chilly Willy wrote:It's too bad - I was looking forward to Rayman on the 32X (among other games).
Rayman !!!!

I wanted to make a demo of it for the SuperVDP but I did not find any good enough sprites.
But gimme some shiny Rayman background data and my SuperVDP will roar, I swear !!!
Okay, get cracking! I'll even help. :lol:

http://www.raymanpc.com/forum/viewtopic.php?f=13&t=4839

ob1
Very interested
Posts: 403
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Post by ob1 » Thu Mar 03, 2011 8:20 am

Chilly Willy wrote:Okay, get cracking! I'll even help. :lol:

http://www.raymanpc.com/forum/viewtopic.php?f=13&t=4839
I thought your topic was best left not ... off-topic, so I've created another one for Rayman 32X :
viewtopic.php?t=891

And now gents', back to business and Chilly's work ;)

Chilly Willy
Very interested
Posts: 2522
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri Mar 04, 2011 9:16 am

Here's the latest archive. This has the source and binaries for both the test mod player and yeti3d. Changes include:

No audio click on start up on real hardware.
Proper support for beats per minute.

Controls for mod player:
UP/DOWN = prev/next mod
LEFT/RIGHT = volume down/up
START = pause/resume

Controls for Yeti3D:
DPAD = move/turn
A = fire
B = jump
C = crouch
X = strafe left
Y = hold to look up/down
Z = strafe right
START = pause/resume
MODE = switch mod playing

download

EDIT: There IS one small bug related to the new beat handling - I've already corrected it, but will leave it until the next update. If you are using this code yourself (haha), here's the fix to hw_32x.c - there are two lines in the code below that have MAX_NUM_SAMPLES in them; they are NUM_SAMPLES in the archive and should be changed. Since the bpm changes the number of samples, the offsets for the other buffer should be tied to MAX_NUM_SAMPLES to avoid clipping samples as the number changes. This lead to the pops in Fountain of Sighs (it's ALWAYS FoS that gives me trouble :lol: ).

Code: Select all

        // only do sound when sound subsytem initialized and unlocked
        while (MARS_SYS_COMM6 == 1)
        {
            // start DMA on first buffer and fill second
            SH2_DMA_SAR1 = ((unsigned long)&snd_buffer) | 0x20000000;
            SH2_DMA_TCR1 = NUM_SAMPLES; // number longs
            SH2_DMA_CHCR1 = 0x18E1; // dest fixed, src incr, size long, ext req, dack mem to dev, dack hi, dack edge, dreq rising edge, cycle-steal, dual addr, intr disabled, clear TE, dma enabled

            fill_buffer((unsigned long)&snd_buffer + MAX_NUM_SAMPLES * 4);

            // wait on DMA
            while (!(SH2_DMA_CHCR1 & 2)) ; // wait on TE

            // start DMA on second buffer and fill first
            SH2_DMA_SAR1 = ((unsigned long)&snd_buffer + MAX_NUM_SAMPLES * 4) | 0x20000000;
            SH2_DMA_TCR1 = NUM_SAMPLES; // number longs
            SH2_DMA_CHCR1 = 0x18E1; // dest fixed, src incr, size long, ext req, dack mem to dev, dack hi, dack edge, dreq rising edge, cycle-steal, dual addr, intr disabled, clear TE, dma enabled

            fill_buffer((unsigned long)&snd_buffer);

            // wait on DMA
            while (!(SH2_DMA_CHCR1 & 2)) ; // wait on TE
        }

User avatar
powerofrecall
Very interested
Posts: 237
Joined: Fri Apr 17, 2009 7:35 pm
Location: USA

Post by powerofrecall » Thu Mar 10, 2011 10:52 pm

Chilly Willy wrote:Okay, let's up the ante... here's the mod player and some sounds stuck in the Yeti3D demo. I'll be expecting a marching band in that parade, now. :lol:
Excuse my language, but Holy Shit.

WE NEED A NEW UNITY! :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest