mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-07 16:07:45 +02:00
2021-08-19 Fred Gleason <fredg@paravelsystems.com>
* Refactored the JACK driver in caed(8) to use virtual inheritance. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
8888e4cc82
commit
4d73f9bccc
@ -22310,3 +22310,5 @@
|
||||
* Disabled ALSA driver support in caed(8).
|
||||
2021-08-18 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Refactored the ALSA driver in caed(8) to use virtual inheritance.
|
||||
2021-08-19 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Refactored the JACK driver in caed(8) to use virtual inheritance.
|
||||
|
@ -31,17 +31,18 @@ sbin_PROGRAMS = caed
|
||||
|
||||
dist_caed_SOURCES = alsadriver.cpp alsadriver.h\
|
||||
cae.cpp cae.h\
|
||||
cae_jack.cpp\
|
||||
cae_server.cpp cae_server.h\
|
||||
caedriver.cpp caedriver.h\
|
||||
caedriverfactory.cpp caedriverfactory.h\
|
||||
hpidriver.cpp hpidriver.h
|
||||
hpidriver.cpp hpidriver.h\
|
||||
jackdriver.cpp jackdriver.h
|
||||
|
||||
nodist_caed_SOURCES = moc_alsadriver.cpp\
|
||||
moc_cae.cpp\
|
||||
moc_cae_server.cpp\
|
||||
moc_caedriver.cpp\
|
||||
moc_hpidriver.cpp
|
||||
moc_hpidriver.cpp\
|
||||
moc_jackdriver.cpp
|
||||
|
||||
caed_LDADD = @LIB_RDLIBS@\
|
||||
@LIBALSA@\
|
||||
|
@ -718,11 +718,6 @@ bool AlsaDriver::initialize(unsigned *next_cardnum)
|
||||
}
|
||||
|
||||
|
||||
void AlsaDriver::updateMeters()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool AlsaDriver::loadPlayback(int card,QString wavename,int *stream)
|
||||
{
|
||||
#ifdef ALSA
|
||||
|
@ -53,7 +53,6 @@ class AlsaDriver : public CaeDriver
|
||||
~AlsaDriver();
|
||||
QString version() const;
|
||||
bool initialize(unsigned *next_cardnum);
|
||||
void updateMeters();
|
||||
bool loadPlayback(int card,QString wavename,int *stream);
|
||||
bool unloadPlayback(int card,int stream);
|
||||
bool playbackPosition(int card,int stream,unsigned pos);
|
||||
|
16
cae/cae.cpp
16
cae/cae.cpp
@ -49,7 +49,6 @@
|
||||
#include "cae.h"
|
||||
|
||||
volatile bool exiting=false;
|
||||
//RDConfig *rd_config;
|
||||
#ifdef JACK
|
||||
extern jack_client_t *jack_client;
|
||||
#endif // JACK
|
||||
@ -281,6 +280,21 @@ MainObject::MainObject(QObject *parent)
|
||||
delete dvr;
|
||||
}
|
||||
|
||||
//
|
||||
// JACK Devices
|
||||
//
|
||||
dvr=CaeDriverFactory(RDStation::Jack,this);
|
||||
if(dvr->initialize(&next_card)) {
|
||||
connect(dvr,SIGNAL(playStateChanged(int,int,int)),
|
||||
this,SLOT(statePlayUpdate(int,int,int)));
|
||||
connect(dvr,SIGNAL(recordStateChanged(int,int,int)),
|
||||
this,SLOT(stateRecordUpdate(int,int,int)));
|
||||
d_drivers.push_back(dvr);
|
||||
}
|
||||
else {
|
||||
delete dvr;
|
||||
}
|
||||
|
||||
//
|
||||
// Probe Capabilities
|
||||
//
|
||||
|
@ -235,6 +235,7 @@ class MainObject : public QObject
|
||||
#endif // HPI
|
||||
*/
|
||||
|
||||
/*
|
||||
//
|
||||
// JACK Driver
|
||||
//
|
||||
@ -313,7 +314,7 @@ class MainObject : public QObject
|
||||
int jack_clock_phase;
|
||||
unsigned jack_samples_recorded[RD_MAX_STREAMS];
|
||||
#endif // JACK
|
||||
|
||||
*/
|
||||
//
|
||||
// ALSA Driver
|
||||
//
|
||||
|
@ -48,7 +48,6 @@ class CaeDriver : public QObject
|
||||
bool hasCard(int cardnum) const;
|
||||
virtual QString version() const=0;
|
||||
virtual bool initialize(unsigned *next_cardnum)=0;;
|
||||
virtual void updateMeters()=0;
|
||||
|
||||
public:
|
||||
virtual bool loadPlayback(int card,QString wavename,int *stream)=0;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "alsadriver.h"
|
||||
#include "caedriverfactory.h"
|
||||
#include "hpidriver.h"
|
||||
#include "jackdriver.h"
|
||||
|
||||
CaeDriver *CaeDriverFactory(RDStation::AudioDriver dvr,QObject *parent)
|
||||
{
|
||||
@ -32,6 +33,7 @@ CaeDriver *CaeDriverFactory(RDStation::AudioDriver dvr,QObject *parent)
|
||||
break;
|
||||
|
||||
case RDStation::Jack:
|
||||
ret=new JackDriver(parent);
|
||||
break;
|
||||
|
||||
case RDStation::Alsa:
|
||||
|
@ -91,14 +91,6 @@ bool HpiDriver::initialize(unsigned *next_cardnum)
|
||||
}
|
||||
|
||||
|
||||
void HpiDriver::updateMeters()
|
||||
{
|
||||
#ifdef HPI
|
||||
|
||||
#endif // HPI
|
||||
}
|
||||
|
||||
|
||||
bool HpiDriver::loadPlayback(int card,QString wavename,int *stream)
|
||||
{
|
||||
#ifdef HPI
|
||||
|
1736
cae/jackdriver.cpp
Normal file
1736
cae/jackdriver.cpp
Normal file
File diff suppressed because it is too large
Load Diff
127
cae/jackdriver.h
Normal file
127
cae/jackdriver.h
Normal file
@ -0,0 +1,127 @@
|
||||
// jackdriver.h
|
||||
//
|
||||
// caed(8) driver for Advanced Linux Audio Architecture devices
|
||||
//
|
||||
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// 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 JACKDRIVER_H
|
||||
#define JACKDRIVER_H
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
#include <soundtouch/SoundTouch.h>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rdmeteraverage.h>
|
||||
#include <rdwavefile.h>
|
||||
|
||||
#include "caedriver.h"
|
||||
|
||||
#ifdef JACK
|
||||
#include <jack/jack.h>
|
||||
#endif // JACK
|
||||
|
||||
class JackDriver : public CaeDriver
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
JackDriver(QObject *parent=0);
|
||||
~JackDriver();
|
||||
QString version() const;
|
||||
bool initialize(unsigned *next_cardnum);
|
||||
bool loadPlayback(int card,QString wavename,int *stream);
|
||||
bool unloadPlayback(int card,int stream);
|
||||
bool playbackPosition(int card,int stream,unsigned pos);
|
||||
bool play(int card,int stream,int length,int speed,bool pitch,
|
||||
bool rates);
|
||||
bool stopPlayback(int card,int stream);
|
||||
bool timescaleSupported(int card);
|
||||
bool loadRecord(int card,int port,int coding,int chans,int samprate,
|
||||
int bitrate,QString wavename);
|
||||
bool unloadRecord(int card,int port,unsigned *len);
|
||||
bool record(int card,int port,int length,int thres);
|
||||
bool stopRecord(int card,int port);
|
||||
bool setClockSource(int card,int src);
|
||||
bool setInputVolume(int card,int stream,int level);
|
||||
bool setOutputVolume(int card,int stream,int port,int level);
|
||||
bool fadeOutputVolume(int card,int stream,int port,int level,
|
||||
int length);
|
||||
bool setInputLevel(int card,int port,int level);
|
||||
bool setOutputLevel(int card,int port,int level);
|
||||
bool setInputMode(int card,int stream,int mode);
|
||||
bool setOutputMode(int card,int stream,int mode);
|
||||
bool setInputVoxLevel(int card,int stream,int level);
|
||||
bool setInputType(int card,int port,int type);
|
||||
bool getInputStatus(int card,int port);
|
||||
bool getInputMeters(int card,int port,short levels[2]);
|
||||
bool getOutputMeters(int card,int port,short levels[2]);
|
||||
bool getStreamOutputMeters(int card,int stream,short levels[2]);
|
||||
bool setPassthroughLevel(int card,int in_port,int out_port,
|
||||
int level);
|
||||
void getOutputPosition(int card,unsigned *pos);
|
||||
|
||||
public slots:
|
||||
void processBuffers();
|
||||
|
||||
private slots:
|
||||
void stopTimerData(int stream);
|
||||
void fadeTimerData(int stream);
|
||||
void recordTimerData(int stream);
|
||||
void clientStartData();
|
||||
|
||||
private:
|
||||
int GetJackOutputStream();
|
||||
void FreeJackOutputStream(int stream);
|
||||
void EmptyJackInputStream(int stream,bool done);
|
||||
#ifdef JACK
|
||||
void WriteJackBuffer(int stream,jack_default_audio_sample_t *buffer,
|
||||
unsigned len,bool done);
|
||||
#endif // JACK
|
||||
void FillJackOutputStream(int stream);
|
||||
void JackClock();
|
||||
void JackSessionSetup();
|
||||
bool jack_connected;
|
||||
bool jack_activated;
|
||||
#ifdef JACK
|
||||
int jack_card;
|
||||
QList<QProcess *> jack_clients;
|
||||
RDWaveFile *jack_record_wave[RD_MAX_STREAMS];
|
||||
RDWaveFile *jack_play_wave[RD_MAX_STREAMS];
|
||||
short *jack_wave_buffer;
|
||||
int *jack_wave32_buffer;
|
||||
uint8_t *jack_wave24_buffer;
|
||||
jack_default_audio_sample_t *jack_sample_buffer;
|
||||
soundtouch::SoundTouch *jack_st_conv[RD_MAX_STREAMS];
|
||||
short jack_input_volume_db[RD_MAX_STREAMS];
|
||||
short jack_output_volume_db[RD_MAX_PORTS][RD_MAX_STREAMS];
|
||||
short jack_passthrough_volume_db[RD_MAX_PORTS][RD_MAX_PORTS];
|
||||
short jack_fade_volume_db[RD_MAX_STREAMS];
|
||||
short jack_fade_increment[RD_MAX_STREAMS];
|
||||
int jack_fade_port[RD_MAX_STREAMS];
|
||||
bool jack_fade_up[RD_MAX_STREAMS];
|
||||
QTimer *jack_fade_timer[RD_MAX_STREAMS];
|
||||
QTimer *jack_stop_timer[RD_MAX_STREAMS];
|
||||
QTimer *jack_record_timer[RD_MAX_PORTS];
|
||||
QTimer *jack_client_start_timer;
|
||||
int jack_offset[RD_MAX_STREAMS];
|
||||
int jack_clock_phase;
|
||||
unsigned jack_samples_recorded[RD_MAX_STREAMS];
|
||||
#endif // JACK
|
||||
};
|
||||
|
||||
|
||||
#endif // JACKDRIVER_H
|
Loading…
x
Reference in New Issue
Block a user