From wizard at syntheticsw.com  Sat Oct  1 08:46:39 2005
From: wizard at syntheticsw.com (Torsten Giebl)
Date: Sat, 1 Oct 2005 14:46:39 +0200 (CEST)
Subject: Minimal Example playing a MOD File using SDL Sound
Message-ID: <49396.195.179.193.232.1128170799.squirrel@mail.syntheticsw.com>

Hello !



I just compiled SDL_sound on my
Mac and it works great.

Is there a minimal example
available how load a MOD File from Disk and
play it using SDL sound ?

The playsound example
that comes with SDL sound is good, but a little bit
complex.



CU



From icculus at clutteredmind.org  Sat Oct  1 12:06:55 2005
From: icculus at clutteredmind.org (Ryan C. Gordon)
Date: Sat, 01 Oct 2005 12:06:55 -0400
Subject: [sdlsound] Minimal Example playing a MOD File using SDL Sound
In-Reply-To: <49396.195.179.193.232.1128170799.squirrel@mail.syntheticsw.com>
References: <49396.195.179.193.232.1128170799.squirrel@mail.syntheticsw.com>
Message-ID: <433EB41F.4040001@clutteredmind.org>


> The playsound example that comes with SDL sound is good, but a little bit
> complex.

You aren't the first to say that...since this comes up a lot, I've
trimmed the crap out of playsound.c, so all it does is play back a list
of audio files, like this:

  ./playsound_simple myfile.mp3 myfile2.mod myfile.ogg [...etc...]

Total file size, with a LOT of comments is now 190 or so lines of code.
In terms of actual relevant code, it's probably less than 50 lines.

This is in subversion for both 1.0.x and 1.1.x, but here's the file
directly:

http://svn.icculus.org/SDL_sound/trunk/playsound/playsound_simple.c?rev=509

The general strategy looks like this:

The main app:
1. Set up SDL and SDL_Sound.
2. Start audio callback, and wait for it to notify you that it has
finished playing back the file with a global variable (or whatever).
3. Clean up and exit.

The audio callback:
1. See if there's data already decoded, if not, decode more.
2. If there's still no data, notify the main app, write silence, return.
3. Write available decoded data to device, up to max it is asking for.
4. If the device wants more than you wrote this iteration, go to #1
until it's full or we've run out in #2.
5. Update state for next callback, return.

...let me know if you have any questions.

--ryan.



From icculus at clutteredmind.org  Wed Oct 12 18:21:09 2005
From: icculus at clutteredmind.org (Ryan C. Gordon)
Date: Wed, 12 Oct 2005 18:21:09 -0400
Subject: [sdlsound] SDL_sound modplug configure patch
In-Reply-To: <200506181026.49016.tsm@accesscomm.ca>
References: <200506181026.49016.tsm@accesscomm.ca>
Message-ID: <434D8C55.1070405@clutteredmind.org>


> Repost, since this got missed.
> 
> SDL_sound-1.0.1 checks for modplug.h just under /usr/include/modplug.h, when 
> it should be checking /usr/include/libmodplug/modplug.h, hence it never finds 
> and uses modplug.  Patching configure.in and adding 
> -I/usr/include/libmodplug/ to the include path lets it detect and use it.  
> I'm not sure what the proper way to add include paths is, besides the 
> commandline, however.

Something like this is in Subversion now (both 1.0 and 1.1 branches),
thanks!

--ryan.



