Compiled SDL_Mixer w/ bcc but wav no worky

Hi all,

I’m looking for some help in getting sdl_mixer to play wav files. I’ve
spented some time trying to figure out what the problem might be but
haven’t a clue on what’s wrong still.

I downloaded sdl_mixer from cvs and built it under bcc since the
precompiled binary doesn’t play mp3. Here’s the macros that’s defined
while compiling:
GREGS_DEBUG;WIN32;NDEBUG;
_WINDOWS;NDEBUG;WAV_MUSIC;MOD_MUSIC;MID_MUSIC;USE_TIMIDITY_MIDI;OGG_MUSIC
;MP3_MUSIC

Now I’ve gotten .ogg and mp3 files to play fine but .wav and .mid can’t
seem to play. For midi files the window opens but I don’t hear anything.
As for trying to play wav files it results in a crash w/ fault coming
from SDL.dll. I’ve built SDL myself too and everything else seems to work
fine for it. I got sdl_image to work flawlessly btw.

The stacktrace when I ran it through the debug:

2812 Stopped First chance exception

:003543cc ; F:\myworkspace\demos\Bin\SDL.DLL

:00352b04 ; F:\myworkspace\demos\Bin\SDL.DLL

:00328bbd SDL._SDL_GetAppState + 0xfd

:00326d63 SDL._SDL_ReadLE32 + 0x13

:00427F09 LoadWAVStream(file=:0044B1F2, spec=:0012FE6C,
start=:00E5B424, stop=:00E5B428)

:00427B42 WAVStream_LoadSong(file=:0044B1F2, magic=:0012FEA8)

:00426B11 Mix_LoadMUS(file=:0044B1F2)

:00401532 SDL_main(argc=1, argv=:0012FF38)

:0040C51B console_main(argc=1, argv=:0012FF38)

:0040C6EF WinMain(hInst=:00400000, hPrev=NULL, szCmdLine=:00141F06, sw=
9)

:0040a56f ; __startup

Anyone have any idea why *.wav files causes a crash but mp3 and ogg seems
to play fine? I’m really stumped with this problem. Please help!

Thanks

Hi all,

I’m looking for some help in getting sdl_mixer to play wav files. I’ve
spented some time trying to figure out what the problem might be but
haven’t a clue on what’s wrong still.

I downloaded sdl_mixer from cvs and built it under bcc since the
precompiled binary doesn’t play mp3. Here’s the macros that’s defined
while compiling:
GREGS_DEBUG;WIN32;NDEBUG;
_WINDOWS;NDEBUG;WAV_MUSIC;MOD_MUSIC;MID_MUSIC;USE_TIMIDITY_MIDI;OGG_MUSIC
;MP3_MUSIC

Now I’ve gotten .ogg and mp3 files to play fine but .wav and .mid can’t
seem to play. For midi files the window opens but I don’t hear anything.
Timidity can’t find it’s patchset, that’s why. Have a look at
http://www.libsdl.org/projects/SDL_mixer/ down by the bottom. If you want
MIDI files to play via whatever native rendering is available, check out
native_midi_common.c and stuff related to it.

As for trying to play wav files it results in a crash w/ fault coming
from SDL.dll. I’ve built SDL myself too and everything else seems to work
fine for it. I got sdl_image to work flawlessly btw.

Anyone have any idea why *.wav files causes a crash but mp3 and ogg seems
to play fine? I’m really stumped with this problem. Please help!
Could you post a minimal example that reproduces the problem please?On Friday 06 May 2005 13:50, Vivi Orunitia wrote:

Tyler Montbriand wrote in
news:200505062233.58732.tsm at accesscomm.ca:

Timidity can’t find it’s patchset, that’s why. Have a look at
http://www.libsdl.org/projects/SDL_mixer/ down by the bottom. If you
want MIDI files to play via whatever native rendering is available,
check out native_midi_common.c and stuff related to it.

Thanks for that piece of info. Will check that out and see how it goes.

Anyone have any idea why *.wav files causes a crash but mp3 and ogg
seems to play fine? I’m really stumped with this problem. Please
help!
Could you post a minimal example that reproduces the problem please?

I’m using the SDL_mixer_demos.zip demo for testing. You can find it here
near the bottom http://jcatki.no-ip.org/SDL_mixer/

The only part I changed in the code is on line 132 where I gave it a
direct path of the sound file to load instead of from argv arguments. eg.

if(!(music=Mix_LoadMUS("F:\\myworkspace\\demos\\ball.wav")))

