Unable to change volume of already playing music (SOLVED)

I’m trying to implement separate controls for music and sfx.

I have music playing on channel 1 and sfx on 2.

Everything is working as expected except that when I change the global variable for the volume on channel 1 (music channel), it doesn’t effect the volume of the music track that is already playing. That continues to play at the volume set when it was started. If the music track is changed then that will play at the new correct volume, but I need the volume to change in real time as the same music might play for several minutes

Is this a bug? I would expect to be able to change the volume of a music track that is playing on a channel when the volume of that channel is changed.

I have custom functions that play music / sound effects based off of drop down lists where I can select the track required but I don’t think that should effect anything as ultimately all it is doing is playing a track on a channel.

dev game link: (going inside and outside a building will trigger the music to change)

I should add I am using the play audio by filename extension by Silver Streak, not sure if that changes anything.

Only “solution” I can think of is to somehow restart the music track whenever the volume is changed…

Your first screen snip has actions for playing sound on a channel. The second screen snip adjusts the volume of music on a channel. Change the actions in the second screen snip to sound.

1 Like

ahh, changed everything to sound and it now works. Will it have any effect on performance changing all the music to sounds?

Thank you!

Check the performance of playing them as sound. Then change both actions to play music on a channel and check the performance. Update your topic after, I am curious.

I was just typing up how it seemed to take longer to load in the music, when I realised it’s because they would still be set to preload as music not sound, but either way it caused a couple of minor issues like playing the music as sound meant other sounds would stop the music now, including the chicken squawking I had as a test sound when I changed the volume. For better or worse I’ve built a music system that works for me so don’t want to change it!

I’m not sure what’s happening in the code of the play audio by filename extension but I’ve put the music channel back to play music as music and I’ve set my buttons to change both the music and sound on the channel and now it all works flawlessly.

Ah, interesting. I did not think about sounds interfering with music as sound. Good to know and glad you got the system going.

It may depending on the size of the file. Check this link for an explanation to the difference between the sound and music methods.

2 Likes