mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-09-17 17:00:27 +02:00
2023-09-09 Fred Gleason <fredg@paravelsystems.com>
* Modified the communications layer to use UDP command messaging. * Disabled the 'Meter Enable' ['ME'] CAE command. * Implemented the 'Start Playback' ['PY'] CAE command. * Implemented the modified 'Play Position' ['PP'] CAE command. * Implemented the modified 'Stop Playback' ['SP'] CAE command. * Stubbed out the new 'Pause Playback' ['PE'] CAE command. * Stubbed out the new 'Resume Playback' ['PR'] CAE command. * Implemented the modified 'Set Output Volume' ['OV'] CAE command. * Implemented the modified 'Fade Output Volume' ['FV'] CAE command. * Stubbed out the new 'Cue Recording' ['LR'] CAE command. * Stubbed out the new 'Start Recording' ['RD'] CAE command. * Stubbed out the new 'Cue and Start Recording' ['RC'] CAE command. * Stubbed out the modified 'Stop Recording' ['SR'] CAE command. * Implemented the modified 'Get Input Status' ['IS'] CAE command. * Implemented the modified 'Set Audio Passthrough Level' ['AL'] CAE command. * Implemented the new 'Update Audio Ports' ['AP'] CAE command. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
ac45e60949
commit
c8e6dd62e8
18
ChangeLog
18
ChangeLog
@ -24403,3 +24403,21 @@
|
||||
* Removed the 'RDCae::setOutputMode()' method.
|
||||
* Removed the 'RDCae::setInputVOXLevel()' method.
|
||||
* Removed the 'RDCae::setInputType()' method.
|
||||
2023-09-09 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Modified the communications layer to use UDP command messaging.
|
||||
* Disabled the 'Meter Enable' ['ME'] CAE command.
|
||||
* Implemented the 'Start Playback' ['PY'] CAE command.
|
||||
* Implemented the modified 'Play Position' ['PP'] CAE command.
|
||||
* Implemented the modified 'Stop Playback' ['SP'] CAE command.
|
||||
* Stubbed out the new 'Pause Playback' ['PE'] CAE command.
|
||||
* Stubbed out the new 'Resume Playback' ['PR'] CAE command.
|
||||
* Implemented the modified 'Set Output Volume' ['OV'] CAE command.
|
||||
* Implemented the modified 'Fade Output Volume' ['FV'] CAE command.
|
||||
* Stubbed out the new 'Cue Recording' ['LR'] CAE command.
|
||||
* Stubbed out the new 'Start Recording' ['RD'] CAE command.
|
||||
* Stubbed out the new 'Cue and Start Recording' ['RC'] CAE command.
|
||||
* Stubbed out the modified 'Stop Recording' ['SR'] CAE command.
|
||||
* Implemented the modified 'Get Input Status' ['IS'] CAE command.
|
||||
* Implemented the modified 'Set Audio Passthrough Level' ['AL'] CAE
|
||||
command.
|
||||
* Implemented the new 'Update Audio Ports' ['AP'] CAE command.
|
||||
|
@ -2,7 +2,7 @@
|
||||
##
|
||||
## Core Audio Engine Makefile.am for Rivendell
|
||||
##
|
||||
## Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
## Copyright 2002-2023 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
|
||||
@ -34,7 +34,8 @@ dist_caed_SOURCES = cae.cpp cae.h\
|
||||
driver.cpp driver.h\
|
||||
driver_alsa.cpp driver_alsa.h\
|
||||
driver_hpi.cpp driver_hpi.h\
|
||||
driver_jack.cpp driver_jack.h
|
||||
driver_jack.cpp driver_jack.h\
|
||||
session.cpp session.h
|
||||
|
||||
nodist_caed_SOURCES = moc_cae.cpp\
|
||||
moc_cae_server.cpp\
|
||||
|
325
cae/cae.cpp
325
cae/cae.cpp
@ -144,13 +144,22 @@ MainObject::MainObject(QObject *parent)
|
||||
//
|
||||
// Server Front End
|
||||
//
|
||||
cae_server=new CaeServer(rda->config(),this);
|
||||
cae_server=new CaeServer(this);
|
||||
if(!cae_server->listen(QHostAddress::Any,CAED_TCP_PORT)) {
|
||||
rda->syslog(LOG_ERR,"caed: failed to bind port %d",CAED_TCP_PORT);
|
||||
exit(1);
|
||||
}
|
||||
connect(cae_server,SIGNAL(connectionDropped(int)),
|
||||
this,SLOT(connectionDroppedData(int)));
|
||||
connect(cae_server,SIGNAL(playPositionReq(const SessionId &,int)),
|
||||
this,SLOT(playPositionData(const SessionId &,int)));
|
||||
connect(cae_server,SIGNAL(startPlaybackReq(const SessionId &,const QString &,
|
||||
unsigned,unsigned,int,int,int)),
|
||||
this,SLOT(startPlaybackData(const SessionId &,const QString &,
|
||||
unsigned,unsigned,int,int,int)));
|
||||
connect(cae_server,SIGNAL(playStopReq(const SessionId &)),
|
||||
this,SLOT(stopPlaybackData(const SessionId &)));
|
||||
/*
|
||||
connect(cae_server,SIGNAL(loadPlaybackReq(int,unsigned,const QString &)),
|
||||
this,SLOT(loadPlaybackData(int,unsigned,const QString &)));
|
||||
connect(cae_server,SIGNAL(unloadPlaybackReq(int,unsigned)),
|
||||
@ -201,14 +210,20 @@ MainObject::MainObject(QObject *parent)
|
||||
this,SLOT(setInputVoxLevelData(int,unsigned,unsigned,int)));
|
||||
connect(cae_server,SIGNAL(setInputTypeReq(int,unsigned,unsigned,unsigned)),
|
||||
this,SLOT(setInputTypeData(int,unsigned,unsigned,unsigned)));
|
||||
connect(cae_server,SIGNAL(getInputStatusReq(int,unsigned,unsigned)),
|
||||
this,SLOT(getInputStatusData(int,unsigned,unsigned)));
|
||||
connect(cae_server,
|
||||
SIGNAL(setAudioPassthroughLevelReq(int,unsigned,unsigned,unsigned,int)),
|
||||
SIGNAL(getInputStatusReq(const SessionTuple &,unsigned,unsigned)),
|
||||
this,
|
||||
SLOT(setAudioPassthroughLevelData(int,unsigned,unsigned,unsigned,int)));
|
||||
connect(cae_server,SIGNAL(updateAudioPorts(int)),
|
||||
this,SLOT(updateAudioPortsData(int)));
|
||||
SLOT(getInputStatusData(const SessionTuple &,unsigned,unsigned)));
|
||||
*/
|
||||
connect(cae_server,
|
||||
SIGNAL(setAudioPassthroughLevelReq(const QHostAddress &,
|
||||
unsigned,unsigned,unsigned,int)),
|
||||
this,
|
||||
SLOT(setAudioPassthroughLevelData(const QHostAddress &,
|
||||
unsigned,unsigned,unsigned,int)));
|
||||
connect(cae_server,SIGNAL(updateAudioPorts()),
|
||||
this,SLOT(updateAudioPortsData()));
|
||||
/*
|
||||
connect(cae_server,SIGNAL(setClockSourceReq(int,unsigned,int)),
|
||||
this,SLOT(setClockSourceData(int,unsigned,int)));
|
||||
connect(cae_server,
|
||||
@ -221,11 +236,11 @@ MainObject::MainObject(QObject *parent)
|
||||
this,
|
||||
SLOT(openRtpCaptureChannelData(int,unsigned,unsigned,uint16_t,
|
||||
unsigned,unsigned)));
|
||||
connect(cae_server,
|
||||
SIGNAL(meterEnableReq(int,uint16_t,const QList<unsigned> &)),
|
||||
this,
|
||||
SLOT(meterEnableData(int,uint16_t,const QList<unsigned> &)));
|
||||
|
||||
connect(cae_server,SIGNAL(meterEnableReq(const QHostAddress &,uint16_t,
|
||||
const QList<unsigned> &)),
|
||||
this,SLOT(meterEnableData(const QHostAddress &,uint16_t,
|
||||
const QList<unsigned> &)));
|
||||
*/
|
||||
signal(SIGHUP,SigHandler);
|
||||
signal(SIGINT,SigHandler);
|
||||
signal(SIGTERM,SigHandler);
|
||||
@ -331,8 +346,177 @@ MainObject::MainObject(QObject *parent)
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// New Slots
|
||||
//
|
||||
void MainObject::startPlaybackData(const SessionId &sid,const QString &cutname,
|
||||
unsigned cardnum,unsigned portnum,
|
||||
int start_pos,int end_pos,int speed)
|
||||
{
|
||||
Driver *dvr=NULL;
|
||||
|
||||
//
|
||||
// Find the card
|
||||
//
|
||||
if((dvr=GetDriver(cardnum))==NULL) {
|
||||
rda->syslog(LOG_WARNING,"no such card - session: %s card: %d",
|
||||
sid.dump().toUtf8().constData(),cardnum);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Load
|
||||
//
|
||||
int streamnum=-1;
|
||||
QString wavename=rda->config()->audioFileName(cutname).trimmed();
|
||||
if(!dvr->loadPlayback(cardnum,wavename,&streamnum)) {
|
||||
rda->syslog(LOG_WARNING,"no available play stream - session: %d card: %d",
|
||||
sid.dump().toUtf8().constData(),cardnum);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Position
|
||||
//
|
||||
if(!dvr->playbackPosition(cardnum,streamnum,start_pos)) {
|
||||
rda->syslog(LOG_WARNING,"invalid start position - session: %s card: %d stream: %d position: %d",
|
||||
sid.dump().toUtf8().constData(),cardnum,streamnum,start_pos);
|
||||
}
|
||||
|
||||
//
|
||||
// Set Mixer
|
||||
//
|
||||
if(!dvr->setOutputVolume(cardnum,streamnum,portnum,0)) {
|
||||
rda->syslog(LOG_WARNING,"set output volume failed - session: %s card: %d port: %d stream: %d level: 0",
|
||||
sid.dump().toUtf8().constData(),cardnum,portnum,streamnum);
|
||||
}
|
||||
|
||||
//
|
||||
// Start the transport
|
||||
//
|
||||
if(!dvr->play(cardnum,streamnum,end_pos-start_pos,speed,false,false)) {
|
||||
rda->syslog(LOG_WARNING,
|
||||
"play start failed - session: %s card: %d stream: %d",
|
||||
sid.dump().toUtf8().constData(),cardnum,streamnum);
|
||||
dvr->unloadPlayback(cardnum,streamnum);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Create session record
|
||||
//
|
||||
Session *sess=new Session(sid);
|
||||
sess->setCardNumber(cardnum);
|
||||
sess->setPortNumber(portnum);
|
||||
sess->setStreamNumber(streamnum);
|
||||
sess->setStartPosition(start_pos);
|
||||
sess->setEndPosition(end_pos);
|
||||
sess->setSpeed(speed);
|
||||
cae_sessions[sid]=sess;
|
||||
|
||||
rda->syslog(LOG_DEBUG,"playback started - session: %s card: %d port: %d stream: %d filename: %s",
|
||||
sid.dump().toUtf8().constData(),cardnum,portnum,streamnum,
|
||||
wavename.toUtf8().constData());
|
||||
}
|
||||
|
||||
|
||||
void MainObject::playPositionData(const SessionId &sid,int position)
|
||||
{
|
||||
Session *sess=NULL;
|
||||
Driver *dvr=NULL;
|
||||
|
||||
//
|
||||
// Find the session
|
||||
//
|
||||
if((sess=cae_sessions.value(sid))==NULL) {
|
||||
rda->syslog(LOG_WARNING,
|
||||
"attempting to position non-existent session - session: %s",
|
||||
sid.dump().toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Find the card
|
||||
//
|
||||
if((dvr=GetDriver(sess->cardNumber()))==NULL) {
|
||||
rda->syslog(LOG_WARNING,"no such card - session: %s card: %d",
|
||||
sid.dump().toUtf8().constData(),sess->cardNumber());
|
||||
return;
|
||||
}
|
||||
|
||||
if(!dvr->playbackPosition(sess->cardNumber(),sess->streamNumber(),position)) {
|
||||
rda->syslog(LOG_WARNING,"play position failed - session: %s position: %d",
|
||||
sid.dump().toUtf8().constData(),position);
|
||||
return;
|
||||
}
|
||||
cae_server->sendCommand(sid,QString::asprintf("PP %d %d %d",
|
||||
sid.processId(),
|
||||
sid.serialNumber(),
|
||||
position));
|
||||
rda->syslog(LOG_DEBUG,"play position succeeded - session: %s position: %d",
|
||||
sid.dump().toUtf8().constData(),position);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::stopPlaybackData(const SessionId &sid)
|
||||
{
|
||||
Session *sess=NULL;
|
||||
Driver *dvr=NULL;
|
||||
|
||||
//
|
||||
// Find the session
|
||||
//
|
||||
if((sess=cae_sessions.value(sid))==NULL) {
|
||||
rda->syslog(LOG_WARNING,
|
||||
"attempting to stop playing non-existent session - session: %s",
|
||||
sid.dump().toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Find the card
|
||||
//
|
||||
if((dvr=GetDriver(sess->cardNumber()))==NULL) {
|
||||
rda->syslog(LOG_WARNING,"no such card - session: %s card: %d",
|
||||
sid.dump().toUtf8().constData(),sess->cardNumber());
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Stop Transport
|
||||
//
|
||||
if(!dvr->stopPlayback(sess->cardNumber(),sess->streamNumber())) {
|
||||
rda->syslog(LOG_WARNING,
|
||||
"stop playback failed - session: %s",
|
||||
sid.dump().toUtf8().constData());
|
||||
}
|
||||
|
||||
//
|
||||
// Unload
|
||||
//
|
||||
if(!dvr->unloadPlayback(sess->cardNumber(),sess->streamNumber())) {
|
||||
rda->syslog(LOG_WARNING,
|
||||
"unload playback failed - session: %s",
|
||||
sid.dump().toUtf8().constData());
|
||||
}
|
||||
|
||||
//
|
||||
// Delete session
|
||||
//
|
||||
QString msg=QString::asprintf("stopped playback - session: %s",
|
||||
sid.dump().toUtf8().constData());
|
||||
delete sess;
|
||||
cae_sessions.remove(sid);
|
||||
rda->syslog(LOG_DEBUG,"%s",msg.toUtf8().constData());
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Old Slots
|
||||
//
|
||||
void MainObject::loadPlaybackData(int id,unsigned card,const QString &name)
|
||||
{
|
||||
/*
|
||||
QString wavename;
|
||||
int new_stream=-1;
|
||||
int handle;
|
||||
@ -373,11 +557,13 @@ void MainObject::loadPlaybackData(int id,unsigned card,const QString &name)
|
||||
sendCommand(id,QString::asprintf("LP %d %s %d %d +!",card,
|
||||
(const char *)name.toUtf8(),
|
||||
new_stream,handle));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::unloadPlaybackData(int id,unsigned handle)
|
||||
{
|
||||
/*
|
||||
int card=play_handle[handle].card;
|
||||
int stream=play_handle[handle].stream;
|
||||
Driver *dvr=GetDriver(card);
|
||||
@ -409,11 +595,13 @@ void MainObject::unloadPlaybackData(int id,unsigned handle)
|
||||
else {
|
||||
cae_server->sendCommand(id,QString::asprintf("UP %d -!",handle));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::playPositionData(int id,unsigned handle,unsigned pos)
|
||||
{
|
||||
/*
|
||||
int card=play_handle[handle].card;
|
||||
int stream=play_handle[handle].stream;
|
||||
Driver *dvr=GetDriver(card);
|
||||
@ -435,12 +623,14 @@ void MainObject::playPositionData(int id,unsigned handle,unsigned pos)
|
||||
return;
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("PP %d %d -!",handle,pos));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::playData(int id,unsigned handle,unsigned length,unsigned speed,
|
||||
unsigned pitch_flag)
|
||||
{
|
||||
/*
|
||||
int card=play_handle[handle].card;
|
||||
int stream=play_handle[handle].stream;
|
||||
Driver *dvr=GetDriver(card);
|
||||
@ -487,11 +677,13 @@ void MainObject::playData(int id,unsigned handle,unsigned length,unsigned speed,
|
||||
cae_server->
|
||||
sendCommand(id,QString::asprintf("PY %u %u %u %u -!",
|
||||
handle,length,speed,pitch_flag));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::stopPlaybackData(int id,unsigned handle)
|
||||
{
|
||||
/*
|
||||
int card=play_handle[handle].card;
|
||||
int stream=play_handle[handle].stream;
|
||||
Driver *dvr=GetDriver(card);
|
||||
@ -511,11 +703,13 @@ void MainObject::stopPlaybackData(int id,unsigned handle)
|
||||
return;
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("SP %u -!",handle));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::timescalingSupportData(int id,unsigned card)
|
||||
{
|
||||
/*
|
||||
bool state=false;
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
@ -529,6 +723,7 @@ void MainObject::timescalingSupportData(int id,unsigned card)
|
||||
else {
|
||||
cae_server->sendCommand(id,QString::asprintf("TS %u -!",card));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -537,6 +732,7 @@ void MainObject::loadRecordingData(int id,unsigned card,unsigned port,
|
||||
unsigned samprate,unsigned bitrate,
|
||||
const QString &name)
|
||||
{
|
||||
/*
|
||||
QString wavename;
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
@ -574,11 +770,13 @@ void MainObject::loadRecordingData(int id,unsigned card,unsigned port,
|
||||
card,port,coding,channels,samprate,
|
||||
bitrate,(const char *)name.toUtf8()));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::unloadRecordingData(int id,unsigned card,unsigned stream)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -604,12 +802,14 @@ void MainObject::unloadRecordingData(int id,unsigned card,unsigned stream)
|
||||
cae_server->sendCommand(id,QString::asprintf("UR %u %u -!",card,stream));
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::recordData(int id,unsigned card,unsigned stream,unsigned len,
|
||||
int threshold_level)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -638,11 +838,13 @@ void MainObject::recordData(int id,unsigned card,unsigned stream,unsigned len,
|
||||
cae_server->
|
||||
sendCommand(id,QString::asprintf("RD %u %u %u %d -!",
|
||||
card,stream,len,threshold_level));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::stopRecordingData(int id,unsigned card,unsigned stream)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -654,12 +856,14 @@ void MainObject::stopRecordingData(int id,unsigned card,unsigned stream)
|
||||
return;
|
||||
}
|
||||
rda->syslog(LOG_INFO,"StopRecord - Card: %d Stream: %d",card,stream);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setInputVolumeData(int id,unsigned card,unsigned stream,
|
||||
int level)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -679,12 +883,14 @@ void MainObject::setInputVolumeData(int id,unsigned card,unsigned stream,
|
||||
}
|
||||
cae_server->
|
||||
sendCommand(id,QString::asprintf("IV %u %u %d +!",card,stream,level));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setOutputPortData(int id,unsigned card,unsigned stream,
|
||||
unsigned port,int level)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -709,12 +915,14 @@ void MainObject::setOutputPortData(int id,unsigned card,unsigned stream,
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("OV %u %u %u %d +!",
|
||||
card,stream,port,level));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setOutputVolumeData(int id,unsigned card,unsigned stream,
|
||||
int port,int level)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -743,12 +951,14 @@ void MainObject::setOutputVolumeData(int id,unsigned card,unsigned stream,
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("OV %u %u %u %d +!",
|
||||
card,stream,port,level));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::fadeOutputVolumeData(int id,unsigned card,unsigned stream,
|
||||
unsigned port,int level,unsigned length)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -773,12 +983,14 @@ void MainObject::fadeOutputVolumeData(int id,unsigned card,unsigned stream,
|
||||
cae_server->
|
||||
sendCommand(id,QString::asprintf("FV %u %u %u %d %u +!",
|
||||
card,stream,port,level,length));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setInputLevelData(int id,unsigned card,unsigned port,
|
||||
int level)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -799,12 +1011,14 @@ void MainObject::setInputLevelData(int id,unsigned card,unsigned port,
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("IL %u %u %d +!",
|
||||
card,port,level));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setOutputLevelData(int id,unsigned card,unsigned port,
|
||||
int level)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -824,12 +1038,14 @@ void MainObject::setOutputLevelData(int id,unsigned card,unsigned port,
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("OL %u %u %d +!",
|
||||
card,port,level));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setInputModeData(int id,unsigned card,unsigned stream,
|
||||
unsigned mode)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -849,12 +1065,14 @@ void MainObject::setInputModeData(int id,unsigned card,unsigned stream,
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("IM %u %u %u +!",
|
||||
card,stream,mode));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setOutputModeData(int id,unsigned card,unsigned stream,
|
||||
unsigned mode)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -874,12 +1092,14 @@ void MainObject::setOutputModeData(int id,unsigned card,unsigned stream,
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("OM %u %u %u +!",
|
||||
card,stream,mode));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setInputVoxLevelData(int id,unsigned card,unsigned stream,
|
||||
int level)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -899,12 +1119,14 @@ void MainObject::setInputVoxLevelData(int id,unsigned card,unsigned stream,
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("IX %u %u %d +!",
|
||||
card,stream,level));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setInputTypeData(int id,unsigned card,unsigned port,
|
||||
unsigned type)
|
||||
{
|
||||
/*
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
@ -924,10 +1146,12 @@ void MainObject::setInputTypeData(int id,unsigned card,unsigned port,
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("IT %u %u %u +!",
|
||||
card,port,type));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::getInputStatusData(int id,unsigned card,unsigned port)
|
||||
void MainObject::getInputStatusData(const SessionId &origin,
|
||||
unsigned card,unsigned port)
|
||||
{
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
@ -935,43 +1159,36 @@ void MainObject::getInputStatusData(int id,unsigned card,unsigned port)
|
||||
return;
|
||||
}
|
||||
if(dvr->driverType()==RDStation::Hpi) {
|
||||
if(dvr->getInputStatus(card,port)) {
|
||||
cae_server->sendCommand(id,QString::asprintf("IS %d %d 0 +!",card,port));
|
||||
}
|
||||
else {
|
||||
cae_server->sendCommand(id,QString::asprintf("IS %d %d 1 +!",card,port));
|
||||
}
|
||||
cae_server->sendCommand(origin,
|
||||
QString::asprintf("IS %d %d %d",card,port,dvr->getInputStatus(card,port)));
|
||||
}
|
||||
else {
|
||||
cae_server->
|
||||
sendCommand(origin,QString::asprintf("IS %d %d 1 +!",card,port));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setAudioPassthroughLevelData(int id,unsigned card,
|
||||
unsigned input,unsigned output,
|
||||
int level)
|
||||
void MainObject::setAudioPassthroughLevelData(const QHostAddress &src_addr,
|
||||
unsigned card,unsigned input,
|
||||
unsigned output,int level)
|
||||
{
|
||||
Driver *dvr=GetDriver(card);
|
||||
|
||||
if(dvr==NULL) {
|
||||
cae_server->sendCommand(id,QString::asprintf("AL %u %u %u %d -!",
|
||||
card,input,output,level));
|
||||
return;
|
||||
if(dvr!=NULL) {
|
||||
if(dvr->setPassthroughLevel(card,input,output,level)) {
|
||||
if(rda->config()->enableMixerLogging()) {
|
||||
rda->syslog(LOG_INFO,
|
||||
"SetPassthroughLevel - Host: %s Card: %d InPort: %d OutPort: %d Level: %d",
|
||||
src_addr.toString().toUtf8().constData(),
|
||||
card,input,output,level);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!dvr->setPassthroughLevel(card,input,output,level)) {
|
||||
cae_server->sendCommand(id,QString::asprintf("AL %u %u %u %d -!",
|
||||
card,input,output,level));
|
||||
return;
|
||||
}
|
||||
if(rda->config()->enableMixerLogging()) {
|
||||
rda->syslog(LOG_INFO,
|
||||
"SetPassthroughLevel - Card: %d InPort: %d OutPort: %d Level: %d",
|
||||
card,input,output,level);
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("AL %u %u %u %d +!",
|
||||
card,input,output,level));
|
||||
}
|
||||
|
||||
|
||||
void MainObject::updateAudioPortsData(int id)
|
||||
void MainObject::updateAudioPortsData()
|
||||
{
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
RDAudioPort *port=new RDAudioPort(rda->config()->stationName(),i);
|
||||
@ -998,6 +1215,7 @@ void MainObject::updateAudioPortsData(int id)
|
||||
|
||||
void MainObject::setClockSourceData(int id,unsigned card,int input)
|
||||
{
|
||||
/*
|
||||
if((card<0)||(input<0)) {
|
||||
cae_server->sendCommand(id,QString::asprintf("CS %u %u -!",card,input));
|
||||
return;
|
||||
@ -1023,16 +1241,19 @@ void MainObject::setClockSourceData(int id,unsigned card,int input)
|
||||
"SetClockSource - Card: %d Source: %d",card,input);
|
||||
}
|
||||
cae_server->sendCommand(id,QString::asprintf("CS %u %u +!",card,input));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::setOutputStatusFlagData(int id,unsigned card,unsigned port,
|
||||
unsigned stream,bool state)
|
||||
{
|
||||
/*
|
||||
output_status_flag[card][port][stream]=state;
|
||||
SendMeterOutputStatusUpdate(card,port,stream);
|
||||
cae_server->sendCommand(id,QString::asprintf("OS %u %u %u %u +!",
|
||||
card,port,stream,state));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -1043,9 +1264,10 @@ void MainObject::openRtpCaptureChannelData(int id,unsigned card,unsigned port,
|
||||
}
|
||||
|
||||
|
||||
void MainObject::meterEnableData(int id,uint16_t udp_port,
|
||||
void MainObject::meterEnableData(const QHostAddress &addr,uint16_t udp_port,
|
||||
const QList<unsigned> &cards)
|
||||
{
|
||||
/*
|
||||
QString cmd=QString::asprintf("ME %u",0xFFFF&udp_port);
|
||||
for(int i=0;i<cards.size();i++) {
|
||||
cmd+=QString::asprintf(" %u",cards.at(i));
|
||||
@ -1065,6 +1287,7 @@ void MainObject::meterEnableData(int id,uint16_t udp_port,
|
||||
|
||||
cae_server->sendCommand(id,cmd+" +!");
|
||||
SendMeterOutputStatusUpdate();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -1076,6 +1299,23 @@ void MainObject::connectionDroppedData(int id)
|
||||
|
||||
void MainObject::statePlayUpdate(int card,int stream,int state)
|
||||
{
|
||||
if(state==0) { // Stopped
|
||||
for(QMap<SessionId,Session *>::iterator it=cae_sessions.begin();
|
||||
it!=cae_sessions.end();it++) {
|
||||
if((it.value()->cardNumber()==card)&&
|
||||
(it.value()->streamNumber()==stream)) {
|
||||
cae_server->
|
||||
sendCommand(it.key(),QString::asprintf("SP %d %d",
|
||||
it.key().processId(),
|
||||
it.key().serialNumber()));
|
||||
delete it.value();
|
||||
cae_sessions.remove(it.key());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
printf("statePlayUpdate(%d,%d,%d)\n",card,stream,state);
|
||||
int handle=GetHandle(card,stream);
|
||||
|
||||
@ -1104,11 +1344,13 @@ void MainObject::statePlayUpdate(int card,int stream,int state)
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainObject::stateRecordUpdate(int card,int stream,int state)
|
||||
{
|
||||
/*
|
||||
if(record_owner[card][stream]!=-1) {
|
||||
switch(state) {
|
||||
case 0: // Recording
|
||||
@ -1133,6 +1375,7 @@ void MainObject::stateRecordUpdate(int card,int stream,int state)
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -1258,7 +1501,7 @@ void MainObject::InitMixers()
|
||||
{
|
||||
Driver *dvr=NULL;
|
||||
|
||||
updateAudioPortsData(-1);
|
||||
updateAudioPortsData();
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
if(dvr!=NULL) {
|
||||
for(int j=0;j<RD_MAX_PORTS;j++) {
|
||||
|
29
cae/cae.h
29
cae/cae.h
@ -2,7 +2,7 @@
|
||||
//
|
||||
// The Core Audio Engine component of Rivendell
|
||||
//
|
||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2023 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
|
||||
@ -41,6 +41,8 @@
|
||||
#include <mad.h>
|
||||
#endif // HAVE_MAD
|
||||
|
||||
#include <QMap>
|
||||
|
||||
#include <rd.h>
|
||||
#include <rdconfig.h>
|
||||
#include <rdstation.h>
|
||||
@ -70,6 +72,18 @@ class MainObject : public QObject
|
||||
MainObject(QObject *parent=0);
|
||||
|
||||
private slots:
|
||||
//
|
||||
// New Slots
|
||||
//
|
||||
void startPlaybackData(const SessionId &sid,const QString &cutname,
|
||||
unsigned cardnum,unsigned portnum,
|
||||
int start_pos,int end_pos,int speed);
|
||||
void playPositionData(const SessionId &sid,int position);
|
||||
void stopPlaybackData(const SessionId &sid);
|
||||
|
||||
//
|
||||
// Old Slots
|
||||
//
|
||||
void loadPlaybackData(int id,unsigned card,const QString &name);
|
||||
void unloadPlaybackData(int id,unsigned handle);
|
||||
void playPositionData(int id,unsigned handle,unsigned pos);
|
||||
@ -97,17 +111,20 @@ class MainObject : public QObject
|
||||
void setOutputModeData(int id,unsigned card,unsigned stream,unsigned mode);
|
||||
void setInputVoxLevelData(int id,unsigned card,unsigned stream,int level);
|
||||
void setInputTypeData(int id,unsigned card,unsigned port,unsigned type);
|
||||
void getInputStatusData(int id,unsigned card,unsigned port);
|
||||
void setAudioPassthroughLevelData(int id,unsigned card,unsigned input,
|
||||
void getInputStatusData(const SessionId &origin,
|
||||
unsigned card,unsigned port);
|
||||
void setAudioPassthroughLevelData(const QHostAddress &src_addr,
|
||||
unsigned card,unsigned input,
|
||||
unsigned output,int level);
|
||||
void updateAudioPortsData(int id);
|
||||
void updateAudioPortsData();
|
||||
void setClockSourceData(int id,unsigned card,int input);
|
||||
void setOutputStatusFlagData(int id,unsigned card,unsigned port,
|
||||
unsigned stream,bool state);
|
||||
void openRtpCaptureChannelData(int id,unsigned card,unsigned port,
|
||||
uint16_t udp_port,unsigned samprate,
|
||||
unsigned chans);
|
||||
void meterEnableData(int id,uint16_t udp_port,const QList<unsigned> &cards);
|
||||
void meterEnableData(const QHostAddress &addr,uint16_t udp_port,
|
||||
const QList<unsigned> &cards);
|
||||
void statePlayUpdate(int card,int stream,int state);
|
||||
void stateRecordUpdate(int card,int stream,int state);
|
||||
void updateMeters();
|
||||
@ -154,6 +171,8 @@ class MainObject : public QObject
|
||||
} play_handle[256];
|
||||
int next_play_handle;
|
||||
|
||||
QMap<SessionId,Session *> cae_sessions;
|
||||
|
||||
private:
|
||||
bool CheckLame();
|
||||
bool CheckMp4Decode();
|
||||
|
@ -21,8 +21,9 @@
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <qbytearray.h>
|
||||
#include <qstringlist.h>
|
||||
#include <QByteArray>
|
||||
#include <QNetworkDatagram>
|
||||
#include <QStringList>
|
||||
|
||||
#include <rdapplication.h>
|
||||
|
||||
@ -33,122 +34,98 @@
|
||||
//
|
||||
// #define __CAE_SERVER_LOG_PROTOCOL_MESSAGES
|
||||
|
||||
CaeServerConnection::CaeServerConnection(QTcpSocket *sock)
|
||||
{
|
||||
socket=sock;
|
||||
authenticated=false;
|
||||
accum="";
|
||||
meter_port=0;
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
meters_enabled[i]=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CaeServerConnection::~CaeServerConnection()
|
||||
{
|
||||
socket->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
CaeServer::CaeServer(RDConfig *config,QObject *parent)
|
||||
CaeServer::CaeServer(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
cae_config=config;
|
||||
|
||||
cae_server=new QTcpServer(this);
|
||||
connect(cae_server,SIGNAL(newConnection()),this,SLOT(newConnectionData()));
|
||||
|
||||
cae_ready_read_mapper=new QSignalMapper(this);
|
||||
connect(cae_ready_read_mapper,SIGNAL(mapped(int)),
|
||||
this,SLOT(readyReadData(int)));
|
||||
|
||||
cae_connection_closed_mapper=new QSignalMapper(this);
|
||||
connect(cae_connection_closed_mapper,SIGNAL(mapped(int)),
|
||||
this,SLOT(connectionClosedData(int)));
|
||||
d_server_socket=new QUdpSocket(this);
|
||||
connect(d_server_socket,SIGNAL(readyRead()),this,SLOT(readyReadData()));
|
||||
}
|
||||
|
||||
|
||||
QList<int> CaeServer::connectionIds() const
|
||||
{
|
||||
QList<int> ret;
|
||||
|
||||
/*
|
||||
for(QMap<int,CaeServerConnection *>::const_iterator it=
|
||||
cae_connections.begin();it!=cae_connections.end();it++) {
|
||||
ret.push_back(it.key());
|
||||
}
|
||||
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QHostAddress CaeServer::peerAddress(int id) const
|
||||
{
|
||||
return cae_connections[id]->socket->peerAddress();
|
||||
// return cae_connections[id]->socket->peerAddress();
|
||||
return QHostAddress();
|
||||
}
|
||||
|
||||
|
||||
uint16_t CaeServer::peerPort(int id) const
|
||||
{
|
||||
return cae_connections[id]->socket->peerPort();
|
||||
// return cae_connections[id]->socket->peerPort();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint16_t CaeServer::meterPort(int id) const
|
||||
{
|
||||
return cae_connections[id]->meter_port;
|
||||
// return cae_connections[id]->meter_port;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CaeServer::setMeterPort(int id,uint16_t port)
|
||||
{
|
||||
cae_connections[id]->meter_port=port;
|
||||
// cae_connections[id]->meter_port=port;
|
||||
}
|
||||
|
||||
|
||||
bool CaeServer::metersEnabled(int id,unsigned card) const
|
||||
{
|
||||
return cae_connections[id]->meters_enabled[card];
|
||||
// return cae_connections[id]->meters_enabled[card];
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CaeServer::setMetersEnabled(int id,unsigned card,bool state)
|
||||
{
|
||||
cae_connections[id]->meters_enabled[card]=state;
|
||||
// cae_connections[id]->meters_enabled[card]=state;
|
||||
}
|
||||
|
||||
|
||||
bool CaeServer::listen(const QHostAddress &addr,uint16_t port)
|
||||
{
|
||||
return cae_server->listen(addr,port);
|
||||
return d_server_socket->bind(port);
|
||||
}
|
||||
|
||||
|
||||
void CaeServer::sendCommand(const QString &cmd)
|
||||
{
|
||||
/*
|
||||
for(QMap<int,CaeServerConnection *>::const_iterator it=
|
||||
cae_connections.begin();it!=cae_connections.end();it++) {
|
||||
if(it.value()->authenticated) {
|
||||
sendCommand(it.key(),cmd);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void CaeServer::sendCommand(int id,const QString &cmd)
|
||||
void CaeServer::sendCommand(const SessionId &dest,const QString &cmd)
|
||||
{
|
||||
#ifdef __CAE_SERVER_LOG_PROTOCOL_MESSAGES
|
||||
RDApplication::syslog(cae_config,LOG_DEBUG,
|
||||
"send[%d]: %s",id,(const char *)cmd.toUtf8());
|
||||
rda->syslog(LOG_DEBUG,"sending \"%s\" to %s",
|
||||
cmd.toUtf8().constData(),dest.dump().toUtf8().constData());
|
||||
#endif // __CAE_SERVER_LOG_PROTOCOL_MESSAGES
|
||||
cae_connections.value(id)->socket->write(cmd.toUtf8());
|
||||
d_server_socket->writeDatagram(cmd.toUtf8(),dest.address(),dest.port());
|
||||
}
|
||||
|
||||
|
||||
void CaeServer::newConnectionData()
|
||||
{
|
||||
{/*
|
||||
QTcpSocket *sock=cae_server->nextPendingConnection();
|
||||
|
||||
cae_connection_closed_mapper->setMapping(sock,sock->socketDescriptor());
|
||||
@ -163,35 +140,21 @@ void CaeServer::newConnectionData()
|
||||
"added connection %d [%s:%u]",sock->socketDescriptor(),
|
||||
sock->peerAddress().toString().toUtf8().constData(),
|
||||
0xFFFF&sock->peerPort());
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void CaeServer::readyReadData(int id)
|
||||
void CaeServer::readyReadData()
|
||||
{
|
||||
QByteArray data=cae_connections.value(id)->socket->readAll();
|
||||
for(int i=0;i<data.size();i++) {
|
||||
char c=0xFF&data[i];
|
||||
switch(c) {
|
||||
case '!':
|
||||
if(ProcessCommand(id,cae_connections.value(id)->accum)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
case 13:
|
||||
break;
|
||||
|
||||
default:
|
||||
cae_connections.value(id)->accum+=c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
QNetworkDatagram dgram=d_server_socket->receiveDatagram(1500);
|
||||
ProcessCommand(dgram.senderAddress(),dgram.senderPort(),
|
||||
QString::fromUtf8(dgram.data()));
|
||||
}
|
||||
|
||||
|
||||
void CaeServer::connectionClosedData(int id)
|
||||
{
|
||||
/*
|
||||
QString logmsg=
|
||||
QString::asprintf("removed connection %d [%s:%u]",
|
||||
id,
|
||||
@ -212,11 +175,343 @@ void CaeServer::connectionClosedData(int id)
|
||||
cae_connections.remove(id);
|
||||
|
||||
RDApplication::syslog(cae_config,priority,"%s",logmsg.toUtf8().constData());
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
bool CaeServer::ProcessCommand(int id,const QString &cmd)
|
||||
bool CaeServer::ProcessCommand(const QHostAddress &src_addr,uint16_t src_port,
|
||||
const QString &cmd)
|
||||
{
|
||||
bool was_processed=false;
|
||||
bool ok=false;
|
||||
QStringList f0=cmd.split(" ",QString::SkipEmptyParts);
|
||||
pid_t pid;
|
||||
unsigned serial;
|
||||
QString cutname;
|
||||
unsigned cardnum;
|
||||
unsigned portnum;
|
||||
int start_pos;
|
||||
int end_pos;
|
||||
int position;
|
||||
int speed;
|
||||
int level;
|
||||
int length;
|
||||
int threshold;
|
||||
int coding;
|
||||
int channels;
|
||||
int bitrate;
|
||||
SessionId origin(src_addr,src_port);
|
||||
|
||||
//
|
||||
// Playback Operations
|
||||
//
|
||||
if((f0.at(0)=="PY")&&(f0.size()==9)) { // Start Playback
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
cutname=f0.at(3);
|
||||
if(cutname.length()==10) {
|
||||
cardnum=f0.at(4).toUInt(&ok);
|
||||
if(ok&&(cardnum<RD_MAX_CARDS)) {
|
||||
portnum=f0.at(5).toInt(&ok);
|
||||
if(ok&&(portnum<RD_MAX_PORTS)) {
|
||||
start_pos=f0.at(6).toInt(&ok);
|
||||
if(ok&&(start_pos>=0)) {
|
||||
end_pos=f0.at(7).toInt(&ok);
|
||||
if(ok&&(end_pos>=0)&&(end_pos>=start_pos)) {
|
||||
speed=f0.at(8).toInt(&ok);
|
||||
if(ok&&(speed>0)) {
|
||||
emit startPlaybackReq(origin,cutname,cardnum,portnum,
|
||||
start_pos,end_pos,speed);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="PP")&&(f0.size()==4)) { // Play Position
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
position=f0.at(3).toInt(&ok);
|
||||
if(ok&&(position>=0)) {
|
||||
emit playPositionReq(origin,position);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="PE")&&(f0.size()==3)) { // Pause Playback
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
emit playPauseReq(origin);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="PR")&&(f0.size()==3)) { // Resume Playback
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
emit playResumeReq(origin);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="SP")&&(f0.size()==3)) { // Stop Playback
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
emit playStopReq(origin);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="OV")&&(f0.size()==4)) { // Set Output Volume
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
level=f0.at(3).toInt(&ok);
|
||||
if(ok) {
|
||||
emit playSetOutputVolumeReq(origin,level);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="FV")&&(f0.size()==5)) { // Fade Output Volume
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
level=f0.at(3).toInt(&ok);
|
||||
if(ok) {
|
||||
length=f0.at(4).toInt(&ok);
|
||||
if(ok&&length>=0) {
|
||||
emit playFadeOutputVolumeReq(origin,level,length);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Record Operations
|
||||
//
|
||||
if((f0.at(0)=="LR")&&(f0.size()==10)) { // Cue Recording
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
cutname=f0.at(3);
|
||||
if(cutname.length()==10) {
|
||||
cardnum=f0.at(4).toUInt(&ok);
|
||||
if(ok&&(cardnum<RD_MAX_CARDS)) {
|
||||
portnum=f0.at(5).toInt(&ok);
|
||||
if(ok&&(portnum<RD_MAX_PORTS)) {
|
||||
coding=f0.at(6).toInt(&ok);
|
||||
if(ok&&(coding>=0)&&(coding<=4)) {
|
||||
channels=f0.at(7).toInt(&ok);
|
||||
if(ok&&(channels>0)) {
|
||||
bitrate=f0.at(8).toInt(&ok);
|
||||
if(ok&&(bitrate>=0)) {
|
||||
emit recordCueReq(origin,cutname,cardnum,portnum,
|
||||
coding,channels,bitrate);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="RD")&&(f0.size()==5)) { // Start Recording
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
length=f0.at(3).toInt(&ok);
|
||||
if(ok&&(length>=0)) {
|
||||
threshold=f0.at(4).toInt(&ok);
|
||||
if(ok&&(threshold<=0)) {
|
||||
emit recordStartReq(origin,length,threshold);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="RC")&&(f0.size()==11)) { // Cue and Start Recording
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
cutname=f0.at(3);
|
||||
if(cutname.length()==10) {
|
||||
cardnum=f0.at(4).toUInt(&ok);
|
||||
if(ok&&(cardnum<RD_MAX_CARDS)) {
|
||||
portnum=f0.at(5).toInt(&ok);
|
||||
if(ok&&(portnum<RD_MAX_PORTS)) {
|
||||
coding=f0.at(6).toInt(&ok);
|
||||
if(ok&&(coding>=0)&&(coding<=4)) {
|
||||
channels=f0.at(7).toInt(&ok);
|
||||
if(ok&&(channels>0)) {
|
||||
bitrate=f0.at(8).toInt(&ok);
|
||||
if(ok&&(bitrate>=0)) {
|
||||
length=f0.at(9).toInt(&ok);
|
||||
if(ok&&(length>=0)) {
|
||||
threshold=f0.at(10).toInt(&ok);
|
||||
if(ok&&(threshold<=0)) {
|
||||
emit recordCueAndStartReq(origin,cutname,
|
||||
cardnum,portnum,
|
||||
coding,channels,bitrate,
|
||||
length,threshold);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="SR")&&(f0.size()==3)) { // Stop Recording
|
||||
pid=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(pid>0)) {
|
||||
origin.setProcessId(pid);
|
||||
serial=f0.at(2).toUInt(&ok);
|
||||
if(ok) {
|
||||
origin.setSerialNumber(serial);
|
||||
emit recordStopReq(origin);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Mixer Operations
|
||||
//
|
||||
if((f0.at(0)=="IS")&&(f0.size()==3)) { // Get Input Status
|
||||
unsigned card=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(card<RD_MAX_CARDS)) {
|
||||
unsigned port=f0.at(2).toUInt(&ok);
|
||||
if(ok&&(port<RD_MAX_PORTS)) {
|
||||
emit getInputStatusReq(origin,card,port);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((f0.at(0)=="AL")&&(f0.size()==5)) { // Set Audio Passthrough Level
|
||||
unsigned card=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(card<RD_MAX_CARDS)) {
|
||||
unsigned input=f0.at(2).toUInt(&ok);
|
||||
if(ok&&(input<RD_MAX_PORTS)) {
|
||||
unsigned output=f0.at(3).toUInt(&ok);
|
||||
if(ok&&(output<RD_MAX_PORTS)) {
|
||||
int level=f0.at(4).toInt(&ok);
|
||||
if(ok) {
|
||||
if(level<RD_MUTE_DEPTH) {
|
||||
level=RD_MUTE_DEPTH;
|
||||
}
|
||||
emit setAudioPassthroughLevelReq(origin.address(),
|
||||
card,input,output,level);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(f0.at(0)=="AP") { // Update Audio Ports
|
||||
emit updateAudioPortsReq();
|
||||
was_processed=true;
|
||||
}
|
||||
|
||||
//
|
||||
// External Operations
|
||||
//
|
||||
if(f0.at(0)=="CO") { // Open RTP Capture Channel
|
||||
}
|
||||
|
||||
//
|
||||
// Meter Commands
|
||||
//
|
||||
/*
|
||||
* This needs to die!
|
||||
* Replace with multicast meter system.
|
||||
*
|
||||
if(f0.at(0)=="ME") { // Meter Enable
|
||||
if(f0.size()>2) { // So we don't warn if no cards are specified
|
||||
uint16_t udp_port=0xFFFF&f0.at(1).toUInt(&ok);
|
||||
if(ok) {
|
||||
QList<unsigned> cards;
|
||||
for(int i=2;i<f0.size();i++) {
|
||||
cards.push_back(f0.at(i).toUInt());
|
||||
}
|
||||
emit meterEnableReq(src_addr,udp_port,cards);
|
||||
}
|
||||
}
|
||||
was_processed=true;
|
||||
}
|
||||
*/
|
||||
|
||||
if(!was_processed) {
|
||||
rda->syslog(LOG_WARNING,
|
||||
"%s sent malformed command \"%s\"",
|
||||
origin.dump().toUtf8().constData(),
|
||||
cmd.toUtf8().constData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// rda->syslog(LOG_NOTICE,"processing command: \"%s\"",cmd.toUtf8().constData());
|
||||
CaeServerConnection *conn=cae_connections.value(id);
|
||||
bool ok=false;
|
||||
@ -465,25 +760,6 @@ bool CaeServer::ProcessCommand(int id,const QString &cmd)
|
||||
}
|
||||
}
|
||||
}
|
||||
if((f0.at(0)=="AL")&&(f0.size()==5)) { // Set Audio Passthrough Level
|
||||
unsigned card=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(card<RD_MAX_CARDS)) {
|
||||
unsigned input=f0.at(2).toUInt(&ok);
|
||||
if(ok&&(input<RD_MAX_PORTS)) {
|
||||
unsigned output=f0.at(3).toUInt(&ok);
|
||||
if(ok&&(output<RD_MAX_PORTS)) {
|
||||
int level=f0.at(4).toInt(&ok);
|
||||
if(ok) {
|
||||
emit setAudioPassthroughLevelReq(id,card,input,output,level);
|
||||
was_processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if((f0.at(0)=="AP")&&(f0.size()==1)) { // Update Audio Ports
|
||||
emit updateAudioPortsReq(id);
|
||||
}
|
||||
if((f0.at(0)=="OS")&&(f0.size()==5)) { // Set Output Status Flag
|
||||
unsigned card=f0.at(1).toUInt(&ok);
|
||||
if(ok&&(card<RD_MAX_CARDS)) {
|
||||
@ -497,29 +773,6 @@ bool CaeServer::ProcessCommand(int id,const QString &cmd)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(f0.at(0)=="ME") { // Meter Enable
|
||||
if(f0.size()>2) { // So we don't warn if no cards are specified
|
||||
uint16_t udp_port=0xFFFF&f0.at(1).toUInt(&ok);
|
||||
if(ok) {
|
||||
QList<unsigned> cards;
|
||||
for(int i=2;i<f0.size();i++) {
|
||||
cards.push_back(f0.at(i).toUInt());
|
||||
}
|
||||
emit meterEnableReq(id,udp_port,cards);
|
||||
}
|
||||
}
|
||||
was_processed=true;
|
||||
}
|
||||
|
||||
if(!was_processed) { // Send generic error response
|
||||
sendCommand(id,f0.join(" ")+"-!");
|
||||
RDApplication::syslog(cae_config,LOG_WARNING,
|
||||
"connection %d [%s:%u] sent unrecognized command \"%s\"",
|
||||
id,
|
||||
peerAddress(id).toString().toUtf8().constData(),
|
||||
0xFFFF&peerPort(id),
|
||||
cmdstr.toUtf8().constData());
|
||||
}
|
||||
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
@ -23,35 +23,21 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <qlist.h>
|
||||
#include <qmap.h>
|
||||
#include <qobject.h>
|
||||
#include <qsignalmapper.h>
|
||||
#include <qtcpserver.h>
|
||||
#include <qtcpsocket.h>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QSignalMapper>
|
||||
#include <QUdpSocket>
|
||||
|
||||
#include <rdconfig.h>
|
||||
|
||||
class CaeServerConnection
|
||||
{
|
||||
public:
|
||||
CaeServerConnection(QTcpSocket *sock);
|
||||
~CaeServerConnection();
|
||||
QTcpSocket *socket;
|
||||
bool authenticated;
|
||||
QString accum;
|
||||
uint16_t meter_port;
|
||||
bool meters_enabled[RD_MAX_CARDS];
|
||||
};
|
||||
|
||||
|
||||
|
||||
#include "session.h"
|
||||
|
||||
class CaeServer : public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
CaeServer(RDConfig *config,QObject *parent=0);
|
||||
CaeServer(QObject *parent=0);
|
||||
QList<int> connectionIds() const;
|
||||
QHostAddress peerAddress(int id) const;
|
||||
uint16_t peerPort(int id) const;
|
||||
@ -61,10 +47,42 @@ class CaeServer : public QObject
|
||||
void setMetersEnabled(int id,unsigned card,bool state);
|
||||
bool listen(const QHostAddress &addr,uint16_t port);
|
||||
void sendCommand(const QString &cmd);
|
||||
void sendCommand(int id,const QString &cmd);
|
||||
void sendCommand(const SessionId &dest,const QString &cmd);
|
||||
|
||||
signals:
|
||||
void connectionDropped(int id);
|
||||
|
||||
//
|
||||
// New Signals
|
||||
//
|
||||
void startPlaybackReq(const SessionId &sid,const QString &cutname,
|
||||
unsigned cardnum,unsigned portnum,
|
||||
int start_pos,int end_pos,int speed);
|
||||
void playPositionReq(const SessionId &sid,int position);
|
||||
void playPauseReq(const SessionId &sid);
|
||||
void playResumeReq(const SessionId &sid);
|
||||
void playStopReq(const SessionId &sid);
|
||||
void playSetOutputVolumeReq(const SessionId &sid,int level);
|
||||
void playFadeOutputVolumeReq(const SessionId &sid,int level,int length);
|
||||
void recordCueReq(const SessionId &sid,const QString &cutname,
|
||||
unsigned cardnum,unsigned portnum,
|
||||
int coding,int channels,int bitrate);
|
||||
void recordStartReq(const SessionId &sid,int length,int threshold);
|
||||
void recordCueAndStartReq(const SessionId &sid,const QString &cutname,
|
||||
unsigned cardnum,unsigned portnum,
|
||||
int coding,int channels,int bitrate,
|
||||
int length,int threshold);
|
||||
void recordStopReq(const SessionId &sid);
|
||||
void getInputStatusReq(const SessionId &origin,
|
||||
unsigned card,unsigned port);
|
||||
void setAudioPassthroughLevelReq(const QHostAddress &src_addr,
|
||||
unsigned card,unsigned input,
|
||||
unsigned output,int level);
|
||||
void updateAudioPortsReq();
|
||||
|
||||
//
|
||||
// Old Signals
|
||||
//
|
||||
void loadPlaybackReq(int id,unsigned card,const QString &name);
|
||||
void unloadPlaybackReq(int id,unsigned handle);
|
||||
void playPositionReq(int id,unsigned handle,unsigned pos);
|
||||
@ -85,28 +103,23 @@ class CaeServer : public QObject
|
||||
int level);
|
||||
void fadeOutputVolumeReq(int id,unsigned card,unsigned stream,unsigned port,
|
||||
int level,unsigned length);
|
||||
void getInputStatusReq(int id,unsigned card,unsigned port);
|
||||
void setAudioPassthroughLevelReq(int id,unsigned card,unsigned input,
|
||||
unsigned output,int level);
|
||||
void updateAudioPortsReq(int id);
|
||||
void setOutputStatusFlagReq(int id,unsigned card,unsigned port,
|
||||
unsigned stream,bool state);
|
||||
void openRtpCaptureChannelReq(int id,unsigned card,unsigned port,uint16_t udp_port,
|
||||
unsigned samprate,unsigned chans);
|
||||
void meterEnableReq(int id,uint16_t udp_port,const QList<unsigned> &cards);
|
||||
void meterEnableReq(const QHostAddress &addr,uint16_t udp_port,
|
||||
const QList<unsigned> &cards);
|
||||
|
||||
private slots:
|
||||
void newConnectionData();
|
||||
void readyReadData(int id);
|
||||
void readyReadData();
|
||||
void connectionClosedData(int id);
|
||||
|
||||
private:
|
||||
bool ProcessCommand(int id,const QString &cmd);
|
||||
QMap<int,CaeServerConnection *> cae_connections;
|
||||
QTcpServer *cae_server;
|
||||
bool ProcessCommand(const QHostAddress &src_addr,uint16_t src_port,
|
||||
const QString &cmd);
|
||||
QSignalMapper *cae_ready_read_mapper;
|
||||
QSignalMapper *cae_connection_closed_mapper;
|
||||
RDConfig *cae_config;
|
||||
QUdpSocket *d_server_socket;
|
||||
};
|
||||
|
||||
|
||||
|
231
cae/session.cpp
Normal file
231
cae/session.cpp
Normal file
@ -0,0 +1,231 @@
|
||||
// session.cpp
|
||||
//
|
||||
// Persistent context for CAE protocol commands
|
||||
//
|
||||
// (C) Copyright 2023 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 "session.h"
|
||||
|
||||
SessionId::SessionId(const QHostAddress &addr,uint16_t port,int pid,int serial)
|
||||
{
|
||||
d_address=addr;
|
||||
d_port=port;
|
||||
d_process_id=pid;
|
||||
d_serial_number=serial;
|
||||
}
|
||||
|
||||
|
||||
SessionId::SessionId()
|
||||
{
|
||||
d_port=0;
|
||||
d_process_id=0;
|
||||
d_serial_number=0;
|
||||
}
|
||||
|
||||
|
||||
QHostAddress SessionId::address() const
|
||||
{
|
||||
return d_address;
|
||||
}
|
||||
|
||||
|
||||
uint16_t SessionId::port() const
|
||||
{
|
||||
return d_port;
|
||||
}
|
||||
|
||||
|
||||
int SessionId::processId() const
|
||||
{
|
||||
return d_process_id;
|
||||
}
|
||||
|
||||
|
||||
void SessionId::setProcessId(int pid)
|
||||
{
|
||||
d_process_id=pid;
|
||||
}
|
||||
|
||||
|
||||
int SessionId::serialNumber() const
|
||||
{
|
||||
return d_serial_number;
|
||||
}
|
||||
|
||||
|
||||
void SessionId::setSerialNumber(int serial)
|
||||
{
|
||||
d_serial_number=serial;
|
||||
}
|
||||
|
||||
|
||||
QString SessionId::dump() const
|
||||
{
|
||||
return address().toString()+
|
||||
QString::asprintf(":%d:%d:%d",0xFFFF&port(),processId(),serialNumber());
|
||||
}
|
||||
|
||||
|
||||
bool SessionId::operator<(const SessionId &other) const
|
||||
{
|
||||
if(other.d_address!=d_address) {
|
||||
return other.d_address.toIPv4Address()<d_address.toIPv4Address();
|
||||
}
|
||||
if(other.d_port!=d_port) {
|
||||
return other.d_port<d_port;
|
||||
}
|
||||
if(other.d_process_id!=d_process_id) {
|
||||
return other.d_process_id<d_process_id;
|
||||
}
|
||||
return other.d_serial_number<d_serial_number;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Session::Session(const QHostAddress &addr,uint16_t port,int pid,int serial)
|
||||
{
|
||||
d_session_id=SessionId(addr,port,pid,serial);
|
||||
|
||||
d_card_number=-1;
|
||||
d_port_number=-1;
|
||||
d_stream_number=-1;
|
||||
d_start_position=-1;
|
||||
d_end_position=-1;
|
||||
d_speed=100000;
|
||||
|
||||
d_meter_port=0;
|
||||
d_meters_enabled=false;
|
||||
}
|
||||
|
||||
|
||||
Session::Session(const SessionId &sid)
|
||||
{
|
||||
d_session_id=sid;
|
||||
|
||||
d_card_number=-1;
|
||||
d_port_number=-1;
|
||||
d_stream_number=-1;
|
||||
d_start_position=-1;
|
||||
d_end_position=-1;
|
||||
d_speed=100000;
|
||||
|
||||
d_meter_port=0;
|
||||
d_meters_enabled=false;
|
||||
}
|
||||
|
||||
|
||||
SessionId Session::sessionId() const
|
||||
{
|
||||
return d_session_id;
|
||||
}
|
||||
|
||||
|
||||
int Session::cardNumber() const
|
||||
{
|
||||
return d_card_number;
|
||||
}
|
||||
|
||||
|
||||
void Session::setCardNumber(int cardnum)
|
||||
{
|
||||
d_card_number=cardnum;
|
||||
}
|
||||
|
||||
|
||||
int Session::portNumber() const
|
||||
{
|
||||
return d_port_number;
|
||||
}
|
||||
|
||||
|
||||
void Session::setPortNumber(int portnum)
|
||||
{
|
||||
d_port_number=portnum;
|
||||
}
|
||||
|
||||
|
||||
int Session::streamNumber() const
|
||||
{
|
||||
return d_stream_number;
|
||||
}
|
||||
|
||||
|
||||
void Session::setStreamNumber(int streamnum)
|
||||
{
|
||||
d_stream_number=streamnum;
|
||||
}
|
||||
|
||||
|
||||
int Session::startPosition() const
|
||||
{
|
||||
return d_start_position;
|
||||
}
|
||||
|
||||
|
||||
void Session::setStartPosition(int pos)
|
||||
{
|
||||
d_start_position=pos;
|
||||
}
|
||||
|
||||
|
||||
int Session::endPosition() const
|
||||
{
|
||||
return d_end_position;
|
||||
}
|
||||
|
||||
|
||||
void Session::setEndPosition(int pos)
|
||||
{
|
||||
d_end_position=pos;
|
||||
}
|
||||
|
||||
|
||||
int Session::speed() const
|
||||
{
|
||||
return d_speed;
|
||||
}
|
||||
|
||||
|
||||
void Session::setSpeed(int speed)
|
||||
{
|
||||
d_speed=speed;
|
||||
}
|
||||
|
||||
|
||||
uint16_t Session::meterPort() const
|
||||
{
|
||||
return d_meter_port;
|
||||
}
|
||||
|
||||
|
||||
void Session::setMeterPort(uint16_t port)
|
||||
{
|
||||
d_meter_port=port;
|
||||
}
|
||||
|
||||
|
||||
bool Session::metersEnabled()
|
||||
{
|
||||
return d_meters_enabled;
|
||||
}
|
||||
|
||||
|
||||
void Session::setMetersEnabled(bool state)
|
||||
{
|
||||
d_meters_enabled=state;
|
||||
}
|
88
cae/session.h
Normal file
88
cae/session.h
Normal file
@ -0,0 +1,88 @@
|
||||
// session.h
|
||||
//
|
||||
// Persistent context for CAE protocol commands
|
||||
//
|
||||
// (C) Copyright 2023 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 SESSION_H
|
||||
#define SESSION_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QHostAddress>
|
||||
|
||||
class SessionId
|
||||
{
|
||||
public:
|
||||
SessionId(const QHostAddress &addr,uint16_t port,int pid=0,int serial=0);
|
||||
SessionId();
|
||||
QHostAddress address() const;
|
||||
uint16_t port() const;
|
||||
int processId() const;
|
||||
void setProcessId(int pid);
|
||||
int serialNumber() const;
|
||||
void setSerialNumber(int serial);
|
||||
QString dump() const;
|
||||
bool operator<(const SessionId &other) const;
|
||||
|
||||
private:
|
||||
QHostAddress d_address;
|
||||
uint16_t d_port;
|
||||
int d_process_id;
|
||||
int d_serial_number;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class Session
|
||||
{
|
||||
public:
|
||||
Session(const QHostAddress &addr,uint16_t port,int pid,int serial);
|
||||
Session(const SessionId &sid);
|
||||
SessionId sessionId() const;
|
||||
int cardNumber() const;
|
||||
void setCardNumber(int cardnum);
|
||||
int portNumber() const;
|
||||
void setPortNumber(int portnum);
|
||||
int streamNumber() const;
|
||||
void setStreamNumber(int streamnum);
|
||||
uint16_t meterPort() const;
|
||||
void setMeterPort(uint16_t port);
|
||||
int startPosition() const;
|
||||
void setStartPosition(int pos);
|
||||
int endPosition() const;
|
||||
void setEndPosition(int pos);
|
||||
int speed() const;
|
||||
void setSpeed(int speed);
|
||||
bool metersEnabled();
|
||||
void setMetersEnabled(bool state);
|
||||
|
||||
private:
|
||||
SessionId d_session_id;
|
||||
int d_card_number;
|
||||
int d_port_number;
|
||||
int d_stream_number;
|
||||
int d_start_position;
|
||||
int d_end_position;
|
||||
int d_speed;
|
||||
uint16_t d_meter_port;
|
||||
bool d_meters_enabled;
|
||||
};
|
||||
|
||||
|
||||
#endif // SESSION_H
|
@ -158,8 +158,6 @@
|
||||
PY
|
||||
<replaceable>pid</replaceable>
|
||||
<replaceable>serial</replaceable>
|
||||
<replaceable>pid</replaceable>
|
||||
<replaceable>serial</replaceable>
|
||||
<replaceable>cut-name</replaceable>
|
||||
<replaceable>card-num</replaceable>
|
||||
<replaceable>port-num</replaceable>
|
||||
@ -649,6 +647,7 @@
|
||||
<replaceable>port-num</replaceable>
|
||||
<replaceable>coding</replaceable>
|
||||
<replaceable>channels</replaceable>
|
||||
<replaceable>bit-rate</replaceable>
|
||||
</userinput>
|
||||
</para>
|
||||
<variablelist>
|
||||
@ -725,16 +724,6 @@
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<replaceable>samp-rate</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Sample Rate in samples/sec. 32000, 44100 or 48000 supported.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<replaceable>bit-rate</replaceable>
|
||||
@ -831,6 +820,7 @@
|
||||
<replaceable>port-num</replaceable>
|
||||
<replaceable>coding</replaceable>
|
||||
<replaceable>channels</replaceable>
|
||||
<replaceable>bit-rate</replaceable>
|
||||
<replaceable>length</replaceable>
|
||||
<replaceable>threshold</replaceable>
|
||||
</userinput>
|
||||
@ -908,16 +898,6 @@
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<replaceable>samp-rate</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Sample Rate in samples/sec. 32000, 44100 or 48000 supported.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<replaceable>bit-rate</replaceable>
|
||||
@ -1079,8 +1059,6 @@
|
||||
<para>
|
||||
<userinput>
|
||||
IS
|
||||
<replaceable>pid</replaceable>
|
||||
<replaceable>serial</replaceable>
|
||||
<replaceable>card-num</replaceable>
|
||||
<replaceable>port-num</replaceable>
|
||||
</userinput>
|
||||
@ -1118,8 +1096,6 @@
|
||||
<para>
|
||||
<userinput>
|
||||
AL
|
||||
<replaceable>pid</replaceable>
|
||||
<replaceable>serial</replaceable>
|
||||
<replaceable>card-num</replaceable>
|
||||
<replaceable>input-num</replaceable>
|
||||
<replaceable>output-num</replaceable>
|
||||
@ -1352,10 +1328,13 @@
|
||||
card(s).
|
||||
</para>
|
||||
<para>
|
||||
<userinput>ME
|
||||
<replaceable>udp-port</replaceable>
|
||||
<replaceable>card0</replaceable>
|
||||
<replaceable>..</replaceable>!</userinput>
|
||||
<userinput>
|
||||
ME
|
||||
<replaceable>udp-port</replaceable>
|
||||
[<replaceable>card0</replaceable>]
|
||||
<replaceable>..</replaceable>
|
||||
[<replaceable>cardN</replaceable>]
|
||||
</userinput>
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -659,7 +659,7 @@ void RecordCut::playData()
|
||||
rda->cae()->positionPlay(rec_play_handle,start);
|
||||
rda->cae()->setPlayPortActive(rec_card_no[1],rec_port_no[1],rec_stream_no[1]);
|
||||
rda->cae()->setOutputVolume(rec_card_no[1],rec_stream_no[1],rec_port_no[1],
|
||||
0+rec_cut->playGain());
|
||||
0+rec_cut->playGain());
|
||||
rda->cae()->play(rec_play_handle,end-start,RD_TIMESCALE_DIVISOR,false);
|
||||
}
|
||||
if(is_ready&&(!is_recording)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user