FS#1728 - Need to specify the midi output devise

Attached to Project: OpenTTD
Opened by Sjoerd_NLD (Sjoerd_NLD) - Wednesday, 30 January 2008, 21:44 GMT
Last edited by Jean-Francois Claeys (Belugas) - Tuesday, 26 February 2008, 20:34 GMT
Type Feature Request
Category Core
Status Not confirmed
Assigned To No-one
Operating System Windows
Severity Low
Priority Normal
Reported Version 0.6.0-beta3
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No



I wanted to adjust the volume of the music, I moved the slider to the left but no change in volume.
The volume of the sound effects does work.
I think this is a bug.
I'm using 0.6.0.b3 on windows, I have a Creative SB Audigy soundcard (VEN:1102 DEV:0004).

This task depends upon

Comment by Jean-Francois Claeys (Belugas) - Thursday, 31 January 2008, 03:14 GMT
Just tested it, on WinXP. I have an onboard no fancy no thrill audio card.
It works flawlessly.
I can turn volume of music up or down right from the application.
Same as sound effects.
I have no clue why you have this behaviour.
Can you at least shut the music up?
Comment by Jean-Francois Claeys (Belugas) - Friday, 01 February 2008, 04:30 GMT
Do you have any other program apart OpenTTD that runs midi files? And which that you can change volume?
Comment by Loïc GUILLOUX (glx) - Friday, 01 February 2008, 15:40 GMT
What music driver is actually used? Run "openttd -d driver1" to determine it.
Comment by Sjoerd_NLD (Sjoerd_NLD) - Tuesday, 05 February 2008, 21:51 GMT
I will run openttd -d driver1 later this week.

I use the latest webrelease of the SB Audigy driver found on, I can stop the music with the stop button and resume with play. The volume slider has no effect, the effects slider is working.

As far as I know I have no other midi software enabled.
Comment by Jean-Francois Claeys (Belugas) - Friday, 22 February 2008, 19:39 GMT
Sjoerd, do you have any news for us regarding your "-d driver1" test?
Comment by Sjoerd_NLD (Sjoerd_NLD) - Monday, 25 February 2008, 21:15 GMT
Hello guys,

This is the output of openttd -d driver1:

dbg: [driver] Successfully probed blitter '8bpp-optimized'
dbg: [driver] Loading drivers...
dbg: [driver] Successfully probed sound driver 'win32'
dbg: [driver] Successfully probed music driver 'dmusic'
dbg: [driver] Successfully probed video driver 'win32'

I used openttd 0.6.0-beta4

I have tested the following:
I started the game, loaded a save, started the music.
Then I used the windows key to return to the desktop, I opened the sound controls and moved the midi synth slider. That does work strangely.

I will search another driver for testing and report back here.


Comment by Loïc GUILLOUX (glx) - Monday, 25 February 2008, 21:28 GMT
There are 3 drivers for music: dmusic, win32 and null (which does nothing ;)). You can select the one to use with "openttd -m music_driver_name"
Comment by Sjoerd_NLD (Sjoerd_NLD) - Monday, 25 February 2008, 21:40 GMT

I tried both dmusic and win32, no change.
I also updated the driver from creative to the latest version, no change.

When I look in dxdiag it says that the "SB Audigy DirectMusic-synthesizer [E400]" is default and that it supports DLS.

Comment by Loïc GUILLOUX (glx) - Monday, 25 February 2008, 21:43 GMT
That's strange as dmusic driver asks directmusic directly.
Comment by Sjoerd_NLD (Sjoerd_NLD) - Monday, 25 February 2008, 22:02 GMT
Can I debug that somehow?
Comment by Sjoerd_NLD (Sjoerd_NLD) - Tuesday, 26 February 2008, 20:18 GMT
I found the problem, it's the creative card.
I tried another pc with a Creative SB Live!-audio [E880] card, same problem!
Then I removed the card and enabled the standard onboard card, SoundMax HD audio, then it works.
Then I started dxdiag and found that the default midi device is the "Microsoft Synthesizer".

So to reproduce this error, you need a creative audio card like the Live or Audigy.

Is there a way to set the "Microsoft Synthesizer" as default when starting the game?
Comment by Jean-Francois Claeys (Belugas) - Tuesday, 26 February 2008, 20:33 GMT
TO be honest, i really do not know.
But since it is confirmed that this is not a OpenTTD bug, i change it to Feature Request.
Maybe we'll find a way to do so
Thanks ofr your efforts :)
Comment by Sjoerd_NLD (Sjoerd_NLD) - Friday, 29 February 2008, 16:11 GMT
I found a way for changing the volume that works on all systems I have at home.
In the dmusic.cpp file, change the SetVolume function into this:

void MusicDriver_DMusic::SetVolume(byte vol)
long lVolume = vol * 2000 / 127 - 2000; ///< 0 - 127 -> -2000 - 0
IDirectMusicAudioPath *pDirectMusicAudioPath;
IDirectSoundBuffer *pDirectSoundBuffer;
DWORD dwBuffer = 0;

pDirectMusicAudioPath = m_pMusicManager->GetDefaultAudioPath();


if (S_OK != pDirectMusicAudioPath->GetObjectInPath( DMUS_PCHANNEL_ALL, DMUS_PATH_BUFFER, dwBuffer,
GUID_NULL, 0, IID_IDirectSoundBuffer, (void**) &pDirectSoundBuffer))


I build this using BuildOTTD and tested it on 3 systems, works fine.
I copied the code from this tutorial:

Comment by Loïc GUILLOUX (glx) - Friday, 29 February 2008, 16:56 GMT
BuildOTTD doesn't use directmusic , so you couldn't see that your change fails to compile.
But that shows one thing: win32 driver works correctly :)
Comment by Sjoerd_NLD (Sjoerd_NLD) - Saturday, 01 March 2008, 15:22 GMT
Jep you're right, I have tested that with the -d switch, shows win32 as driver.