# A SDL component

The SDL library is like DirectX under Windows. It allows program using the graphics cards, the sound cards, the joystick, and so on in a system independent manner.

I think the more interesting is the SDL sound part + SDL_mixer library, so that we can add a multi-track sound system to a gambas program.

The problem is that this sound component must be compatible with the event loop management of the qt component. Something to study...

The other problem is to create a easy interface to the SDL functions, not just use them directly. It is a matter of design thinking...

I know you've resisted having multiple processes/threads in the interpreter, but maybe for the kind of apps you're talking about (multitrack audio, which can't stand a bit of latency) it's time to look into them? I've considered controlling a command line based recording or playback program over a Process object so I could write waveform data to it constantly rather than waiting for it to start up each time, but I don't know if I'll be able to throw enough data at it using Gambas to keep it happy.... -- RobKudla - 11 Aug 2003

I think that we can see at the Blitz3D basic language, to have an idea of the graphic synthaxe method to use. This linguage use SDL and Directx as well. -- FabienBodard - 14 Aug 2003

Well, I have written some C stuff that interacts with SDL. I am currently writing the SDL component. Benoit asked me to post my thoughts of the component structure here, so... Basically, SDL sound facilities have functions to deal with background music stuff (ogg, mp3, ...) and other functions to deal with imtermittent sounds (mostly wav files). I am trying my best to wrap up the component to be very easy to use. Here is the scenario I imagine:

For music:

- PlayMusic(filename)
- PauseMusic()
- StopMusic()

For wav:

- LoadWave(filename, filenumber)
- PlayWave(filenumber)
- PauseWave(filenumber)
- StopWave(filenumber)

Of course initialization and de-allocation are taken care of automagically. This might not be all the facilities that SDL offers but I hope you're convinced that for GB users, Less is more. -- AhmadKamal - 31 Aug 2003

Don't forget to sign your changes Ahmad ! :-) I'm currently reading the SDL mixer doc to suggest you a more powerful interface... -- BenoitMinisini - 31 Aug 2003