Playing Midi

Ruben
07-14-2001, 10:50 AM
I have been trying all kinds of code to work for playing midi's in my game and it says it is invaild I have VB 6.0 someone please help me

Gamer X
07-15-2001, 01:30 PM
I don't know if you've tried this, but, I use VB4 (32-bit) and it works for me. Simply add an ole object, and make it point to the midi file you want. Then, to start it, have the code:

OLE1.DoVerb

(Make sure to close it when you're done, with OLE1.Close)

The only downside I see is that you need to have the midi file externally, instead of inside the project. It works for me, though.

Have fun!
Gamer X

andrewo
07-15-2001, 11:39 PM
.

~

Teric
07-26-2001, 10:50 AM
I have also been looking for a way to play .wav and .midi files during game play. Any suggestions?

teach me
07-26-2001, 08:14 PM
I play wavs like this:

Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Sub Playwav(file)
SoundName$ = file
wFlags% = SND_ASYNC Or SND_NODEFAULT
X% = sndPlaySound(SoundName$, wFlags%)

End Sub

It's called :
Playwav("c:\blah\blah.wav")

It just plays the wav, but stops any animation going on I've discovered.

Does anyone know how to play midis without showing the application in which it is being played?

Squirm
07-27-2001, 10:33 AM
If you want it to play .wavs and .mids like proffessional games (such as Half-Life) where you might just get a snippet of a .wav here, and another snippet here, and many .wavs playing at one, use DirectSound I would suggest.

http://64.23.12.52//TUT_DX7_DS.asp

Spectre
07-28-2001, 01:05 PM
I struggled with using PlaySound for a while and later learned the problem was that it doesnt mix. hehe.
I ended up using DirectX8 - DirectMusic to do it. It is pretty easy. It mixes for you, you can control it's volume and x,y,z location and such. Much better for games than sndPlaySound or using MCI.
The DirectX8 SDK comes with some good examples, the most helpful to me was the "Simple Audio Path" example. You may wish to check that out.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum