2003-03-18 01:24:09 +03:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
#ifndef _MIDI_H
|
|
|
|
#define _MIDI_H
|
|
|
|
|
|
|
|
#include <BeBuild.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <MidiDefs.h>
|
|
|
|
#include <OS.h>
|
|
|
|
|
|
|
|
class BList;
|
2003-03-18 01:24:09 +03:00
|
|
|
class BMidiLocalProducer;
|
|
|
|
class BMidiLocalConsumer;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
class BMidi
|
|
|
|
{
|
2002-07-09 16:24:59 +04:00
|
|
|
public:
|
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
BMidi();
|
|
|
|
virtual ~BMidi();
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void NoteOff(
|
|
|
|
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void NoteOn(
|
|
|
|
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void KeyPressure(
|
|
|
|
uchar channel, uchar note, uchar pressure, uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void ControlChange(
|
|
|
|
uchar channel, uchar controlNumber, uchar controlValue,
|
|
|
|
uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void ProgramChange(
|
|
|
|
uchar channel, uchar programNumber, uint32 time = B_NOW);
|
|
|
|
|
|
|
|
virtual void ChannelPressure(
|
|
|
|
uchar channel, uchar pressure, uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void PitchBend(
|
|
|
|
uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void SystemExclusive(
|
|
|
|
void* data, size_t length, uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void SystemCommon(
|
|
|
|
uchar status, uchar data1, uchar data2, uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void SystemRealTime(uchar status, uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void TempoChange(int32 beatsPerMinute, uint32 time = B_NOW);
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void AllNotesOff(bool justChannel = true, uint32 time = B_NOW);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual status_t Start();
|
|
|
|
virtual void Stop();
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
bool IsRunning() const;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void Connect(BMidi* toObject);
|
|
|
|
void Disconnect(BMidi* fromObject);
|
|
|
|
bool IsConnected(BMidi* toObject) const;
|
|
|
|
BList* Connections() const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SnoozeUntil(uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
protected:
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SprayNoteOff(
|
|
|
|
uchar channel, uchar note, uchar velocity, uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SprayNoteOn(
|
|
|
|
uchar channel, uchar note, uchar velocity, uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SprayKeyPressure(
|
|
|
|
uchar channel, uchar note, uchar pressure, uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SprayControlChange(
|
|
|
|
uchar channel, uchar controlNumber, uchar controlValue,
|
|
|
|
uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SprayProgramChange(
|
|
|
|
uchar channel, uchar programNumber, uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SprayChannelPressure(
|
|
|
|
uchar channel, uchar pressure, uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SprayPitchBend(
|
|
|
|
uchar channel, uchar lsb, uchar msb, uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SpraySystemExclusive(
|
|
|
|
void* data, size_t length, uint32 time = B_NOW) const;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SpraySystemCommon(
|
|
|
|
uchar status, uchar data1, uchar data2, uint32 time) const;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SpraySystemRealTime(uchar status, uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
void SprayTempoChange(int32 beatsPerMinute, uint32 time) const;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
bool KeepRunning();
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
private:
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
friend status_t _run_thread(void* data);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void _ReservedMidi1();
|
|
|
|
virtual void _ReservedMidi2();
|
|
|
|
virtual void _ReservedMidi3();
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
virtual void Run();
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2006-06-19 17:24:04 +04:00
|
|
|
BMidiLocalProducer* fProducer;
|
|
|
|
BMidiLocalConsumer* fConsumer;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-19 17:24:04 +04:00
|
|
|
BList* fConnections;
|
|
|
|
volatile thread_id fThreadId;
|
|
|
|
volatile bool fIsRunning;
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
uint32 _reserved2[5];
|
|
|
|
};
|
2002-11-21 22:23:22 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
#endif // _MIDI_H
|