Another interesting thing is that I can’t mix and match what I built with
the supplied precompiled binaries. For example, if I use sdl.dll that I
built with the sdl_mixer.dll supplied from the site then during runtime
it gives me can’t locate procedure entry point for SDL_RWFromFP or some
function named that. Another example, using supplied sdl.dll from the
site and my own compiled sdl_mixer.dll results in a fault in ntdll.dll
instead of sdl.dll when trying to play a wave file.

Could this problem be related to endianess or some byte alignment
problem? From the time I’ve spent trying to figure this out it seems to
suggest that because crashes occur in the LoadWAVStream when it calls the
SDL_ReadLE32. The SDL_RWFromFP I mentioned earlier is also called from
LoadWAVStream and both of these functions appear to be in the
sdl_endian.c source I believe.

Any help on this is appreciated and thanks for responding.> On Friday 06 May 2005 13:50, Vivi Orunitia wrote:

Anyone have any idea why *.wav files causes a crash but mp3 and ogg
seems to play fine? I’m really stumped with this problem. Please
help!
I’m thinking either weird linkage problems or some sort of strange wav file.
Not all wav’s are raw PCM audio, an annoyingly large number of them use some
bizzare compression that only windows understands. Could you link to the wav
file you’re using please? I can check if it’ll play here.

I’m using the SDL_mixer_demos.zip demo for testing. You can find it here
near the bottom http://jcatki.no-ip.org/SDL_mixer/
Huh. Those really ought to work then.

Another interesting thing is that I can’t mix and match what I built with
the supplied precompiled binaries. For example, if I use sdl.dll that I
built with the sdl_mixer.dll supplied from the site then during runtime
it gives me can’t locate procedure entry point for SDL_RWFromFP or some
function named that. Another example, using supplied sdl.dll from the
site and my own compiled sdl_mixer.dll results in a fault in ntdll.dll
instead of sdl.dll when trying to play a wave file.

Could this problem be related to endianess or some byte alignment
problem?
Endianness is not inconceivable, SDL thought my opteron system was big-endian
for a short while there :smiley: It defaults to big-endian whenever it can’t
figure out what else you’re using. It ought to think it’s little-endian from
that WIN32 but we might as well rule it out. Check out SDL_byteorder.h to
see what defines it uses to deduce it, and this to test what it thinks it is
right now:

#include <stdio.h>
#include <SDL/SDL_byteorder.h>

int main(int argc, char *argv[])
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
fprintf(stderr,“SDL is configured as big-endian\n”);
#elif SDL_BYTEORDER == SDL_LIL_ENDIAN
fprintf(stderr,“SDL is configured as little-endian\n”);
#else
fprintf(stderr,“NO endianness defined!\n”);
#endif
return(0);
}

Byte alignment is also quite possible, though I don’t know what to do about
that. Haven’t used borland’s compiler in almost a decade. Apparently there
are borland-specific instructions in Borland.htm in the zipped source
distribution, maybye those’ll help.On Friday 06 May 2005 23:20, Vivi Orunitia wrote:

Tyler Montbriand wrote in
news:200505071401.12711.tsm at accesscomm.ca:

I’m thinking either weird linkage problems or some sort of strange wav
file. Not all wav’s are raw PCM audio, an annoyingly large number of
them use some bizzare compression that only windows understands.
Could you link to the wav file you’re using please? I can check if
it’ll play here.

I’m pretty confident that sdl_mixer can understand this wav file I’m
testing. This is because I’ve used the precompiled sdl.dll and
sdl_mixer.dll for building and it plays that wave file just fine.

I’m trying to build my own of course in trying to get mp3 working in there.

I’m using the SDL_mixer_demos.zip demo for testing. You can find it
here near the bottom http://jcatki.no-ip.org/SDL_mixer/
Huh. Those really ought to work then.

yup that’s why I said. So I’m pretty sure it has something to do with the
way things are built under bcc since that’s the only variable here.

Endianness is not inconceivable, SDL thought my opteron system was
big-endian for a short while there :smiley: It defaults to big-endian
whenever it can’t figure out what else you’re using. It ought to
think it’s little-endian from that WIN32 but we might as well rule it
out. Check out SDL_byteorder.h to see what defines it uses to deduce
it, and this to test what it thinks it is right now:

Byte alignment is also quite possible, though I don’t know what to do
about that. Haven’t used borland’s compiler in almost a decade.
Apparently there are borland-specific instructions in Borland.htm in
the zipped source distribution, maybye those’ll help.

Well I just gave your code snippet a test and the stderr.txt outputs
little-endian so the config seems ok(using WinXP SP2 btw).> On Friday 06 May 2005 23:20, Vivi Orunitia wrote:

Just a quick update. I got the midi working! yay! Your suggestion did the
trick :slight_smile: