2002-10-26 22:51:58 +04:00
|
|
|
|
|
|
|
#ifndef _MIDI_PORT_H
|
|
|
|
#define _MIDI_PORT_H
|
|
|
|
|
|
|
|
#include <Midi.h>
|
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
class BMidiPort : public BMidi
|
|
|
|
{
|
2002-10-26 22:51:58 +04:00
|
|
|
public:
|
2003-03-18 01:24:09 +03:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
BMidiPort(const char* name = NULL);
|
|
|
|
~BMidiPort();
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
status_t InitCheck() const;
|
|
|
|
status_t Open(const char* name);
|
|
|
|
void Close();
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
const char* PortName() const;
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void NoteOff(
|
|
|
|
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void NoteOn(
|
|
|
|
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void KeyPressure(
|
|
|
|
uchar channel, uchar note, uchar pressure, uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void ControlChange(
|
|
|
|
uchar channel, uchar controlNumber, uchar controlValue,
|
|
|
|
uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void ProgramChange(
|
|
|
|
uchar channel, uchar programNumber, uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void ChannelPressure(
|
|
|
|
uchar channel, uchar pressure, uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void PitchBend(
|
|
|
|
uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void SystemExclusive(
|
2003-03-18 01:24:09 +03:00
|
|
|
void* data, size_t length, uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void SystemCommon(
|
|
|
|
uchar status, uchar data0, uchar data2, uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void SystemRealTime(uchar status, uint32 time = B_NOW);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual status_t Start();
|
|
|
|
virtual void Stop();
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
int32 CountDevices();
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
status_t GetDeviceName(
|
|
|
|
int32 n, char* name, size_t bufSize = B_OS_NAME_LENGTH);
|
2002-10-26 22:51:58 +04:00
|
|
|
|
|
|
|
private:
|
2003-03-18 01:24:09 +03:00
|
|
|
|
|
|
|
typedef BMidi super;
|
|
|
|
|
|
|
|
friend class BMidiPortGlue;
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void _ReservedMidiPort1();
|
|
|
|
virtual void _ReservedMidiPort2();
|
|
|
|
virtual void _ReservedMidiPort3();
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
virtual void Run();
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
void ScanDevices();
|
2003-03-18 01:24:09 +03:00
|
|
|
void EmptyDeviceList();
|
2002-11-01 19:11:03 +03:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
BMidiLocalProducer* localSource;
|
|
|
|
BMidiLocalConsumer* localSink;
|
|
|
|
BMidiProducer* remoteSource;
|
|
|
|
BMidiConsumer* remoteSink;
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2003-03-18 01:24:09 +03:00
|
|
|
char* portName;
|
|
|
|
status_t status;
|
|
|
|
BList* devices;
|
|
|
|
|
|
|
|
uint32 _reserved[1];
|
2002-10-26 22:51:58 +04:00
|
|
|
};
|
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
#endif // _MIDI_PORT_H
|