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
sound question
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- qubodup
- Inner party member
- Posts: 775
- Joined: Sat Jun 21, 2008 9:21 pm
- Location: Berlin, Germany
- Contact:
Re: sound question
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.
This however will probably affect all game sounds.
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
Re: sound question
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.
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.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: sound question
I'm disappointed in qubodup that you don't mention sound:setVolume(volume)?
(only available on sound objects)
(only available on sound objects)
Re: sound question
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
- qubodup
- Inner party member
- Posts: 775
- Joined: Sat Jun 21, 2008 9:21 pm
- Location: Berlin, Germany
- Contact:
Re: sound question
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!
Example of changing volume of ONE SOUND whilst playing!
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: sound question
@qubodup: so, you noticed my post?
@tejunekim: you apparently didn't... or maybe you just didn't understand
@tejunekim: you apparently didn't... or maybe you just didn't understand
Re: sound question
@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.
@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.
- qubodup
- Inner party member
- Posts: 775
- Joined: Sat Jun 21, 2008 9:21 pm
- Location: Berlin, Germany
- Contact:
Re: sound question
I used a sound object in the example.tejunekim wrote:(if i can use Sound instead of Music object)
My example suckored by the way, I didn't know what dt means. I attach an example of what I wanted it to do.
- Attachments
-
- 20real.love
- (312.16 KiB) Downloaded 213 times
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
Who is online
Users browsing this forum: No registered users and 10 guests