great release again
MOD Player for 32X - the Good Enough release
Moderator: BigEvilCorporation
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
I use my own home built one.
viewtopic.php?t=889
That shows how to make your own gcc toolchain for the MD and 32X under linux, but it's about the same for mingw/cygwin if you use Windows. You get C, C++, ObjC, and ObjC++ compilers. It comes with simple examples for C and C++ for both the MD and 32X. It can also be used for my MOD player and Yeti3D demos as well.
viewtopic.php?t=889
That shows how to make your own gcc toolchain for the MD and 32X under linux, but it's about the same for mingw/cygwin if you use Windows. You get C, C++, ObjC, and ObjC++ compilers. It comes with simple examples for C and C++ for both the MD and 32X. It can also be used for my MOD player and Yeti3D demos as well.
OK, so I get this compiling very well on windows with the powerofrecall's compilers. But I have 3 last n00b questions:
- Where I could specify which pattern to start with, on a MOD?
- Where I could modify to make some MOD channels to play in mono?
- How I could just copy the Slave SH2 part, to make it to work on a source code like this one?
And again, sorry if I'm n00b, but that's because I just know ASM, and not C.
- Where I could specify which pattern to start with, on a MOD?
- Where I could modify to make some MOD channels to play in mono?
- How I could just copy the Slave SH2 part, to make it to work on a source code like this one?
And again, sorry if I'm n00b, but that's because I just know ASM, and not C.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
In module.c in the InitMOD() function, you'll find this toward the end:Bitybity wrote:OK, so I get this compiling very well on windows with the powerofrecall's compilers. But I have 3 last n00b questions:
- Where I could specify which pattern to start with, on a MOD?
Code: Select all
Mod_p->Order = 0; /* default order */
Mod_p->Row = 0; /* default row */
At the top of module.c, you'll find- Where I could modify to make some MOD channels to play in mono?
Code: Select all
/* define if handle 6 or 8 channel mods */
#define HANDLE_EXTRA_CHANNELS
/* define if handle panning */
//#define HANDLE_PANNING
/* define if want a little cross-talk between sides (only if no panning) */
//#define CROSS_TALK 3
You need to find where the Slave SH2 vector table directs the slave to run from on start up. Then direct it to my slave() function instead. It might be better to toss ALL the 32X code from Sonic 32X and redo it completely, keeping just the 68000 changes.- How I could just copy the Slave SH2 part, to make it to work on a source code like this one?
No problem. Just keep at it and you'll learn.And again, sorry if I'm n00b, but that's because I just know ASM, and not C.
-
- Very interested
- Posts: 84
- Joined: Sat Feb 28, 2015 9:22 pm
Re: MOD Player for 32X - the Good Enough release
Pardon the slightly off-topic question, but didn't you have source code for an XM player laying around somewhere as well? I ask because I wanted to take a look at integrating it, and the song I made is currently in XM format (converting it to MOD doesn't seem to be an easy option - many notes go out of range, so part of the song just sounds like complete ass upon conversion).
On a side note, do you think for a large-ish game that storing samples per song is likely to be an issue storage-wise? One thought I had was to modify the format so that instead of storing the sample data directly in the file, I have a separate global sample table and the modified XM file just points to entries in that table instead (if your XM code is anything like your MOD code, it looks like this could be a one-line change, on the line where it assigns the sample pointer), but ofc if this isn't likely to be an issue I'd like to be as lazy as possible and spend my effort on other things XD
EDIT: NVM, I found the XM player. Am now studying the internals of the audio mixing code. I'm not fantastic with assembly, and it's also late at night and my brain is perhaps not functioning at 100%, but I think I'm starting to understand this, at least to some extent. I may ditch the full-blown XM player and just write my own audio engine. I've once written a tracker playback engine in Unity3D in C#. Rather a different beast, but surprisingly(?) I'm seeing a lot of similarities between some of its inner workings and your audio mixing code.
EDIT 2: Oh, wow, the conversion from PCM buffer to PWM was more straightforward than I thought :O
Interesting that you do it "in-place" so to speak - clear the buffer, write samples to it, then convert buffer in-place from PCM to PWM. I also was not expecting it to be entirely in C, I thought it would be implemented in assembly somewhere XD
Man, this is a fantastic resource for someone who just wants to learn how audio works on the 32X. Really a damn shame more games didn't take advantage of the insane flexibility this system has...
On a side note, do you think for a large-ish game that storing samples per song is likely to be an issue storage-wise? One thought I had was to modify the format so that instead of storing the sample data directly in the file, I have a separate global sample table and the modified XM file just points to entries in that table instead (if your XM code is anything like your MOD code, it looks like this could be a one-line change, on the line where it assigns the sample pointer), but ofc if this isn't likely to be an issue I'd like to be as lazy as possible and spend my effort on other things XD
EDIT: NVM, I found the XM player. Am now studying the internals of the audio mixing code. I'm not fantastic with assembly, and it's also late at night and my brain is perhaps not functioning at 100%, but I think I'm starting to understand this, at least to some extent. I may ditch the full-blown XM player and just write my own audio engine. I've once written a tracker playback engine in Unity3D in C#. Rather a different beast, but surprisingly(?) I'm seeing a lot of similarities between some of its inner workings and your audio mixing code.
EDIT 2: Oh, wow, the conversion from PCM buffer to PWM was more straightforward than I thought :O
Interesting that you do it "in-place" so to speak - clear the buffer, write samples to it, then convert buffer in-place from PCM to PWM. I also was not expecting it to be entirely in C, I thought it would be implemented in assembly somewhere XD
Man, this is a fantastic resource for someone who just wants to learn how audio works on the 32X. Really a damn shame more games didn't take advantage of the insane flexibility this system has...