Program Change with midi API?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

How can I do a program change with API.
e.g change from Acoustic piano to Acoustic Guitar (Nylon)?

Code: Select all


GetMidiDevice()

Procedure GetMidiDevice()
;
;=================== Midi ==================
; Copy structure 
MidiCaps.MIDIOUTCAPS
;
; get the number of midiout devices
iNumDevs.l = midiOutGetNumDevs_()
;===========================================
;
; Set Midi Output device info to combobox
For i =0 To iNumDevs-1
;   Get info about the Next device */
  If (midiOutGetDevCaps_(i, MidiCaps, SizeOf(MIDIOUTCAPS))) =0
;    
;   Display its Device name */
      AddGadgetItem(14,-1, PeekS(@MidiCaps\szPname[0]) );
    EndIf
Next
;
; Display First MidiOut device
If iNumDevs  0 to f is midi channel 1 to 16

 ;   /* Output the C note (ie, sound the note) */
          midiOutShortMsg_(midihandle, $00402890);
          Delay(500)
 ;   /* Output the E note */
          midiOutShortMsg_(midihandle, $00404090);
          Delay(500)
 ;   /* Output the G note */
          midiOutShortMsg_(midihandle, $00404390);
         Delay(500)
;    /* Here you should insert a delay so that you can hear the notes sounding */
        Delay(500);
;
;    /* Now let's turn off those 3 notes */
        midiOutShortMsg_(midihandle, $00003C90);
        midiOutShortMsg_(midihandle, $00004090);
        midiOutShortMsg_(midihandle, $00004390);
;
;     /* Close the MIDI device */
         midiOutClose_(midihandle);
EndIf

 
Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com