Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / SetsoundinstanceVolume

Author
Message
smerf
15
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 29th Mar 2019 06:22
Ive been unable to get the sound to lower or raise the volume of a sound. Setsoundinstancevolume(SoundID,intvalue), inside or outside a loop or function it seems to do nothing for me in agk or agks. this a functional command?
A child's dream never dies.





PSY
Valued Member
4
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 29th Mar 2019 07:45
If you want to play your sound at a certain volume, you can use


If you want to change the volume while the sound is playing, you need to know the sound ID.
If a sound has stopped, the ID is gone and cannot be used again.

The following code generates 3 different IDs !

...so SetSoundInstanceVolume is useless when you execute it while the sound isn't playing.

It only affects the volume if the sound is actually still playing. You can check that with GetSoundInstancePlaying ( ID ).

At least that's how I think the sound instance stuff works.


PSY LABS Games
Coders don't die, they just gosub without return
smerf
15
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 29th Mar 2019 22:48
well thank you psy play sound was not a command in the online agkhelp file that i could find wheres the best complete help file?
A child's dream never dies.





PSY
Valued Member
4
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 29th Mar 2019 23:08 Edited at: 29th Mar 2019 23:11
welcome

The online help is actually complete. Maybe you overlooked the command, or you used an outdated file/local link
https://www.appgamekit.com/documentation/Reference/Sound/PlaySound.htm


PSY LABS Games
Coders don't die, they just gosub without return
smerf
15
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 30th Mar 2019 02:14
i was under the assumption that putting play sound in a loop would continually restart the sound. im trying to decrease volume based on player position.bo aldo? ant to change the stereo balance based on player locstipn to a sound source but it is only an instance command as far as i can tell and im not even sure what that is.
A child's dream never dies.





fubarpk
Retired Moderator
15
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 30th Mar 2019 02:26 Edited at: 30th Mar 2019 02:27
Quote: "i was under the assumption that putting play sound in a loop would continually restart the sound"

if GetSoundInstancePlaying( iID )=0 then playsound (IID) (will loop the sound)
fubar
smerf
15
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 30th Mar 2019 03:07
so fubark how am i supposed to continually adjust the volume using play sound, if play sound restarts my sound clip. I want to have dialogue in my game and as you move away from the dialogue it gets quieter based on a player's position I also want to have left and right balance for sound.
A child's dream never dies.





Santman
9
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 30th Mar 2019 03:50
The easiest way is to assign an array.

So for example sounds[1]=playsound(1)

That way, the array has the instance, then you can adjust it by using the array value as the sound reference.
fubarpk
Retired Moderator
15
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 30th Mar 2019 09:18 Edited at: 30th Mar 2019 10:05
Quote: "how am i supposed to continually adjust the volume using play sound"


SetSoundInstanceVolume( iID, vol ) it does work when you have the id correct
ive used it in this thread https://forum.thegamecreators.com/thread/223651
the following adjusts the crowds volume in relation to the distance from the car


Quote: "you can have several instances of a sound hence why an instance of a sound is different from the actual sound id "

in my game I have two grandstands so there is two different instance ids but only one sound, hope that helps

help
https://www.appgamekit.com/documentation/Reference/Sound.htm
fubar

Login to post a reply

Server time is: 2020-09-30 17:31:00
Your offset time is: 2020-09-30 17:31:00