Can't get .midi files to play using PlayMusic

Blitz3D Forums/Blitz3D Programming/Can't get .midi files to play using PlayMusic

WolRon(Posted 2004) [#1]
Can anyone else get this code snippet to work? of course, you will have to substitute your own .mid file
chnTitle=PlayMusic("Title.mid")
If chnTitle = 0 Then RuntimeError("file not loaded")
WaitKey()
End
I can't get it to work and keep getting "file not loaded" errors. The .mid file is in the same directory as the executable.


KiwiSteve(Posted 2004) [#2]
I've just tried it by putting a midi file in with the program, and it runs fine both from within Blitz3D and as the exe. Are you able to play your midi file in anything else like MediaPlayer? All I can think of is whether the file is corrupt. Sorry I can't be any more help.


WolRon(Posted 2004) [#3]
I can play the .mid files fine from within Windows MediaPlayer and Magix Midi Studio.

I can't play them from Blitz3D (I have Blitz3D version IDE 1.85, Linker 1.64, Runtime 1.85) nor from BlitzPlus (ver IDE 1.35, Linker 1.10, Runtime 1.37) either as executables or from within Blitz.

This all happens regardless of the .mid file I substitute.
The strange thing is that it used to work fine a while back. I don't remember when exactly it stopped working.


Ash(Posted 2004) [#4]
Go to the "Run" option in your start menu and type "dxdiag". There should be a tab in there for music. Check that the test works with all MIDI devices on your system; it could be that if one or more don't work, Blitz is trying to play out of the ones that don't work.

Do MIDI files play in other DirectX applications? (This is so we can test whether your DirectX needs to be re-installed, or whether it is solely a Blitz problem.)


WolRon(Posted 2004) [#5]
All tests in the DXDiag work OK.

I have an older game that I wrote in C++ that uses DirectX to play .mid files and that game runs fine (music plays).

Also, I tried this:
chnCool=PlayMusic("cool.wav")
If chnCool = 0 Then RuntimeError("wav file not loaded")
chnTitle=PlayMusic("Title.mid")
If chnTitle = 0 Then RuntimeError("mid file not loaded")
WaitKey()
End
And the wav file plays but the mid file doesn't (and I get the 'mid file not loaded' message).
Both files are in the same directory as the exe. It's not making sense.


WolRon(Posted 2004) [#6]
Can a number of you out there please try out that last code segment I wrote? I would like to know if it's really just my machine or if it affects all/some others.


BlitzSupport(Posted 2004) [#7]
It's working fine here...

Could you run Regedit (Start Menu -> Run -> regedit) and see what is in this key:


HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Multimedia\MIDIMap



... in particular, what's under 'szPname' and 'DeviceInterface'...?


WolRon(Posted 2004) [#8]
It appears that I don't have that key. I can go as deep as
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion
but I have no Multimedia entry under that.

As my sig says, I have WinXP Pro w/ SP1 Media Center Edition.

I did find this key
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\MIDIMap but it didn't contain either of values you mentioned (it had: Mapping Name = Sound System).
Don't know if it does any good.

I couldn't find either of these ('szPname' and 'DeviceInterface') either (except for references that didn't apply, such as AutoCAD and WindowsCE)

BTW, thanks for the reply...


BlitzSupport(Posted 2004) [#9]
Ah, how about this one? Anything listed under there?

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\MediaProperties\PrivateProperties\Midi\Ports

How about Control Panel -> Sounds and Audio Devices -> Audio -> MIDI Music Playback -> Default Device? What's the selected device, and are there any others you can select and try again with?


WolRon(Posted 2004) [#10]
This is what's listed in the control panel:
Microsoft GS Wavetable SW Synth

There are no others listed.

Under that key you mentioned there are two other keys with additional keys:
+Microsoft GS Wavetable SW Synth [Emulated]
 +Out
   DMPortGUID = 6c 5a 46 99 90 39 72 42 ac b3 61 c6 6d 9d 0a ff

+Microsoft MIDI Mapper [Emulated]
 +Out
   DMPortGUID = 05 0e a0 b3 1f c0 0d 4a 8b 7e ca 79 1a 40 bd d7


Does any of it mean anything to you?


BlitzSupport(Posted 2004) [#11]

Does any of it mean anything to you?


Not really. I wondered if maybe Blitz was incompatible with the basic Microsoft MIDI Synth, but I switched to that here and it played fine... so I've really no idea what's up!