sound question

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
tejunekim
Prole
Posts: 3
Joined: Mon Mar 02, 2009 10:29 pm

sound question

Post by tejunekim » Mon Mar 02, 2009 10:39 pm

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

User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: sound question

Post by qubodup » Tue Mar 03, 2009 10:11 am

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.
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)

User avatar
Skofo
Party member
Posts: 146
Joined: Mon Dec 22, 2008 10:55 pm

Re: sound question

Post by Skofo » Tue Mar 03, 2009 3:26 pm

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.
Working on: Viator
Need a 64-bit Debian package for LÖVE? Here it is!

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: sound question

Post by bartbes » Tue Mar 03, 2009 3:33 pm

I'm disappointed in qubodup that you don't mention sound:setVolume(volume)?
(only available on sound objects)

tejunekim
Prole
Posts: 3
Joined: Mon Mar 02, 2009 10:29 pm

Re: sound question

Post by tejunekim » Tue Mar 03, 2009 11:40 pm

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

User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: sound question

Post by qubodup » Wed Mar 04, 2009 8:55 am

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!
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)

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: sound question

Post by bartbes » Wed Mar 04, 2009 2:20 pm

@qubodup: so, you noticed my post? :P
@tejunekim: you apparently didn't... or maybe you just didn't understand

tejunekim
Prole
Posts: 3
Joined: Mon Mar 02, 2009 10:29 pm

Re: sound question

Post by tejunekim » Fri Mar 06, 2009 4:05 am

@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.

User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: sound question

Post by qubodup » Fri Mar 06, 2009 5:04 pm

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.
Attachments
20real.love
(312.16 KiB) Downloaded 129 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)

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 23 guests