MuseScore/mscore/jackaudio.h
2013-05-13 19:43:59 +02:00

75 lines
2.3 KiB
C++

//=============================================================================
// MuseScore
// Linux Music Score Editor
// $Id: jackaudio.h 4147 2011-04-07 14:39:44Z wschweer $
//
// Copyright (C) 2002-2009 Werner Schweer and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef __JACKAUDIO_H__
#define __JACKAUDIO_H__
#include "config.h"
#include "driver.h"
#include <jack/jack.h>
namespace Ms {
class Synth;
class Seq;
class MidiDriver;
//---------------------------------------------------------
// JackAudio
//---------------------------------------------------------
class JackAudio : public Driver {
unsigned _segmentSize;
jack_client_t* client;
char _jackName[8];
QList<jack_port_t*> ports;
QList<jack_port_t*> midiOutputPorts;
QList<jack_port_t*> midiInputPorts;
static int processAudio(jack_nframes_t, void*);
public:
JackAudio(Seq*);
virtual ~JackAudio();
virtual bool init();
virtual QList<QString> inputPorts();
virtual bool start();
virtual bool stop();
int framePos() const;
void connect(void*, void*);
void disconnect(void* src, void* dst);
virtual bool isRealtime() const { return jack_is_realtime(client); }
virtual void startTransport();
virtual void stopTransport();
virtual int getState();
virtual int sampleRate() const { return jack_get_sample_rate(client); }
virtual void putEvent(const Event&, unsigned framePos);
virtual void midiRead();
virtual void registerPort(const QString& name, bool input, bool midi);
virtual void unregisterPort(int);
};
} // namespace Ms
#endif