Friday, October 12, 2007 2:34 AMHow do I play a MIDI file?
Friday, October 12, 2007 2:42 AM
Have a look at the following link, it should have a solution that will help. (http://www.vb-helper.com/index_multimedia.html)
Saturday, October 13, 2007 3:55 PMWhen I try to use the code from that site, I get a LoaderLock exception.
DLL 'C:\WINDOWS\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
Dim Player As New Microsoft.DirectX.AudioVideoPlayback.Audio(FileIO.SpecialDirectories.Desktop & "\test.mid")
Sunday, October 14, 2007 5:13 PM
I don't know what causes such an error but maybe it is the way you have the code written or where you have placed it.
I use this format and i have never had any trouble with it.
song =New Audio(FileIO.SpecialDirectories.Desktop & "\test.mid", True) End Sub
Sunday, October 14, 2007 10:21 PM
The loader lock is a common problem with Managed DirectX and has been posted about several times, here is a link to one such post on The Zbuffer. (http://www.thezbuffer.com/articles/304.aspx)
Sunday, October 14, 2007 10:28 PM
From the information in that link it sounds like there is not an exact reason for this error to occur.
Monday, October 15, 2007 1:03 AMI got rid of the exception, but the file still doesn't play!
Tuesday, October 16, 2007 7:43 AM
Please ensure you have done the following:
1. The DirectX 9.0c has been installed.
DirectX 9.0c Redistributable
2. Add References to your project.
3. Imports these namespaces.
Tuesday, October 16, 2007 9:03 PMI got it working.
Wednesday, October 17, 2007 9:00 PMI found out why it wasn't working. The volume was set to around -9000! I had to set the volume to 0. Why does DirectX store the previous volume setting, even between runs of the application?
Wednesday, October 17, 2007 10:11 PM
I believe it is changing your system volume
Thursday, October 18, 2007 1:03 AMYes, it is because windows media player changed the volume. Why are the volumes negative?
Thursday, October 18, 2007 2:48 AM
I don't know the exact reason for that.
I kind of have an idea as to the logic behind it though.
0 is a mid point in referring to a balance
I think of the 0 as being an acceptable mid point in the volume.
More like a starting point in the volume. Not too high, not too low.
Above this will be positive and below will be negative.
In terms of balance (left and right) you can't really use left and right as a value. It is number based.
you have to have a minimum which is a negative number on the left side, a maximum which is a positive number on the right side and an equal balance between both which is 0.
Of course you could use any range of numbers to represent this but positive and negative with a mid point or balance of 0 would be easier to follow as a standard.
It is possible i could be way off here but this is how i look at it.
Thursday, October 18, 2007 3:05 AM
Why are the volumes negative?
This blog article may be helpful to you.
What's in an audio volume?
"When you deal with volumes in pro audio equipment, volume is measured by two factors - attenuation and amplification. 0 means that the sound is playing at its native level, negative numbers are reductions in volume from that native level, and positive numbers indicate amplification.
For most computer hardware, volume is measured as attenuations - negative numbers running from 0 (max volume) to -infinity (0 volume). In practice, the number runs from 0 to -96dB. Typically computers don't ever amplify signals, just attenuate them."