Hallo !
I am a beginner with SDL.
Where can I get more and detailed informations about the SDL ?
-In my first project, I will mix two wave-files and play them.
-In the next project, I will read a (mono or stereo))wave-file and play
it on the right channel, and a other file on the left channel.
Is this possible with the SDL ?
Thank?s
with best regards
Alex
-------------- next part --------------
A non-text attachment was scrubbed…
Name: a.moeltner.vcf
Type: text/x-vcard
Size: 288 bytes
Desc: Visitenkarte f?r Alexander Moeltner
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20000308/b36ec2c4/attachment.vcf
I am a beginner with SDL.
Welcome.
Where can I get more and detailed informations about the SDL ?
http://www.devolution.com/~slouken/SDL/
This is THE site for SDL and has all the reference documentation and
examples you should need, plus archives of this mailing list.
-In my first project, I will mix two wave-files and play them.
-In the next project, I will read a (mono or stereo))wave-file and play
it on the right channel, and a other file on the left channel.
Is this possible with the SDL ?
Yep. For project #1, you’ll add the 2 waves, divide by 2, and send
the resulting wave to the audio device. For project #2, you’ll interlace
the data from the 2 waves into left-right data, LRLRLRLR, and feed that to
the audio device. Of course, you’ll need to make sure that the audio
device supports stereo.
Hope this helps...
-The Mighty Mike Master
http://tmmm.simplenet.comOn Wed, 8 Mar 2000, Alexander Moeltner wrote:
Hello MMM !
Thanks for your help !
How can i add the two wav-files ?
in this manner ?
SDL_LoadWAV(file1, &wave1.spec,&wave1.sound, &wave1.soundlen);
SDL_LoadWAV(file2, &wave2.spec,&wave2.sound, &wave2.soundlen);
wavemix.sound[i] = (wave1.sound[i] + wave2.sound[i]) / 2;
bye,
Alex
-------------- next part --------------
A non-text attachment was scrubbed…
Name: a.moeltner.vcf
Type: text/x-vcard
Size: 288 bytes
Desc: Visitenkarte f?r Alexander Moeltner
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20000309/5a6c5510/attachment.vcf
Hello MMM !
Thanks for your help !
How can i add the two wav-files ?
in this manner ?
SDL_LoadWAV(file1, &wave1.spec,&wave1.sound, &wave1.soundlen);
SDL_LoadWAV(file2, &wave2.spec,&wave2.sound, &wave2.soundlen);
wavemix.sound[i] = (wave1.sound[i] + wave2.sound[i]) / 2;
Yep, that’s the basic idea. However, if you’re only mixing 2
channels, it might be slightly more efficient to shift right 1 (>> 1)
rather than divide by two. However, if you only want to mix 2 channels and
you’re using SDL, there’s a convenience function in the audio library
called SDL_MixAudio():
http://www.devolution.com/~slouken/SDL/docs/audio/functions.html#SDL_MixAudio
Hope this helps...
-The Mighty Mike Master
http://tmmm.simplenet.comOn Thu, 9 Mar 2000, Alexander Moeltner wrote:
The Mighty Mike Master wrote:
it might be slightly more efficient to shift right 1 (>> 1)
rather than divide by two.
I think that most of the compilers do this simple optimisation if the
operands are integer.–
____
_
/ ___
/ _
/ _
/ _
/
///////
LIOULT Florent
Universit? de Caen
@LIOULT_Florent
www.multimania.com/flioult