mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-31 16:09:35 +02:00
2021-08-20 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up code in 'cae/'. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
4d73f9bccc
commit
5a9f59ec62
@ -22312,3 +22312,5 @@
|
||||
* 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.
|
||||
2021-08-20 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Cleaned up code in 'cae/'.
|
||||
|
@ -33,7 +33,6 @@ dist_caed_SOURCES = alsadriver.cpp alsadriver.h\
|
||||
cae.cpp cae.h\
|
||||
cae_server.cpp cae_server.h\
|
||||
caedriver.cpp caedriver.h\
|
||||
caedriverfactory.cpp caedriverfactory.h\
|
||||
hpidriver.cpp hpidriver.h\
|
||||
jackdriver.cpp jackdriver.h
|
||||
|
||||
|
@ -649,7 +649,12 @@ AlsaDriver::~AlsaDriver()
|
||||
|
||||
QString AlsaDriver::version() const
|
||||
{
|
||||
#ifdef ALSA
|
||||
return
|
||||
QString().sprintf("%d.%d.%d",SND_LIB_MAJOR,SND_LIB_MINOR,SND_LIB_SUBMINOR);
|
||||
#else
|
||||
return QString();
|
||||
#endif // ALSA
|
||||
}
|
||||
|
||||
|
||||
@ -660,7 +665,7 @@ bool AlsaDriver::initialize(unsigned *next_cardnum)
|
||||
snd_pcm_t *pcm_capture_handle;
|
||||
snd_ctl_t *snd_ctl;
|
||||
snd_ctl_card_info_t *card_info=NULL;
|
||||
bool pcm_opened;
|
||||
bool pcm_opened=false;
|
||||
int card=0;
|
||||
|
||||
//
|
||||
@ -685,6 +690,9 @@ bool AlsaDriver::initialize(unsigned *next_cardnum)
|
||||
snd_pcm_close(pcm_capture_handle);
|
||||
}
|
||||
}
|
||||
if(!pcm_opened) {
|
||||
return card>0;
|
||||
}
|
||||
rda->station()->setCardDriver(*next_cardnum,RDStation::Alsa);
|
||||
if(snd_ctl_open(&snd_ctl,dev.toUtf8(),0)<0) {
|
||||
rda->syslog(LOG_INFO,
|
||||
@ -1310,7 +1318,6 @@ void AlsaDriver::processBuffers()
|
||||
alsa_stopping[i][j]=false;
|
||||
alsa_eof[i][j]=false;
|
||||
alsa_playing[i][j]=false;
|
||||
printf("stop card: %d stream: %d\n",i,j);
|
||||
statePlayUpdate(i,j,2);
|
||||
}
|
||||
if(alsa_playing[i][j]) {
|
||||
@ -1907,7 +1914,6 @@ void AlsaDriver::AlsaClock()
|
||||
alsa_stopping[i][j]=false;
|
||||
alsa_eof[i][j]=false;
|
||||
alsa_playing[i][j]=false;
|
||||
printf("stop card: %d stream: %d\n",i,j);
|
||||
statePlayUpdate(i,j,2);
|
||||
}
|
||||
if(alsa_playing[i][j]) {
|
||||
|
276
cae/cae.cpp
276
cae/cae.cpp
@ -45,8 +45,10 @@
|
||||
#include <rdsvc.h>
|
||||
#include <rdsystem.h>
|
||||
|
||||
#include "caedriverfactory.h"
|
||||
#include "alsadriver.h"
|
||||
#include "cae.h"
|
||||
#include "hpidriver.h"
|
||||
#include "jackdriver.h"
|
||||
|
||||
volatile bool exiting=false;
|
||||
#ifdef JACK
|
||||
@ -123,7 +125,6 @@ MainObject::MainObject(QObject *parent)
|
||||
next_play_handle=0;
|
||||
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
cae_driver[i]=RDStation::None;
|
||||
for(int j=0;j<RD_MAX_STREAMS;j++) {
|
||||
record_length[i][j]=0;
|
||||
record_threshold[i][j]=-10000;
|
||||
@ -240,60 +241,16 @@ MainObject::MainObject(QObject *parent)
|
||||
//
|
||||
InitProvisioning();
|
||||
|
||||
|
||||
//
|
||||
// Audio Driver Backend
|
||||
//
|
||||
system_sample_rate=rda->system()->sampleRate();
|
||||
// hpiInit(cae_station);
|
||||
// alsaInit(cae_station);
|
||||
// jackInit(cae_station);
|
||||
ClearDriverEntries(rda->station());
|
||||
ClearDriverEntries();
|
||||
unsigned next_card=0;
|
||||
|
||||
//
|
||||
// HPI Devices
|
||||
//
|
||||
CaeDriver *dvr=CaeDriverFactory(RDStation::Hpi,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;
|
||||
}
|
||||
|
||||
//
|
||||
// ALSA Devices
|
||||
//
|
||||
dvr=CaeDriverFactory(RDStation::Alsa,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;
|
||||
}
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
MakeDriver(&next_card,RDStation::Hpi);
|
||||
MakeDriver(&next_card,RDStation::Alsa);
|
||||
MakeDriver(&next_card,RDStation::Jack);
|
||||
|
||||
//
|
||||
// Probe Capabilities
|
||||
@ -329,28 +286,6 @@ MainObject::MainObject(QObject *parent)
|
||||
if(jack_client!=NULL) {
|
||||
pthread_getschedparam(jack_client_thread_id(jack_client),&sched_policy,
|
||||
&sched_params);
|
||||
/*
|
||||
#ifdef ALSA
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
if(cae_driver[i]==RDStation::Alsa) {
|
||||
if (!alsa_play_format[i].exiting) {
|
||||
int r = pthread_setschedparam(alsa_play_format[i].thread,sched_policy,
|
||||
&sched_params);
|
||||
if (r) {
|
||||
result = r;
|
||||
}
|
||||
}
|
||||
if (!alsa_capture_format[i].exiting) {
|
||||
int r = pthread_setschedparam(alsa_capture_format[i].thread,sched_policy,
|
||||
&sched_params);
|
||||
if (r) {
|
||||
result = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ALSA
|
||||
*/
|
||||
jack_running=true;
|
||||
}
|
||||
#endif // JACK
|
||||
@ -359,28 +294,6 @@ MainObject::MainObject(QObject *parent)
|
||||
sched_params.sched_priority=rda->config()->realtimePriority();
|
||||
}
|
||||
sched_policy=SCHED_FIFO;
|
||||
/*
|
||||
#ifdef ALSA
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
if(cae_driver[i]==RDStation::Alsa) {
|
||||
if (!alsa_play_format[i].exiting) {
|
||||
int r = pthread_setschedparam(alsa_play_format[i].thread,sched_policy,
|
||||
&sched_params);
|
||||
if (r) {
|
||||
result = r;
|
||||
}
|
||||
}
|
||||
if (!alsa_capture_format[i].exiting) {
|
||||
int r = pthread_setschedparam(alsa_capture_format[i].thread,sched_policy,
|
||||
&sched_params);
|
||||
if (r) {
|
||||
result = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ALSA
|
||||
*/
|
||||
if(sched_params.sched_priority>sched_get_priority_min(sched_policy)) {
|
||||
sched_params.sched_priority--;
|
||||
}
|
||||
@ -1165,11 +1078,6 @@ void MainObject::updateMeters()
|
||||
unsigned positions[RD_MAX_STREAMS];
|
||||
|
||||
if(exiting) {
|
||||
/*
|
||||
jackFree();
|
||||
alsaFree();
|
||||
hpiFree();
|
||||
*/
|
||||
for(int i=0;i<d_drivers.size();i++) {
|
||||
delete d_drivers.at(i);
|
||||
}
|
||||
@ -1212,85 +1120,6 @@ void MainObject::updateMeters()
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
switch(cae_driver[i]) {
|
||||
case RDStation::Hpi:
|
||||
for(int j=0;j<RD_MAX_PORTS;j++) {
|
||||
if(hpiGetInputStatus(i,j)!=port_status[i][j]) {
|
||||
port_status[i][j]=hpiGetInputStatus(i,j);
|
||||
if(port_status[i][j]) {
|
||||
cae_server->sendCommand(QString().sprintf("IS %d %d 0!",i,j));
|
||||
}
|
||||
else {
|
||||
cae_server->sendCommand(QString().sprintf("IS %d %d 1!",i,j));
|
||||
}
|
||||
}
|
||||
if(hpiGetInputMeters(i,j,levels)) {
|
||||
SendMeterLevelUpdate("I",i,j,levels);
|
||||
}
|
||||
if(hpiGetOutputMeters(i,j,levels)) {
|
||||
SendMeterLevelUpdate("O",i,j,levels);
|
||||
}
|
||||
}
|
||||
hpiGetOutputPosition(i,positions);
|
||||
SendMeterPositionUpdate(i,positions);
|
||||
for(int j=0;j<RD_MAX_STREAMS;j++) {
|
||||
if(hpiGetStreamOutputMeters(i,j,levels)) {
|
||||
SendStreamMeterLevelUpdate(i,j,levels);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RDStation::Jack:
|
||||
for(int j=0;j<RD_MAX_PORTS;j++) {
|
||||
if(jackGetInputStatus(i,j)!=port_status[i][j]) {
|
||||
port_status[i][j]=!port_status[i][j];
|
||||
cae_server->sendCommand(QString().sprintf("IS %d %d %d",i,j,
|
||||
port_status[i][j]));
|
||||
}
|
||||
if(jackGetInputMeters(i,j,levels)) {
|
||||
SendMeterLevelUpdate("I",i,j,levels);
|
||||
}
|
||||
if(jackGetOutputMeters(i,j,levels)) {
|
||||
SendMeterLevelUpdate("O",i,j,levels);
|
||||
}
|
||||
}
|
||||
jackGetOutputPosition(i,positions);
|
||||
SendMeterPositionUpdate(i,positions);
|
||||
for(int j=0;j<RD_MAX_STREAMS;j++) {
|
||||
if(jackGetStreamOutputMeters(i,j,levels)) {
|
||||
SendStreamMeterLevelUpdate(i,j,levels);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RDStation::Alsa:
|
||||
for(int j=0;j<RD_MAX_PORTS;j++) {
|
||||
if(alsaGetInputStatus(i,j)!=port_status[i][j]) {
|
||||
port_status[i][j]=!port_status[i][j];
|
||||
cae_server->sendCommand(QString().sprintf("IS %d %d %d",i,j,
|
||||
port_status[i][j]));
|
||||
}
|
||||
if(alsaGetInputMeters(i,j,levels)) {
|
||||
SendMeterLevelUpdate("I",i,j,levels);
|
||||
}
|
||||
if(alsaGetOutputMeters(i,j,levels)) {
|
||||
SendMeterLevelUpdate("O",i,j,levels);
|
||||
}
|
||||
}
|
||||
alsaGetOutputPosition(i,positions);
|
||||
SendMeterPositionUpdate(i,positions);
|
||||
for(int j=0;j<RD_MAX_STREAMS;j++) {
|
||||
if(alsaGetStreamOutputMeters(i,j,levels)) {
|
||||
SendStreamMeterLevelUpdate(i,j,levels);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RDStation::None:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -1512,43 +1341,16 @@ void MainObject::ProbeCaps(RDStation *station)
|
||||
// MP4 Decoder
|
||||
//
|
||||
station->setHaveCapability(RDStation::HaveMp4Decode,CheckMp4Decode());
|
||||
|
||||
/*
|
||||
#ifdef HPI
|
||||
station->setDriverVersion(RDStation::Hpi,hpiVersion());
|
||||
#else
|
||||
station->setDriverVersion(RDStation::Hpi,"[not enabled]");
|
||||
#endif // HPI
|
||||
#ifdef JACK
|
||||
//
|
||||
// FIXME: How can we detect the current JACK version?
|
||||
//
|
||||
station->setDriverVersion(RDStation::Jack,"Generic");
|
||||
#else
|
||||
station->setDriverVersion(RDStation::Jack,"");
|
||||
#endif // JACK
|
||||
#ifdef ALSA
|
||||
station->setDriverVersion(RDStation::Alsa,
|
||||
QString().sprintf("%d.%d.%d",
|
||||
SND_LIB_MAJOR,
|
||||
SND_LIB_MINOR,
|
||||
SND_LIB_SUBMINOR));
|
||||
#else
|
||||
station->setDriverVersion(RDStation::Alsa,"");
|
||||
#endif // ALSA
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::ClearDriverEntries(RDStation *station)
|
||||
void MainObject::ClearDriverEntries() const
|
||||
{
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
if(cae_driver[i]==RDStation::None) {
|
||||
station->setCardDriver(i,RDStation::None);
|
||||
station->setCardName(i,"");
|
||||
station->setCardInputs(i,-1);
|
||||
station->setCardOutputs(i,-1);
|
||||
}
|
||||
rda->station()->setCardDriver(i,RDStation::None);
|
||||
rda->station()->setCardName(i,"");
|
||||
rda->station()->setCardInputs(i,-1);
|
||||
rda->station()->setCardOutputs(i,-1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1784,7 +1586,7 @@ void MainObject::SendMeterOutputStatusUpdate()
|
||||
QList<int> ids=cae_server->connectionIds();
|
||||
|
||||
for(unsigned i=0;i<RD_MAX_CARDS;i++) {
|
||||
if(cae_driver[i]!=RDStation::None) {
|
||||
if(GetDriver(i)!=NULL) {
|
||||
for(unsigned j=0;j<RD_MAX_PORTS;j++) {
|
||||
for(unsigned k=0;k<RD_MAX_STREAMS;k++) {
|
||||
for(int l=0;l<ids.size();l++) {
|
||||
@ -1832,6 +1634,56 @@ CaeDriver *MainObject::GetDriver(unsigned card) const
|
||||
}
|
||||
|
||||
|
||||
void MainObject::MakeDriver(unsigned *next_card,RDStation::AudioDriver type)
|
||||
{
|
||||
CaeDriver *dvr=NULL;
|
||||
|
||||
switch(type) {
|
||||
case RDStation::Hpi:
|
||||
#ifdef HPI
|
||||
dvr=new HpiDriver(this);
|
||||
rda->station()->setDriverVersion(RDStation::Hpi,"v"+dvr->version());
|
||||
#else
|
||||
rda->station()->setDriverVersion(RDStation::Hpi,"[not enabled]");
|
||||
#endif // HPI
|
||||
break;
|
||||
|
||||
case RDStation::Alsa:
|
||||
#ifdef ALSA
|
||||
dvr=new AlsaDriver(this);
|
||||
rda->station()->setDriverVersion(RDStation::Alsa,"v"+dvr->version());
|
||||
#else
|
||||
rda->station()->setDriverVersion(RDStation::Alsa,"[not enabled]");
|
||||
#endif // ALSA
|
||||
break;
|
||||
|
||||
case RDStation::Jack:
|
||||
#ifdef JACK
|
||||
dvr=new JackDriver(this);
|
||||
rda->station()->setDriverVersion(RDStation::Jack,"v"+dvr->version());
|
||||
#else
|
||||
rda->station()->setDriverVersion(RDStation::Jack,"[not enabled]");
|
||||
#endif // JACK
|
||||
break;
|
||||
|
||||
case RDStation::None:
|
||||
break;
|
||||
}
|
||||
if(dvr!=NULL) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int rc;
|
||||
|
232
cae/cae.h
232
cae/cae.h
@ -34,31 +34,6 @@
|
||||
|
||||
#include <rdwavefile.h>
|
||||
|
||||
#ifdef HPI
|
||||
#include <rdhpisoundcard.h>
|
||||
#include <rdhpiplaystream.h>
|
||||
#include <rdhpirecordstream.h>
|
||||
#endif // HPI
|
||||
|
||||
#ifdef ALSA
|
||||
#include <alsa/asoundlib.h>
|
||||
struct alsa_format {
|
||||
int card;
|
||||
pthread_t thread;
|
||||
snd_pcm_t *pcm;
|
||||
unsigned channels;
|
||||
unsigned capture_channels;
|
||||
snd_pcm_uframes_t buffer_size;
|
||||
snd_pcm_format_t format;
|
||||
unsigned sample_rate;
|
||||
char *card_buffer;
|
||||
char *passthrough_buffer;
|
||||
unsigned card_buffer_size;
|
||||
unsigned periods;
|
||||
bool exiting;
|
||||
};
|
||||
#endif // ALSA
|
||||
|
||||
#ifdef JACK
|
||||
#include <jack/jack.h>
|
||||
#endif // JACK
|
||||
@ -90,14 +65,12 @@ void src_float_to_int_array (const float *in, int *out, int len);
|
||||
//
|
||||
// Global CAE Definitions
|
||||
//
|
||||
//#define RINGBUFFER_SIZE 262144
|
||||
#define CAED_USAGE "[-d]\n\nSupplying the '-d' flag will set 'debug' mode, causing caed(8) to stay\nin the foreground and print debugging info on standard output.\n"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void SigHandler(int signum);
|
||||
//extern RDConfig *rd_config;
|
||||
|
||||
class MainObject : public QObject
|
||||
{
|
||||
@ -155,7 +128,7 @@ class MainObject : public QObject
|
||||
int GetNextHandle();
|
||||
int GetHandle(int card,int stream);
|
||||
void ProbeCaps(RDStation *station);
|
||||
void ClearDriverEntries(RDStation *station);
|
||||
void ClearDriverEntries() const;
|
||||
void SendMeterLevelUpdate(const QString &type,int cardnum,int portnum,
|
||||
short levels[]);
|
||||
void SendStreamMeterLevelUpdate(int cardnum,int streamnum,short levels[]);
|
||||
@ -163,12 +136,14 @@ class MainObject : public QObject
|
||||
void SendMeterOutputStatusUpdate();
|
||||
void SendMeterOutputStatusUpdate(int card,int port,int stream);
|
||||
void SendMeterUpdate(const QString &msg,int conn_id);
|
||||
CaeDriver *GetDriver(unsigned card) const;
|
||||
void MakeDriver(unsigned *next_card,RDStation::AudioDriver type);
|
||||
QList<CaeDriver *> d_drivers;
|
||||
bool debug;
|
||||
unsigned system_sample_rate;
|
||||
CaeServer *cae_server;
|
||||
int16_t tcp_port;
|
||||
QUdpSocket *meter_socket;
|
||||
RDStation::AudioDriver cae_driver[RD_MAX_CARDS];
|
||||
int record_owner[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
int record_length[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
int record_threshold[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
@ -184,207 +159,8 @@ class MainObject : public QObject
|
||||
int owner;
|
||||
} play_handle[256];
|
||||
int next_play_handle;
|
||||
// RDStation *cae_station;
|
||||
|
||||
//
|
||||
// New Stuff
|
||||
//
|
||||
CaeDriver *GetDriver(unsigned card) const;
|
||||
QList<CaeDriver *> d_drivers;
|
||||
|
||||
//
|
||||
// HPI Driver
|
||||
//
|
||||
private:
|
||||
/*
|
||||
void hpiInit(RDStation *station);
|
||||
void hpiFree();
|
||||
QString hpiVersion();
|
||||
bool hpiLoadPlayback(int card,QString wavename,int *stream);
|
||||
bool hpiUnloadPlayback(int card,int stream);
|
||||
bool hpiPlaybackPosition(int card,int stream,unsigned pos);
|
||||
bool hpiPlay(int card,int stream,int length,int speed,bool pitch,
|
||||
bool rates);
|
||||
bool hpiStopPlayback(int card,int stream);
|
||||
bool hpiTimescaleSupported(int card);
|
||||
bool hpiLoadRecord(int card,int port,int coding,int chans,int samprate,
|
||||
int bitrate,QString wavename);
|
||||
bool hpiUnloadRecord(int card,int stream,unsigned *len);
|
||||
bool hpiRecord(int card,int stream,int length,int thres);
|
||||
bool hpiStopRecord(int card,int stream);
|
||||
bool hpiSetClockSource(int card,int src);
|
||||
bool hpiSetInputVolume(int card,int stream,int level);
|
||||
bool hpiSetOutputVolume(int card,int stream,int port,int level);
|
||||
bool hpiFadeOutputVolume(int card,int stream,int port,int level,int length);
|
||||
bool hpiSetInputLevel(int card,int port,int level);
|
||||
bool hpiSetOutputLevel(int card,int port,int level);
|
||||
bool hpiSetInputMode(int card,int stream,int mode);
|
||||
bool hpiSetOutputMode(int card,int stream,int mode);
|
||||
bool hpiSetInputVoxLevel(int card,int stream,int level);
|
||||
bool hpiSetInputType(int card,int port,int type);
|
||||
bool hpiGetInputStatus(int card,int port);
|
||||
bool hpiGetInputMeters(int card,int port,short levels[2]);
|
||||
bool hpiGetOutputMeters(int card,int port,short levels[2]);
|
||||
bool hpiGetStreamOutputMeters(int card,int stream,short levels[2]);
|
||||
bool hpiSetPassthroughLevel(int card,int in_port,int out_port,int level);
|
||||
void hpiGetOutputPosition(int card,unsigned *pos);
|
||||
#ifdef HPI
|
||||
RDHPISoundCard *sound_card;
|
||||
RDHPIRecordStream *record[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
RDHPIPlayStream *play[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
#endif // HPI
|
||||
*/
|
||||
|
||||
/*
|
||||
//
|
||||
// JACK Driver
|
||||
//
|
||||
private slots:
|
||||
void jackStopTimerData(int stream);
|
||||
void jackFadeTimerData(int stream);
|
||||
void jackRecordTimerData(int stream);
|
||||
void jackClientStartData();
|
||||
|
||||
private:
|
||||
void jackInit(RDStation *station);
|
||||
void jackFree();
|
||||
bool jackLoadPlayback(int card,QString wavename,int *stream);
|
||||
bool jackUnloadPlayback(int card,int stream);
|
||||
bool jackPlaybackPosition(int card,int stream,unsigned pos);
|
||||
bool jackPlay(int card,int stream,int length,int speed,bool pitch,
|
||||
bool rates);
|
||||
bool jackStopPlayback(int card,int stream);
|
||||
bool jackTimescaleSupported(int card);
|
||||
bool jackLoadRecord(int card,int port,int coding,int chans,int samprate,
|
||||
int bitrate,QString wavename);
|
||||
bool jackUnloadRecord(int card,int stream,unsigned *len);
|
||||
bool jackRecord(int card,int stream,int length,int thres);
|
||||
bool jackStopRecord(int card,int stream);
|
||||
bool jackSetInputVolume(int card,int stream,int level);
|
||||
bool jackSetOutputVolume(int card,int stream,int port,int level);
|
||||
bool jackFadeOutputVolume(int card,int stream,int port,int level,int length);
|
||||
bool jackSetInputLevel(int card,int port,int level);
|
||||
bool jackSetOutputLevel(int card,int port,int level);
|
||||
bool jackSetInputMode(int card,int stream,int mode);
|
||||
bool jackSetOutputMode(int card,int stream,int mode);
|
||||
bool jackSetInputVoxLevel(int card,int stream,int level);
|
||||
bool jackSetInputType(int card,int port,int type);
|
||||
bool jackGetInputStatus(int card,int port);
|
||||
bool jackGetInputMeters(int card,int port,short levels[2]);
|
||||
bool jackGetOutputMeters(int card,int port,short levels[2]);
|
||||
bool jackGetStreamOutputMeters(int card,int stream,short levels[2]);
|
||||
bool jackSetPassthroughLevel(int card,int in_port,int out_port,int level);
|
||||
void jackGetOutputPosition(int card,unsigned *pos);
|
||||
void jackConnectPorts(const QString &out,const QString &in);
|
||||
void jackDisconnectPorts(const QString &out,const QString &in);
|
||||
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
|
||||
*/
|
||||
//
|
||||
// ALSA Driver
|
||||
//
|
||||
/*
|
||||
private slots:
|
||||
void alsaStopTimerData(int cardstream);
|
||||
void alsaFadeTimerData(int cardstream);
|
||||
void alsaRecordTimerData(int cardport);
|
||||
|
||||
private:
|
||||
void alsaInit(RDStation *station);
|
||||
void alsaFree();
|
||||
bool alsaLoadPlayback(int card,QString wavename,int *stream);
|
||||
bool alsaUnloadPlayback(int card,int stream);
|
||||
bool alsaPlaybackPosition(int card,int stream,unsigned pos);
|
||||
bool alsaPlay(int card,int stream,int length,int speed,bool pitch,
|
||||
bool rates);
|
||||
bool alsaStopPlayback(int card,int stream);
|
||||
bool alsaTimescaleSupported(int card);
|
||||
bool alsaLoadRecord(int card,int port,int coding,int chans,int samprate,
|
||||
int bitrate,QString wavename);
|
||||
bool alsaUnloadRecord(int card,int stream,unsigned *len);
|
||||
bool alsaRecord(int card,int stream,int length,int thres);
|
||||
bool alsaStopRecord(int card,int stream);
|
||||
bool alsaSetInputVolume(int card,int stream,int level);
|
||||
bool alsaSetOutputVolume(int card,int stream,int port,int level);
|
||||
bool alsaFadeOutputVolume(int card,int stream,int port,int level,int length);
|
||||
bool alsaSetInputLevel(int card,int port,int level);
|
||||
bool alsaSetOutputLevel(int card,int port,int level);
|
||||
bool alsaSetInputMode(int card,int stream,int mode);
|
||||
bool alsaSetOutputMode(int card,int stream,int mode);
|
||||
bool alsaSetInputVoxLevel(int card,int stream,int level);
|
||||
bool alsaSetInputType(int card,int port,int type);
|
||||
bool alsaGetInputStatus(int card,int port);
|
||||
bool alsaGetInputMeters(int card,int port,short levels[2]);
|
||||
bool alsaGetOutputMeters(int card,int port,short levels[2]);
|
||||
bool alsaGetStreamOutputMeters(int card,int stream,short levels[2]);
|
||||
bool alsaSetPassthroughLevel(int card,int in_port,int out_port,int level);
|
||||
void alsaGetOutputPosition(int card,unsigned *pos);
|
||||
void AlsaClock();
|
||||
#ifdef ALSA
|
||||
bool AlsaStartCaptureDevice(QString &dev,int card,snd_pcm_t *pcm);
|
||||
bool AlsaStartPlayDevice(QString &dev,int card,snd_pcm_t *pcm);
|
||||
void AlsaInitCallback();
|
||||
int GetAlsaOutputStream(int card);
|
||||
void FreeAlsaOutputStream(int card,int stream);
|
||||
void EmptyAlsaInputStream(int card,int stream);
|
||||
void WriteAlsaBuffer(int card,int stream,short *buffer,unsigned len);
|
||||
void FillAlsaOutputStream(int card,int stream);
|
||||
struct alsa_format alsa_play_format[RD_MAX_CARDS];
|
||||
struct alsa_format alsa_capture_format[RD_MAX_CARDS];
|
||||
short alsa_input_volume_db[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
short alsa_output_volume_db[RD_MAX_CARDS][RD_MAX_PORTS][RD_MAX_STREAMS];
|
||||
short alsa_passthrough_volume_db[RD_MAX_CARDS][RD_MAX_PORTS][RD_MAX_PORTS];
|
||||
short *alsa_wave_buffer;
|
||||
uint8_t *alsa_wave24_buffer;
|
||||
RDWaveFile *alsa_record_wave[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
RDWaveFile *alsa_play_wave[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
int alsa_offset[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
QTimer *alsa_fade_timer[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
QTimer *alsa_stop_timer[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
QTimer *alsa_record_timer[RD_MAX_CARDS][RD_MAX_PORTS];
|
||||
bool alsa_fade_up[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
short alsa_fade_volume_db[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
short alsa_fade_increment[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
int alsa_fade_port[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
unsigned alsa_samples_recorded[RD_MAX_CARDS][RD_MAX_STREAMS];
|
||||
#endif // ALSA
|
||||
*/
|
||||
|
||||
bool CheckLame();
|
||||
bool CheckMp4Decode();
|
||||
|
||||
|
1695
cae/cae_jack.cpp
1695
cae/cae_jack.cpp
File diff suppressed because it is too large
Load Diff
@ -1,48 +0,0 @@
|
||||
// caedriverfactory.xpp
|
||||
//
|
||||
// Create CaeDriver instances.
|
||||
//
|
||||
// (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.
|
||||
//
|
||||
|
||||
#include "alsadriver.h"
|
||||
#include "caedriverfactory.h"
|
||||
#include "hpidriver.h"
|
||||
#include "jackdriver.h"
|
||||
|
||||
CaeDriver *CaeDriverFactory(RDStation::AudioDriver dvr,QObject *parent)
|
||||
{
|
||||
CaeDriver *ret=NULL;
|
||||
|
||||
switch(dvr) {
|
||||
case RDStation::Hpi:
|
||||
ret=new HpiDriver(parent);
|
||||
break;
|
||||
|
||||
case RDStation::Jack:
|
||||
ret=new JackDriver(parent);
|
||||
break;
|
||||
|
||||
case RDStation::Alsa:
|
||||
ret=new AlsaDriver(parent);
|
||||
break;
|
||||
|
||||
case RDStation::None:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
// caedriverfactory.h
|
||||
//
|
||||
// Create CaeDriver instances.
|
||||
//
|
||||
// (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 CAEDRIVERFACTORY_H
|
||||
#define CAEDRIVERFACTORY_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <rdstation.h>
|
||||
|
||||
#include "caedriver.h"
|
||||
|
||||
CaeDriver *CaeDriverFactory(RDStation::AudioDriver dvr,QObject *parent=0);
|
||||
|
||||
|
||||
#endif // CAEDRIVERFACTORY_H
|
@ -438,7 +438,11 @@ JackDriver::~JackDriver()
|
||||
|
||||
QString JackDriver::version() const
|
||||
{
|
||||
#ifdef JACK
|
||||
return QString(jack_get_version_string());
|
||||
#else
|
||||
return QString();
|
||||
#endif // JACK
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user