ThePentiumGuy Posted June 4, 2003 Posted June 4, 2003 should i attach a media player to my VB.NET apps to play a MIDI in the background, or will that be too slow? Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
iebidan Posted June 4, 2003 Posted June 4, 2003 Yes, if you use Windows Media will be a pain to wait until it loads, better try the following code, you can put it in a class and call it whenever you want Public Class cSound Declare Auto Function PlaySound Lib "winmm.dll" (ByVal name As String, ByVal hmod As Integer, ByVal flags As Integer) As Integer Public Const SND_SYNC = &H0 Public Const SND_ASYNC = &H1 Public Const SND_FILENAME = &H20000 Public Const SND_RESOURCE = &H40004 Public Sub PlaySoundFile(ByVal filename As String) PlaySound(filename, Nothing, SND_FILENAME Or SND_ASYNC) End Sub End Class And you can call the class using the following example Dim oSound as cSound = New cSound oSound.PlaySoundFile("the path for your sound file") Hope this helps you out Regards Quote Fat kids are harder to kidnap
*Experts* mutant Posted June 5, 2003 *Experts* Posted June 5, 2003 PlaySound will not play MIDI files. Try this API: http://www.mentalis.org/apilist/mciSendString.shtml There is a sample on that page. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.