Audio.SfxVolume Changes Volume of Other Sounds

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
Sambo
Snifit
Snifit
Posts: 211
Joined: Fri Jan 24, 2014 6:43 pm

Audio.SfxVolume Changes Volume of Other Sounds

Postby Sambo » Fri Jun 10, 2016 6:38 pm

I set the volume for a certain chunk to be lower when a custom sound effect played because it was too loud, but then OTHER sound effects started to be quieter when they played. Apparently, these audio functions use the same channels as the default sound effects. How can I make it so I can change the volume of custom sounds without screwing with the default sounds?

Quantumenace
Chain Chomp
Chain Chomp
Posts: 308
Joined: Mon Dec 28, 2015 2:17 am

Re: Audio.SfxVolume Changes Volume of Other Sounds

Postby Quantumenace » Fri Jun 10, 2016 7:32 pm

Audio.SfxVolume changes the volume of the channel, not the sound itself. I had similar problems with using fadeout effects; if the player dies and the level reloads during fade in/out the channel volume will stay at a lower volume.

You can modify the volume of a chunk with its .volume field:

Code: Select all

local rocketloopsound = Audio.SfxOpen("rocketloop.ogg")
rocketloopsound.volume = 32
That should change the volume of any playback of the same sound file, even if you call it with Audio.playSFX(string) instead of the chunk variable.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari