VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Play

Aidan  (3 Submissions)   VB function enhancement   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

A "Play" Command for Visual Basic. This is the equivalent of the QBasic
PLAY command that enabled you to play notes through the PC speaker. This
version allows you to take advantage of the Sound card and therefore has
many advantages. It uses the MIDI interface to send individual or
multiple notes to the sound card.

Inputs
It requires the notes that you wish to play - See the code for the exact syntax.

Assumes
The notes available range from A-G

Returns
Nothing

Side Effects
If you end the program while it is playing, it may not function correctly until you next restart windows (or log off and log on again).

API Declarations
Private Declare Sub SleepAPI Lib "kernel32" Alias "Sleep"_
(ByVal dwMilliseconds As Long)
Private Declare Function midiOutOpen Lib "winmm.dll"_
(lphMidiOut As Long, ByVal uDeviceID As Long, ByVal_
dwCallback As Long, ByVal dwInstance As Long,_
ByVal dwflags As Long) As Long
Private Declare Function midiOutShortMsg Lib "winmm.dll"_
(ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long
Private Declare Function midiOutClose Lib "winmm.dll"_
(ByVal hMidiOut As Long) As Long
Private Declare Function midiOutReset Lib "winmm.dll"_
(ByVal hMidiOut As Long) As Long

Rate Play (6(6 Vote))
Play.bas

Play Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters