We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3495 - Native MIDI music volume manipulating changes application global sound volume (MS GS only)
Summary: Native MIDI music volume manipulating changes application global sound volume...
Status: NEW
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: x86 Windows (All)
: P2 minor
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-18 15:01 UTC by Vitaly Novichkov
Modified: 2019-06-19 10:24 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Novichkov 2016-11-18 15:01:05 UTC
Using midiOutSetVolume causes global uncontrollable application volume changing which we can see in the volumes panel. This happens with only MS GS MIDI Device, with other MIDI devices this doesn't happen.

A video demo which showing differences in MIDI engines work:
- My custom libADLMIDI MIDI Engine
- Native MIDI with standard Microsoft GS engine

https://www.youtube.com/watch?v=ObF9XBOa4Tk

Note: I used my own fork of the latest SDL Mixer which uses same code base with a few core changes and adding extra codecs (libADLMIDI, libGME):
https://github.com/WohlSoft/PGE-Project/tree/master/_Libs/SDL2_mixer_modified
Comment 1 Ozkan Sezer 2016-11-19 21:48:11 UTC
I remember having a similar issue: https://sf.net/p/uhexen2/code/3815/
Quoting my commit message:

http://msdn.microsoft.com/en-us/library/dd798480(VS.85).aspx#1
"This [midiOutSetVolume] function does not set the MIDI device
volume when using a software synthesizer under Windows Vista
or Windows 7, but instead alters the application-specific volume
level in the system mixer. This means that if your application
also outputs digital audio, the volume level of that audio will
be reduced or increased by the same amount."

AFAICS, the user addition in that msdn page no longer exists,
but the issue is there.
Comment 2 Vitaly Novichkov 2016-11-19 21:55:08 UTC
(In reply to Ozkan Sezer from comment #1)
> I remember having a similar issue: https://sf.net/p/uhexen2/code/3815/
> Quoting my commit message:
> 
> http://msdn.microsoft.com/en-us/library/dd798480(VS.85).aspx#1
> "This [midiOutSetVolume] function does not set the MIDI device
> volume when using a software synthesizer under Windows Vista
> or Windows 7, but instead alters the application-specific volume
> level in the system mixer. This means that if your application
> also outputs digital audio, the volume level of that audio will
> be reduced or increased by the same amount."
> 
> AFAICS, the user addition in that msdn page no longer exists,
> but the issue is there.

Yea, therefore I implemented libADLMIDI as default MIDI engine which is:
- required NO external bank files to be able to play MIDI
- generates sound from scratch by formulas (like real Yamaha OPL3 FM Synthesis chip did)
- works almost everywhere, tested Linux, Windows, OS X, Android.

However, this is suggested to people who want remember old DOS games or just liking the unique sound generated by that chip and have to use it for extra advantages in the music making, etc.
Comment 3 Vitaly Novichkov 2017-06-01 19:26:03 UTC
Okay, I have the solution idea: instead of passing entire MIDI file into Operating System, I have to implement the MIDI player that I'll iterate with dependence on sample rate and SDL Audio's timer and will play MIDI in real time. So, I getting the advantage: instead of changing application master volume, I have to apply volume multiply factor to every MIDI channel's volume value and this stupid bug will leave us. I already have iterative MIDI player at libADLMIDI, and I have to split it away as independent library that plays MIDI in real time with ability to attach any MIDI library or output to it
Comment 4 Castro B 2019-06-19 09:43:09 UTC
Does the issue already fixed? 
any current update? 
Thanks!

Castro B,
https://tab.do/zh-tw/
Comment 5 Vitaly Novichkov 2019-06-19 10:24:57 UTC
(In reply to Castro B from comment #4)
> Does the issue already fixed? 
> any current update? 
> Thanks!
> 
> Castro B,
> https://tab.do/zh-tw/

No, it isn't. I still keep in my mind this to implement at any moment. Thanks for reminding, I'll try to do this soon.