
J aime bien avoir du son quand je click sur les boutons des mes programmes, pas vous ?

Code : Tout sélectionner
;*******************************************************************************************
; Numéro Instrument entre 0 et 127
; Numéro du canal entre 0 et 15
; Note de musique entre 0 et 127
;
; Do Do# Ré Ré# Mi Fa Fa# Sol Sol# La La# Si
; Octave -2 0 1 2 3 4 5 6 7 8 9 10 11
; Octave -1 12 13 14 15 16 17 18 19 20 21 22 23
; Octave 0 24 25 26 27 28 29 30 31 32 33 34 35
; Octave 1 36 37 38 39 40 41 42 43 44 45 46 47
; Octave 2 48 49 50 51 52 53 54 55 56 57 58 59
; Octave 3 60 61 62 63 64 65 66 67 68 69 70 71
; Octave 4 72 73 74 75 76 77 78 79 80 81 82 83
; Octave 5 84 85 86 87 88 89 90 91 92 93 94 95
; Octave 6 96 97 98 99 100 101 102 103 104 105 106 107
; Octave 7 108 109 110 111 112 113 114 115 116 117 118 119
; Octave 8 120 121 122 123 124 125 126 127
;
; Vélocité avec laquelle la touche ( Note ) a été enfoncée ( entre 0 et 127 ) ou relâchée
;
;***********************************************************************************************
Global m_hMidiOut.l ; handle du périphérique de sortie MIDI
Global m_MIDIOpen.b ; 1 = périphérique de sortie MIDI ouvert 0 = non ouvert
Dim NomInstrument.s(127)
NomInstrument(0) = "Piano à queue"
NomInstrument(1) = "Piano"
NomInstrument(2) = "Electric grand piano"
NomInstrument(3) = "Honky-Tonk"
NomInstrument(4) = "Electric Piano 1"
NomInstrument(5) = "Electric Piano 2"
NomInstrument(6) = "Harpsichord"
NomInstrument(7) = "Clavinet"
NomInstrument(8) = "Celesta"
NomInstrument(9) = "Glockenspiel"
NomInstrument(10) = "Music Box"
NomInstrument(11) = "Vibraphone"
NomInstrument(12) = "Marimba"
NomInstrument(13) = "Xylophone"
NomInstrument(14) = "Tubular Bells"
NomInstrument(15) = "Dulcimer"
NomInstrument(16) = "Drawbar Organ"
NomInstrument(17) = "Percussive Organ"
NomInstrument(18) = "Rock Organ"
NomInstrument(19) = "Chuch Organ"
NomInstrument(20) = "Reed Organ"
NomInstrument(21) = "Accordion"
NomInstrument(22) = "Harmonica"
NomInstrument(23) = "Tango Accordion"
NomInstrument(24) = "Acoustic Guitar (Nylon)"
NomInstrument(25) = "Acoustic Guitar (Acier)"
NomInstrument(26) = "Electric Guitar"
NomInstrument(27) = "Electric Guitar (Clean)"
NomInstrument(28) = "Electric Guitar (Muted)"
NomInstrument(29) = "Overdriven Guitar"
NomInstrument(30) = "Distortion Guitar"
NomInstrument(31) = "Guitar harmonics"
NomInstrument(32) = "Acoustic Bass"
NomInstrument(33) = "Electric Bass"
NomInstrument(34) = "Electric Bass (Finger)"
NomInstrument(35) = "Fretless Bass"
NomInstrument(36) = "Slap Bass 1"
NomInstrument(37) = "Slap Bass 2"
NomInstrument(38) = "Synth Bass 1"
NomInstrument(39) = "Synth Bass 2"
NomInstrument(40) = "Violon"
NomInstrument(41) = "Viola"
NomInstrument(42) = "Cello"
NomInstrument(43) = "Contrebass"
NomInstrument(44) = "Tremolo Strings"
NomInstrument(45) = "Pizzicato Strings"
NomInstrument(46) = "Orchestral Harp"
NomInstrument(47) = "Timpani"
NomInstrument(48) = "String Ensemble 1"
NomInstrument(49) = "String Ensemble 2"
NomInstrument(50) = "SynthString 1"
NomInstrument(51) = "SynthString 2"
NomInstrument(52) = "Choir Aahs"
NomInstrument(53) = "Voice Oohs"
NomInstrument(54) = "Synth Voice"
NomInstrument(55) = "Orchestra Hit"
NomInstrument(56) = "Trumpet"
NomInstrument(57) = "Trombone"
NomInstrument(58) = "Tuba"
NomInstrument(59) = "Muted Trumpet"
NomInstrument(60) = "French Horn"
NomInstrument(61) = "Brass Section"
NomInstrument(62) = "SynthBass 1"
NomInstrument(63) = "SynthBass 2"
NomInstrument(64) = "Soprano Sax"
NomInstrument(65) = "Alto Sax"
NomInstrument(66) = "Tenor Sax"
NomInstrument(67) = "Bartone Sax"
NomInstrument(68) = "Oboe"
NomInstrument(69) = "English Horn"
NomInstrument(70) = "Bassoon"
NomInstrument(71) = "Clarinet"
NomInstrument(72) = "Piccolo"
NomInstrument(73) = "Flute"
NomInstrument(74) = "Recorder"
NomInstrument(75) = "Pan Flute"
NomInstrument(76) = "Blown Bottle"
NomInstrument(77) = "Shakuhachi"
NomInstrument(78) = "Whistle"
NomInstrument(79) = "Ocarina"
NomInstrument(80) = "Square"
NomInstrument(81) = "Sawtooth"
NomInstrument(82) = "Calliop"
NomInstrument(83) = "Chiff"
NomInstrument(84) = "Charang"
NomInstrument(85) = "Voice"
NomInstrument(86) = "Fifths"
NomInstrument(87) = "Bass + Lead"
NomInstrument(88) = "New Age"
NomInstrument(89) = "Warm"
NomInstrument(90) = "Polysynth"
NomInstrument(91) = "Choir"
NomInstrument(92) = "Bowed"
NomInstrument(93) = "Metallic"
NomInstrument(94) = "Halo"
NomInstrument(95) = "Sweep"
NomInstrument(96) = "Rain"
NomInstrument(97) = "Soundtrack"
NomInstrument(98) = "Crystal"
NomInstrument(99) = "Atmosphere"
NomInstrument(100) = "Brightness"
NomInstrument(101) = "Goblins"
NomInstrument(102) = "Echoes"
NomInstrument(103) = "Sci-Fi"
NomInstrument(104) = "Sitar Ethnik"
NomInstrument(105) = "Banjo"
NomInstrument(106) = "Shamisen"
NomInstrument(107) = "Koto"
NomInstrument(108) = "Kalimba"
NomInstrument(109) = "Bag Pipe"
NomInstrument(110) = "Fiddle"
NomInstrument(111) = "Shanai"
NomInstrument(112) = "Tinkle Bell"
NomInstrument(113) = "Agogo"
NomInstrument(114) = "Steel Drums"
NomInstrument(115) = "Woodblock"
NomInstrument(116) = "Taiko Drum"
NomInstrument(117) = "Melodic Tom"
NomInstrument(118) = "Synth Drum"
NomInstrument(119) = "Reverse Cymbal"
NomInstrument(120) = "Guitar Fret. Noise"
NomInstrument(121) = "Breath Noise"
NomInstrument(122) = "Seashore"
NomInstrument(123) = "Bird Tweet"
NomInstrument(124) = "Telephone Ring"
NomInstrument(125) = "Helicopter"
NomInstrument(126) = "Applause"
NomInstrument(127) = "Gun Shot"
;-----------------------------------------------------------------------------------------------------------
Procedure SendMIDIMessage(nStatus.l,nCanal.l,nData1.l,nData2.l)
dwFlags.l = nStatus | nCanal | (nData1 << 8) | (nData2 << 16)
temp.l = midiOutShortMsg_(m_hMidiOut,dwFlags);
If temp<>0
MessageRequester("Problème", "Erreur dans l'envoi du message MIDI",0)
EndIf
EndProcedure
;-----------------------------------------------------------------------------------------------------------
Procedure MIDIOpen()
If m_MIDIOpen = 0
If midiOutOpen_(@m_hMidiOut,MIDIMAPPER,0,0,0) <> 0
MessageRequester("Problème", "Impossible d'ouvrir le périphérique MIDI",0)
Else
SendMIDIMessage($c0,0,0,0)
m_MIDIOpen = 1
EndIf
EndIf
EndProcedure
;-----------------------------------------------------------------------------------------------------------
Procedure PlayNoteMIDI(Canal.b,Note.b,VelociteDown.b,VelociteUp.b)
If m_MIDIOpen = 0
MIDIOpen()
EndIf
If m_MIDIOpen = 1
SendMIDIMessage($80 | Canal,0,Note,VelociteDown)
SendMIDIMessage($90 | Canal,0,Note,VelociteUp)
EndIf
EndProcedure
;-----------------------------------------------------------------------------------------------------------
Procedure ChargeInstrument(Canal.b,Instrument.b)
If m_MIDIOpen = 0
MIDIOpen()
EndIf
If m_MIDIOpen = 1
SendMIDIMessage($c0 | Canal,0,Instrument,0)
EndIf
EndProcedure
;-----------------------------------------------------------------------------------------------------------
; Et voici un exemple
ChargeInstrument(0,0)
ChargeInstrument(1,55)
For t.l = 1 To 100
PlayNoteMIDI(0,Random(60)+50,127,127)
PlayNoteMIDI(1,Random(60)+50,127,127)
Delay(300)
Next