It used to be that sound effects were not affected by the plotscript, 'set music volume' (around pre-2011 I'd say) but now both sound effects and music is affected by the command, which screws up the parts of Kitty House where the music is muted but sound effects are still needed to play.
Any way to get the old way back, or even a plot script that will affect music and sound effects separately?
Sound effects affected by 'set music volume (n)'
Moderators: Bob the Hamster, marionline, SDHawk
- Only One In All
- Metal Slime
- Posts: 356
- Joined: Tue Oct 16, 2007 5:56 am
- Contact:
- Bob the Hamster
- Lord of the Slimes
- Posts: 7660
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
Re: Sound effects affected by 'set music volume (n)'
This is really a problem with our music backends.Only One In All wrote:It used to be that sound effects were not affected by the plotscript, 'set music volume' (around pre-2011 I'd say) but now both sound effects and music is affected by the command, which screws up the parts of Kitty House where the music is muted but sound effects are still needed to play.
Any way to get the old way back, or even a plot script that will affect music and sound effects separately?
the music_sdl backend keeps separate volume mixers for MIDI and for everything else. We used to only set the midi mixer, which meant that the volume commands were broken for sound effects and for ogg music. In 2010 we changed the music_sdl backend to change the overall volume, so it would work for both types of music. If we change it back to get the old sound effect behaviour, it will break volume support for ogg music.
Meanwhile, the music_native backend has no support for adjusting midi volume at all, so on that backend, volume adjusting commands will adjust ogg music and sound effects, but will have no effect on midi
It sucks, and we need a new music backend, but that is a whole lot of hard work, which is why we have not gotten around to it yet :(
It might be better to mute the song with "stop song", and then re-start it with "play song" after the sound effect.
We do NOT set the volume for sound effects in music_sdl ever. I've just looked through the SDL_mixer source and confirmed that setting the music volume does not affect the sound effects volume.
It turns out that this is actually a bug or purposeful anti-feature in Windows Vista and 7 (and 8 I assume). Other people have devised elaborate workarounds for this bug, or ditched the Windows MIDI synth entirely:
http://www.doomworld.com/vb/source-port ... di-volume/
There is a not-hacky solution, which is to modify the volume on a MIDI note-by-note basis instead of setting the global volume. This requires modifying SDL_mixer (which I'd rather dump instead)
Strangely enough any time we have a problem with SDL_mixer I google it, and some thread at doomworld.com is always the best result. They really know what they're doing, and I'd like to look into borrowing some of their code.
It turns out that this is actually a bug or purposeful anti-feature in Windows Vista and 7 (and 8 I assume). Other people have devised elaborate workarounds for this bug, or ditched the Windows MIDI synth entirely:
http://www.doomworld.com/vb/source-port ... di-volume/
There is a not-hacky solution, which is to modify the volume on a MIDI note-by-note basis instead of setting the global volume. This requires modifying SDL_mixer (which I'd rather dump instead)
Strangely enough any time we have a problem with SDL_mixer I google it, and some thread at doomworld.com is always the best result. They really know what they're doing, and I'd like to look into borrowing some of their code.
Last edited by TMC on Wed Jul 31, 2013 4:59 pm, edited 1 time in total.
- Only One In All
- Metal Slime
- Posts: 356
- Joined: Tue Oct 16, 2007 5:56 am
- Contact:
- Bob the Hamster
- Lord of the Slimes
- Posts: 7660
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
- Only One In All
- Metal Slime
- Posts: 356
- Joined: Tue Oct 16, 2007 5:56 am
- Contact:
Just wanted to add, if you change the volume with the command, then play an OGG, the volume change does NOT take effect. You need to play a MIDI in order for it to do so.
I just had a problem with my volume being at 4 when there was a clear plotscript command indicating it should be 255. The OGG played at 4, but when I swapped it out for a MIDI, it played it at 255.
I just had a problem with my volume being at 4 when there was a clear plotscript command indicating it should be 255. The OGG played at 4, but when I swapped it out for a MIDI, it played it at 255.