1 /* 2 * Copyright 2006, Haiku. 3 * 4 * Copyright (c) 2003 Matthijs Hollemans 5 * Copyright (c) 2002 Jerome Leveque 6 * Distributed under the terms of the MIT License. 7 * 8 * Authors: 9 * Matthijs Hollemans 10 * Jérôme Leveque 11 */ 12 13 #ifndef _MIDI_GLUE_H 14 #define _MIDI_GLUE_H 15 16 #include <MidiPort.h> 17 #include <MidiConsumer.h> 18 19 #define MAKE_TIME(t) (t / (bigtime_t)1000) 20 #define MAKE_BIGTIME(t) (t * (bigtime_t)1000) 21 22 namespace BPrivate { 23 24 class BMidiGlue: public BMidiLocalConsumer { 25 public: 26 27 BMidiGlue(BMidi* midiObject, const char* name = NULL); 28 29 virtual void NoteOff( 30 uchar channel, uchar note, uchar velocity, bigtime_t time); 31 32 virtual void NoteOn( 33 uchar channel, uchar note, uchar velocity, bigtime_t time); 34 35 virtual void KeyPressure( 36 uchar channel, uchar note, uchar pressure, bigtime_t time); 37 38 virtual void ControlChange( 39 uchar channel, uchar controlNumber, uchar controlValue, 40 bigtime_t time); 41 42 virtual void ProgramChange( 43 uchar channel, uchar programNumber, bigtime_t time); 44 45 virtual void ChannelPressure( 46 uchar channel, uchar pressure, bigtime_t time); 47 48 virtual void PitchBend( 49 uchar channel, uchar lsb, uchar msb, bigtime_t time); 50 51 virtual void SystemExclusive( 52 void* data, size_t length, bigtime_t time); 53 54 virtual void SystemCommon( 55 uchar status, uchar data1, uchar data2, bigtime_t time); 56 57 virtual void SystemRealTime(uchar status, bigtime_t time); 58 59 virtual void TempoChange(int32 beatsPerMinute, bigtime_t time); 60 61 private: 62 BMidi* fMidiObject; 63 }; 64 65 66 class BMidiPortGlue: public BMidiLocalConsumer { 67 public: 68 69 BMidiPortGlue(BMidiPort* midiObject, const char* name = NULL); 70 71 virtual void NoteOff( 72 uchar channel, uchar note, uchar velocity, bigtime_t time); 73 74 virtual void NoteOn( 75 uchar channel, uchar note, uchar velocity, bigtime_t time); 76 77 virtual void KeyPressure( 78 uchar channel, uchar note, uchar pressure, bigtime_t time); 79 80 virtual void ControlChange( 81 uchar channel, uchar controlNumber, uchar controlValue, 82 bigtime_t time); 83 84 virtual void ProgramChange( 85 uchar channel, uchar programNumber, bigtime_t time); 86 87 virtual void ChannelPressure( 88 uchar channel, uchar pressure, bigtime_t time); 89 90 virtual void PitchBend( 91 uchar channel, uchar lsb, uchar msb, bigtime_t time); 92 93 virtual void SystemExclusive( 94 void* data, size_t length, bigtime_t time); 95 96 virtual void SystemCommon( 97 uchar status, uchar data1, uchar data2, bigtime_t time); 98 99 virtual void SystemRealTime(uchar status, bigtime_t time); 100 101 virtual void TempoChange(int32 beatsPerMinute, bigtime_t time); 102 103 private: 104 BMidiPort* fMidiObject; 105 }; 106 107 } // namespace BPrivate 108 109 #endif // _MIDI_GLUE_H 110