
#Purebasic play midi file windows
All these infos are streamed to a MIDI-synthesizer, which is implemented in Windows as a software-module, but can be on the soundcard as a hardware-interface. It stores information about the used instrument, the pressed/released note, the volume of one of the 16 virtual channels, and a lot more of these information. It is not based on (maybe compressed) samplevalues. One is attached to a true MIDI interface (that's the one that plays) and the other two are USB MIDI devices.The Midi-format is totally different from those like WAV, MP3, etc.
#Purebasic play midi file how to
One thing I cannot seem to figure out is how to change the MIDI device that this plays out of. I am going to add a selector so I can choose
#Purebasic play midi file code
This code plays a piano sound (in the left side only - weird panning), and I figured out how to change the instrument type. The Syntax is very different from what I am used to, but I can learn it.

I read the article on MSDN and this really shows me how to adapt c++ to PureBasic. While midiOutClose_(\MidiOUT) = #MIDIERR_STILLPLAYING : Wend While midiInClose_(\MidiIN) = #MIDIERR_STILLPLAYING : Wend If GetAsyncKeyState_(27)&$8000 :_Quit=#True : EndIfĬase TBVol : midiOutSetVolume_(\MidiOUT,GetGadgetState(Tbvol)) MessageRequester("Error","No Midi devices found",0) SetGadgetText(_TG, "MIDI setting ready! Play MIDI Keyboard")Įlse : MessageRequester("Error","Can't connect MIDI",0) If Not midiConnect_(\MidiIN, \MidiOUT, 0) MidiOutShortMsg_(\MidiOUT, 192 | Instrument<<8 ) set instrument MessageRequester("Error","Can't start MIDI IN",0)Įlse : MessageRequester("Error","Can't open MIDI 0, 0, 0, 0) If midiInStart_(\MidiIN) #MMSYSERR_NOERROR If 0, 0, #CALLBACK_FUNCTION) = #MMSYSERR_NOERROR SetGadgetText(_TG,"Note Off "+Str(\Stat)+" Vel "+Str(\Dat1)) If \Dat1 : SetGadgetText(_TG,"Note On "+Str(\Stat)+" Vel "+Str(\Dat1))Įlse : SetGadgetText(_TG,"Note Off "+Str(\Stat)) Here only show NoteOn, NoteOff and Velocity dat2 is unused for Midi in/ Out callback function for handling incoming MIDI messages. Procedure MIDIInProc(hMidiIn, Msg, Instance, Dat1, Dat2) get MIDINotes Windows Only, with a Midi Keyboard attached.

Midi_batterie( #Long_Whistle, "blanche", 127, 127,vitesse) Midi_batterie( #Acoustic_Snare, "double_croche", 127, 127,vitesse) Midi_batterie( #Closed_Hi_Hat, "double_croche", 127, 127,vitesse) Midi_batterie( #Side_Stick, "double_croche", 127, 127,vitesse) If Event = #PB_Event_CloseWindow If the user has pressed on the close buttonĮnd All the opened windows are closed automatically by PureBasic

If openwindow ( 0, 100, 200, 320, 200, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget ) Lunch could be used for any sound to Windows events !! For sound to the opening or closing a window This example shows how to use the Midi library le midi pourrai etre employer pour sonoriser tout evenements Windows !! pour sonoriser l'ouverture ou la fermeture d'une fenetre

cette exemple montre comment employer la Midi librairie
