2002-10-26 22:51:58 +04:00
|
|
|
|
|
|
|
#ifndef _MIDI_PORT_H
|
|
|
|
#define _MIDI_PORT_H
|
|
|
|
|
|
|
|
#include <Midi.h>
|
|
|
|
|
2006-06-16 03:41:26 +04:00
|
|
|
class BMidiConsumer;
|
|
|
|
class BMidiProducer;
|
|
|
|
|
2004-05-13 14:37:14 +04:00
|
|
|
namespace BPrivate { class BMidiPortGlue; }
|
|
|
|
|
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;
|
|
|
|
|
2004-05-13 14:37:14 +04:00
|
|
|
friend class BPrivate::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
|
|
|
|
2006-06-19 17:24:04 +04:00
|
|
|
BMidiLocalProducer* fLocalSource;
|
|
|
|
BMidiLocalConsumer* fLocalSink;
|
|
|
|
BMidiProducer* fRemoteSource;
|
|
|
|
BMidiConsumer* fRemoteSink;
|
2002-10-26 22:51:58 +04:00
|
|
|
|
2006-06-19 17:24:04 +04:00
|
|
|
char* fPortName;
|
|
|
|
status_t fStatus;
|
|
|
|
BList* fDevices;
|
2003-03-18 01:24:09 +03:00
|
|
|
|
|
|
|
uint32 _reserved[1];
|
2002-10-26 22:51:58 +04:00
|
|
|
};
|
|
|
|
|
2002-11-01 19:11:03 +03:00
|
|
|
#endif // _MIDI_PORT_H
|