1/* 2 * Copyright 2003-2009, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Matthijs Hollemans 7 * Jerome Leveque 8 * Philippe Houdoin 9 */ 10#ifndef PORT_DRIVERS_H 11#define PORT_DRIVERS_H 12 13 14#include <MidiProducer.h> 15#include <MidiConsumer.h> 16 17class MidiPortConsumer : public BMidiLocalConsumer { 18public: 19 MidiPortConsumer(int fd, const char* path); 20 21 void Data(uchar* data, size_t length, bool atomic, bigtime_t time); 22 23private: 24 int fFileDescriptor; 25}; 26 27 28class MidiPortProducer : public BMidiLocalProducer { 29public: 30 MidiPortProducer(int fd, const char* path = NULL); 31 virtual ~MidiPortProducer(void); 32 33 int32 GetData(void); 34 35private: 36 static int32 _ReaderThread(void* data); 37 38 int fFileDescriptor; 39 volatile bool fKeepRunning; 40 thread_id fReaderThread; 41}; 42 43#endif // PORT_DRIVERS_H 44