Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 19th, 2003, 02:41 AM
Registered User
 
Join Date: Jun 2003
Location: Manila, Laguna, Philippines.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwincusi
Default How do i play midi or wav files in VB.Net?

Can anyone give me a sample code on how to play midi or wav files in VB.Net

HEY_HEY
Reply With Quote
  #2 (permalink)  
Old June 21st, 2003, 09:13 PM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Just reference the Media Player objects and use them to play the audio.

Hal Levy
NOT a Wiley/Wrox Employee- Got a job for me?
Reply With Quote
  #3 (permalink)  
Old June 23rd, 2003, 02:01 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is a sub that I use:

 ' API Declaration
    Declare Auto Function sndPlaySound Lib "WINMM.DLL" (ByVal FileName As String, ByVal Options As Int32) As Int32

    ' For Info
    ' API Call Flags for sndPlaySound
    Const SND_SYNC = &H0 'synchronize playback - 'locks' app until sound finished
    Const SND_ASYNC = &H1 ' played async - app continues while sound playing
    Const SND_NODEFAULT = &H2 ' No default sound played if file not found
    Const SND_LOOP = &H8 ' 'loop the wave
    Const SND_NOSTOP = &H10 'don't stop current sound if one playing
    Const SND_NOWAIT = &H2000 'Do not wait if the sound driver is busy.
    Const SND_ALIAS = &H10000 ' Play a Windows sound (such as SystemStart, Asterisk, etc.).

    Public Sub PlayAWave(ByVal Soundfile As String, Optional ByVal MaxLoops As Integer = 1)
        ' Play a wav file one or more times, as required
        Dim i As Integer
        For i = 1 To MaxLoops
            ' Play Async - ie. Don't lock up the application
            sndPlaySound(Soundfile, SND_ASYNC And SND_NOSTOP)
        Next

    End Sub
Reply With Quote
  #4 (permalink)  
Old April 11th, 2005, 03:55 AM
Registered User
 
Join Date: Apr 2005
Location: London, , United Kingdom.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How do you play a mp3 file?
particularly for shadowpug

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Play .wav file mvenkatesan C# 2005 3 October 22nd, 2007 07:28 AM
wav file play mvenkatesan C# 2005 1 October 17th, 2007 04:01 AM
MIDI to .WAV BrianWren Other Programming Languages 0 September 1st, 2006 02:07 PM
MIDI to .WAV BrianWren VB How-To 0 September 1st, 2006 02:06 PM
How do I play a .wav file from Resources? furjaw Visual Basic 2005 Basics 0 May 27th, 2006 11:07 PM



All times are GMT -4. The time now is 03:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.