Assigning sound to a channel

just a simple question. How do i assign a particualar sound or music to a channel? cant seem to find the option :neutral_face:

In “Audio > Sound/Music on channels”, you will find the “Play a sound on a channel” action and “Play a music on a channel”.

sorry. I meant assigning a particular sound to a channel , so when i toggle the sound button off/on for that particular channel only the background music turns off.

What do you mean by “assigning”, because it’s the same as “playing” (for me at least) ?

My bad ,got caught up . so got a sound and a music file and need to assign 2 seperate sound toggle on/off individually. how can i achieve this ? :frowning:

Just play the sounds on channel 1, and musics on channel 2. When you press the sound toggle button, pause/stop/mute (play/unmute) the sounds on channel 1, and when you press the music toggle button do the same but with music on channel 2 :slight_smile:

Sorry i wasnt being clear again. I need help for the first step where you add particular sound to the channel you want to . I imagine it looks like this :

CHANNEL 1–> music1.org
CHANNEL 2–>music2.org

cant seem to find the option where you add music1. org to CHANNEL 1.

You don’t add the sound files to a channel, but play a sound on a channel. Use the action “All actions >> Audio >> Sounds on channels >> Play a sound on a channel”.

Thanks :smiley: :smiley: :smiley: :unamused: . There seems to be another problem that popped up when i tried to assign the channels. Background music (sound toggle ) works perfectly fine on toggling sound on/off with animation. clicker ( sound toggle )doesnt seem to work at all. i couldnt locate the error since i used the same logic for both.

I’m testing it right now, it seems that the sound volume is not tracked along all the channel, the action to nodify the volume affects the current playing sound only, so when you play another sound (or the same) in this channel the volume is 100 again.
I’ve solved it with a “sound_volume” variable, this variable will track the saved sound volume, then you play the sounds with this volume as parameter. Here is your example fixed:
ToggleSoundMusic.zip (6.09 MB)
Maybe you should do something similar for the music (use a music_volume variable), in case you want to switch the music in middle of the scene :wink:
Music and sound are from Eric Matyas (http://soundimage.org/), here is his main topic http://www.forum.compilgames.net/viewtopic.php?f=36&t=8096

logic is very solid :slight_smile: . but there seems to be a problem when i tried to implement it and the second toggle button doesnt work . can you take a look at it for me.

Everything seems ok… Are you using the sound_volume variable as a parameter in the event 4 action? The action to play a sound has an option to set the volume, you have to use the volume variable there.

Hi, Both.

I’m trying out the “code”, and was wondering the use of the Sound Object.

Hey, that could work! :slight_smile:
Instead messing up with variables, volume of currently playing sound and set volume of future playing sound with the variable… The toggle button would just modify the volume of this sound object, it should set the volume for the currently playing sound and next ones too.
To have two “channels”, you can use two sound objects, and you’re ready, great idea @jfyeung :smiley: I always forget the extensions :stuck_out_tongue: