setting volume of a sound
Blitz3D Forums/Blitz3D Programming/setting volume of a sound
| ||
whats the best way to set different volume levels for different sounds? At the moment I am doing this: channel=EmitSound (ship_explode_sound,s\ship_handle) ChannelVolume channel,0.7 |
| ||
channel=EmitSound (ship_explode_sound,s\ship_handle) ChannelVolume channel,0.7 channel2=EmitSound (ship_explode_sound,s\ship_handle) ChannelVolume channel2,0.9 channel3=EmitSound (ship_explode_sound,s\ship_handle) ChannelVolume channel3,0.5 Is that what you meant? Or what do you mean by 'best way'? |
| ||
if you want to set them permanently (so the volume for the samples are fixed at a specific value) you probably need to use a wrapped EmitSound function that uses a type to store the volume value and more. So you would create a Type that contains every parameter of a sound. then when you load it, you'd set the values to default values, eg. 1.0 for the volume. THen you'd need to use a command like SetVolume sample,volume# and when you call your MyEmitSound command the next time, it would emit the sound and also set the volume to that value you just defined with the SetVolume function call. |
| ||
is it ok for each sound effect to have its own channel or does that slow things down? Is it Ok to set the volume after the sound effect has been emitted? |
| ||
As far as I know, every time you have a sound effect it automatically creates another channel. When you do this: channel_variable=EmitSound(sound_variable) Channel_variable is just the variable that the channel handle is. By doing this: channel_variable=EmitSound(other_sound_variable) Channel_variable changes; the sound isn't now replacing your first sound's channel. All that Channel_variable is is just the way of using other sound commands with the channel. Just this: EmitSound(yet_another_sound_variable) Will still emit a sound with another channel. As for your second question, I see no problem whatsoever with changing your ChannelVolume. So far I've not encountered any problems with this. |
| ||
ok thanks I was doing that but sometimes a sound effect will be quiet even when I am close to the source, -but not often |