Support for using jack midi input (#2038)
* Support jack midi input * If jack is used for audio then use the same connection for midi as well * Remove old FreeBSD adjustment for portaudio as multiple version support has been dropped. * Disable jack midi out port until it is functional
This commit is contained in:
committed by
Oskar Wallgren
parent
c9618961d6
commit
05ace7e348
@@ -37,9 +37,9 @@
|
||||
#include "AudioDevice.h"
|
||||
#include "AudioDeviceSetupWidget.h"
|
||||
|
||||
|
||||
class QLineEdit;
|
||||
class LcdSpinBox;
|
||||
class MidiJack;
|
||||
|
||||
|
||||
class AudioJack : public QObject, public AudioDevice
|
||||
@@ -49,6 +49,12 @@ public:
|
||||
AudioJack( bool & _success_ful, Mixer* mixer );
|
||||
virtual ~AudioJack();
|
||||
|
||||
// this is to allow the jack midi connection to use the same jack client connection
|
||||
// the jack callback is handled here, we call the midi client so that it can read
|
||||
// it's midi data during the callback
|
||||
AudioJack * addMidiClient(MidiJack *midiClient);
|
||||
jack_client_t * jackClient() {return m_client;};
|
||||
|
||||
inline static QString name()
|
||||
{
|
||||
return QT_TRANSLATE_NOOP( "setupWidget",
|
||||
@@ -98,6 +104,7 @@ private:
|
||||
bool m_active;
|
||||
bool m_stopped;
|
||||
|
||||
MidiJack *m_midiClient;
|
||||
QVector<jack_port_t *> m_outputPorts;
|
||||
jack_default_audio_sample_t * * m_tempOutBufs;
|
||||
surroundSampleFrame * m_outBuf;
|
||||
|
||||
@@ -45,11 +45,7 @@ public:
|
||||
|
||||
#ifdef LMMS_HAVE_PORTAUDIO
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <portaudio2/portaudio.h>
|
||||
#else
|
||||
#include <portaudio.h>
|
||||
#endif
|
||||
|
||||
#include <QtCore/QSemaphore>
|
||||
|
||||
|
||||
95
include/MidiJack.h
Normal file
95
include/MidiJack.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* MidiJack.h - MIDI client for Jack
|
||||
*
|
||||
* Copyright (c) 2015 Shane Ambler <develop/at/shaneware.biz>
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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 (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MIDIJACK_H
|
||||
#define MIDIJACK_H
|
||||
|
||||
#include "lmmsconfig.h"
|
||||
|
||||
#ifdef LMMS_HAVE_JACK
|
||||
#include <jack/jack.h>
|
||||
#include <jack/midiport.h>
|
||||
|
||||
#include <QtCore/QThread>
|
||||
#include <QMutex>
|
||||
#include <QtCore/QFile>
|
||||
|
||||
#include "MidiClient.h"
|
||||
#include "AudioJack.h"
|
||||
|
||||
#define JACK_MIDI_BUFFER_MAX 64 /* events */
|
||||
|
||||
class QLineEdit;
|
||||
|
||||
class MidiJack : public MidiClientRaw, public QThread
|
||||
{
|
||||
public:
|
||||
MidiJack();
|
||||
virtual ~MidiJack();
|
||||
|
||||
jack_client_t* jackClient();
|
||||
|
||||
static QString probeDevice();
|
||||
|
||||
inline static QString name()
|
||||
{
|
||||
return( QT_TRANSLATE_NOOP( "MidiSetupWidget",
|
||||
"Jack-MIDI" ) );
|
||||
}
|
||||
|
||||
void JackMidiWrite(jack_nframes_t nframes);
|
||||
void JackMidiRead(jack_nframes_t nframes);
|
||||
|
||||
|
||||
inline static QString configSection()
|
||||
{
|
||||
return "MidiJack";
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void sendByte( const unsigned char c );
|
||||
virtual void run();
|
||||
|
||||
|
||||
private:
|
||||
AudioJack *m_jackAudio;
|
||||
jack_client_t *m_jackClient;
|
||||
jack_port_t *m_input_port;
|
||||
jack_port_t *m_output_port;
|
||||
uint8_t m_jack_buffer[JACK_MIDI_BUFFER_MAX * 4];
|
||||
|
||||
void JackMidiOutEvent(uint8_t *buf, uint8_t len);
|
||||
void lock();
|
||||
void unlock();
|
||||
|
||||
void getPortInfo( const QString& sPortName, int& nClient, int& nPort );
|
||||
|
||||
volatile bool m_quit;
|
||||
|
||||
};
|
||||
|
||||
#endif // LMMS_HAVE_JACK
|
||||
|
||||
#endif // MIDIJACK_H
|
||||
Reference in New Issue
Block a user