martincameron / micromod

Music player libraries for MOD, S3M and XM formats.
BSD 3-Clause "New" or "Revised" License
159 stars 28 forks source link

Can't play MOD / S3M or XM file... Little Help? #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm compiling the C code for micromod on Visual Studio 2010 x64, and attempting 
to play any mod, s3m or xm file.  In my attempt to just use the sample w32 app 
(not the SDL), and I keep getting the following error when attempting to play.

Module file type not recognised

From debugging the code, it looks like it's unable to resolve the number of 
channels, and therefore returns a -1.

Not sure what I'm doing wrong.. any ideas?

Original issue reported on code.google.com by anotherz...@gmail.com on 7 Oct 2012 at 3:27

GoogleCodeExporter commented 9 years ago
Okay getting further.. it seems that this library is very picky about what is 
will and will not play.. I found a .MOD file and attempted to play it and got 
to this point:

Module Data Length: 3270 bytes.
00 - The Returning King     16 -
01 - Composed by            17 -
02 - LHS/BAFH               18 -
03 - -------------------    19 -
04 - Samples by             20 -
05 - Maktone                21 -
06 - -------------------    22 -
07 - For                    23 -
08 - Big Chipcompo #4       24 -
09 -                        25 -
10 -                        26 -
11 -                        27 -
12 -                        28 -
13 -                        29 -
14 -                        30 -
15 -                        31 -
Song Duration: 25 seconds.

Where immediately after, it crashes... off to debugging :) 

Original comment by anotherz...@gmail.com on 7 Oct 2012 at 3:33

GoogleCodeExporter commented 9 years ago
Looks like it bombs right here:

/* Open Audio Device. */
check_mmsys_error( waveOutOpen( &h_wave_out, WAVE_MAPPER, &wave_format, ( DWORD 
) wave_out_proc, 0, CALLBACK_FUNCTION ) );

I changed the function to:

waveOutOpen(&h_wave_out, WAVE_MAPPER, &wave_format, NULL, 0, CALLBACK_NULL);

Now I get audio :)... however it's not releasing the semaphore, in my hack 
here.. so lets see if we can get this to work correctly

Original comment by anotherz...@gmail.com on 7 Oct 2012 at 3:44

GoogleCodeExporter commented 9 years ago
And the cheezy fix is:

/* Open Audio Device. */
check_mmsys_error( waveOutOpen( &h_wave_out, WAVE_MAPPER, &wave_format, 
(DWORD_PTR) wave_out_proc, 0, CALLBACK_FUNCTION ) );

simply needed DWORD_PTR instead of DWORD.  Guess a x64 thing vs a 32-bit 
thing..  anyone solved my own issue.

Original comment by anotherz...@gmail.com on 7 Oct 2012 at 4:07

GoogleCodeExporter commented 9 years ago
so it short, it actually seems to work well for all .mod files.  all .s3m and 
.xm files are not functional.  for such a tiny amount of code, it's quite 
awesome for my purposes..

Original comment by anotherz...@gmail.com on 7 Oct 2012 at 4:23

GoogleCodeExporter commented 9 years ago
Looks like I've got the types in the function signatures wrong, probably got 
them from a dodgy tutorial :)

It works on 32-bit machines because DWORDs and pointers are both 32 bit. The 
callback has the wrong signature as-well. I'll get it fixed, thanks!

Yeah, the C/Pascal versions are MOD only, they're intended to be as small/fast 
as possible.

Original comment by mum...@gmail.com on 13 Dec 2012 at 6:32

GoogleCodeExporter commented 9 years ago
love your work.

Just to add a little to this topic.

I can play all mod files with micromod-js, but XM files would not load. Using 
the latest IBXM jar app, it works flawlessly.

Original comment by plagu...@gmail.com on 8 May 2013 at 9:13

GoogleCodeExporter commented 9 years ago
Hi, the JavaScript version is also just a simple MOD only player. If I get some 
time I'll add S3M/XM support.

Cheers,
Martin

Original comment by mum...@gmail.com on 15 May 2013 at 8:11

GoogleCodeExporter commented 9 years ago

Original comment by mum...@gmail.com on 15 May 2013 at 8:15