Page 1 of 1

sound question

Posted: Mon Mar 02, 2009 10:39 pm
by tejunekim
Hi,

I am developing a game for a class project and I love LOVE! thanks for doing all the wonderful work.

I had a question regarding the audio library. I am trying to implement a vacuum object and am in need of being able to stop playing a sound immediately. (well optimally, i want to be able to play the vacuum start sound and then loop through the engine sounds until some event queue which then goes into the section of the vacuum powering down) I'm under the impression that current version won't do what I need. Will there be another release soon that might make this improvement? or should I look into exporting sdl_mixer functions into love? (will that be hard? what kind of environment would i need for it?) Or do you think I can hack it by making the sound into many little segments and timing them to play? This is a semester long project with 1/3 already gone so time is essential. thanks

Re: sound question

Posted: Tue Mar 03, 2009 10:11 am
by qubodup
I don't know if it's possible to implement a start-loop-exit sound system without having to use time, but you can 'stop' a sound by setting the volume to 0 I think.

This however will probably affect all game sounds.

Re: sound question

Posted: Tue Mar 03, 2009 3:26 pm
by Skofo
setVolume is used before you play a sound, I think.

I'm afraid that there isn't a way to stop a single sound. It's quite surprising, actually; you'd think there would be a way.

Re: sound question

Posted: Tue Mar 03, 2009 3:33 pm
by bartbes
I'm disappointed in qubodup that you don't mention sound:setVolume(volume)?
(only available on sound objects)

Re: sound question

Posted: Tue Mar 03, 2009 11:40 pm
by tejunekim
thanks for your replies! i was aware of changing the volume but its too bad we cant do that for a single sound :( i will look for a way around it

Re: sound question

Posted: Wed Mar 04, 2009 8:55 am
by qubodup
Documentation, Wiki tutorials - I agree that it's not obviously documented for a noob like me and you though.

Example of changing volume of ONE SOUND whilst playing!

Re: sound question

Posted: Wed Mar 04, 2009 2:20 pm
by bartbes
@qubodup: so, you noticed my post? :P
@tejunekim: you apparently didn't... or maybe you just didn't understand

Re: sound question

Posted: Fri Mar 06, 2009 4:05 am
by tejunekim
@qubodup thanks for the cool demo link! i will definitely try that on my background music (if i can use Sound instead of Music object)
@bartbes sorry, i didn't explain my problem sufficiently. my original question was to play a long sound file and stop it as oppose to mute it. the difference is that when i mute it, the sound is still playing. so if i had to play that same sound again before it stops playing, two segment of the same sound will be played. now im looking for a way to segment the sound and use the volume setting like you've suggested, but trying to minimize the artifact created from this hack is gonna be difficult. i wish we could stop playing a sound or seek to a different time.

Re: sound question

Posted: Fri Mar 06, 2009 5:04 pm
by qubodup
tejunekim wrote:(if i can use Sound instead of Music object)
I used a sound object in the example.

My example suckored by the way, I didn't know what dt means. I attach an example of what I wanted it to do.