mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-11 18:46:41 -04:00
Until now, Mixer not only was responsible for rendering audio buffers but also managed writing them to audio backend (through a FIFO) and handled various quality related parameters. All this functionality has been moved into the new AudioOutputContext class. It glues together AudioBackend (formerly called AudioDevice), global quality settings and the Mixer. The AudioOutputContext class creates a FifoWriter which calls Mixer::renderNextBuffer() and writes the output into the BufferFifo of the AudioOutputContext it belongs to. The BufferFifo is read by the according AudioBackend which belongs to the AudioOutputContext as well. The AudioOutputContext also handles resampling in case the AudioBackend wants the buffers in a different samplerate. During this rewrite the Mixer class and the according source files have been renamed from "mixer" to "Mixer". This results in small changes all over LMMS' code base.
127 lines
2.6 KiB
C++
127 lines
2.6 KiB
C++
/*
|
|
* AudioJack.h - support for JACK-transport
|
|
*
|
|
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
|
*
|
|
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
|
*
|
|
* 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 _AUDIO_JACK_H
|
|
#define _AUDIO_JACK_H
|
|
|
|
#include "lmmsconfig.h"
|
|
|
|
#ifdef LMMS_HAVE_JACK
|
|
#include <jack/jack.h>
|
|
#endif
|
|
|
|
#include <QtCore/QMap>
|
|
#include <QtCore/QSemaphore>
|
|
#include <QtCore/QVector>
|
|
|
|
#include "AudioBackend.h"
|
|
|
|
|
|
class QLineEdit;
|
|
class lcdSpinBox;
|
|
|
|
|
|
class AudioJack : public QObject, public AudioBackend
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
AudioJack( bool & _success_ful, AudioOutputContext * context );
|
|
virtual ~AudioJack();
|
|
|
|
inline static QString name()
|
|
{
|
|
return QT_TRANSLATE_NOOP( "setupWidget",
|
|
"JACK (JACK Audio Connection Kit)" );
|
|
}
|
|
|
|
|
|
class setupWidget : public AudioBackend::setupWidget
|
|
{
|
|
public:
|
|
setupWidget( QWidget * _parent );
|
|
virtual ~setupWidget();
|
|
|
|
virtual void saveSettings();
|
|
|
|
private:
|
|
QLineEdit * m_clientName;
|
|
lcdSpinBox * m_channels;
|
|
|
|
} ;
|
|
|
|
|
|
private slots:
|
|
void restartAfterZombified();
|
|
|
|
|
|
#ifdef LMMS_HAVE_JACK
|
|
private:
|
|
bool initJackClient();
|
|
|
|
virtual void startProcessing();
|
|
virtual void stopProcessing();
|
|
virtual void applyQualitySettings();
|
|
|
|
virtual void registerPort( AudioPort * _port );
|
|
virtual void unregisterPort( AudioPort * _port );
|
|
virtual void renamePort( AudioPort * _port );
|
|
|
|
int processCallback( jack_nframes_t _nframes, void * _udata );
|
|
|
|
static int staticProcessCallback( jack_nframes_t _nframes,
|
|
void * _udata );
|
|
static void shutdownCallback( void * _udata );
|
|
|
|
|
|
jack_client_t * m_client;
|
|
|
|
bool m_active;
|
|
bool m_stopped;
|
|
|
|
QSemaphore m_stopSemaphore;
|
|
|
|
QVector<jack_port_t *> m_outputPorts;
|
|
sampleFrameA * m_outBuf;
|
|
|
|
|
|
f_cnt_t m_framesDoneInCurBuf;
|
|
f_cnt_t m_framesToDoInCurBuf;
|
|
|
|
|
|
struct StereoPort
|
|
{
|
|
jack_port_t * ports[2];
|
|
} ;
|
|
|
|
typedef QMap<AudioPort *, StereoPort> JackPortMap;
|
|
JackPortMap m_portMap;
|
|
#endif
|
|
|
|
signals:
|
|
void zombified();
|
|
|
|
} ;
|
|
|
|
#endif
|