2022-11-02 Fred Gleason <fredg@paravelsystems.com>

* Refactored rdcatch(1) and rdcatchd(8) to use the notification
	mechanism instead for distributing meter updates instead of the
	'Enable Metering' catch command.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-11-02 13:10:11 -04:00
parent 54d8bd4a10
commit ae3542f9a4
10 changed files with 247 additions and 34 deletions

View File

@@ -205,7 +205,7 @@ void DeckMon::setStatus(RDDeck::Status status,int id,const QString &cutname)
}
}
/*
void DeckMon::setLeftMeter(int level)
{
mon_left_meter->setPeakBar(level);
@@ -216,19 +216,39 @@ void DeckMon::setRightMeter(int level)
{
mon_right_meter->setPeakBar(level);
}
*/
void DeckMon::processCatchEvent(RDCatchEvent *evt)
{
if((evt->hostName()==mon_station)&&(evt->deckChannel()==mon_channel)) {
// printf("processCatchEvent(): %s\n",evt->dump().toUtf8().constData());
QList<RDCatchMeterLevel> meter_levels;
if(evt->hostName()==mon_station) {
switch(evt->operation()) {
case RDCatchEvent::DeckEventProcessedOp:
mon_event_light->trigger(evt->eventNumber());
if(evt->deckChannel()==mon_channel) {
mon_event_light->trigger(evt->eventNumber());
}
break;
case RDCatchEvent::DeckStatusResponseOp:
setStatus(evt->deckStatus(),evt->eventId(),
RDCut::cutName(evt->cartNumber(),evt->cutNumber()));
if(evt->deckChannel()==mon_channel) {
setStatus(evt->deckStatus(),evt->eventId(),
RDCut::cutName(evt->cartNumber(),evt->cutNumber()));
}
break;
case RDCatchEvent::SendMeterLevelsOp:
meter_levels=evt->meterLevels();
for(int i=0;i<meter_levels.size();i++) {
if(meter_levels.at(i).deckChannel()==mon_channel) {
mon_left_meter->
setPeakBar(meter_levels.at(i).level(RDCatchMeterLevel::Left));
mon_right_meter->
setPeakBar(meter_levels.at(i).level(RDCatchMeterLevel::Right));
}
}
break;
case RDCatchEvent::SetInputMonitorResponseOp:
@@ -248,6 +268,7 @@ void DeckMon::processCatchEvent(RDCatchEvent *evt)
break;
case RDCatchEvent::DeckStatusQueryOp:
case RDCatchEvent::ReloadDecksOp:
case RDCatchEvent::StopDeckOp:
case RDCatchEvent::SetInputMonitorOp:
case RDCatchEvent::NullOp:

View File

@@ -43,8 +43,8 @@ class DeckMon : public RDFrame
public slots:
void setStatus(RDDeck::Status status,int id,const QString &cutname);
void setLeftMeter(int level);
void setRightMeter(int level);
// void setLeftMeter(int level);
// void setRightMeter(int level);
void processCatchEvent(RDCatchEvent *evt);
protected:

View File

@@ -195,9 +195,11 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
connect(catch_connect.back()->connector(),
SIGNAL(connected(int,bool)),
this,SLOT(connectedData(int,bool)));
/*
connect(catch_connect.back()->connector(),
SIGNAL(meterLevel(int,int,int,int)),
this,SLOT(meterLevelData(int,int,int,int)));
*/
catch_connect.back()->connector()->
connectHost(q->value(1).toString(),RDCATCHD_TCP_PORT,
rda->config()->password());
@@ -754,6 +756,7 @@ void MainWidget::catchEventReceivedData(RDCatchEvent *evt)
switch(evt->operation()) {
case RDCatchEvent::DeckStatusResponseOp:
printf("catchEventReceivedData(): %s\n",evt->dump().toUtf8().constData());
if(evt->eventId()>0) {
if(!catch_recordings_model->refresh(evt->eventId())) {
catch_recordings_model->addRecord(evt->eventId());
@@ -765,6 +768,8 @@ void MainWidget::catchEventReceivedData(RDCatchEvent *evt)
case RDCatchEvent::DeckEventProcessedOp:
case RDCatchEvent::DeckStatusQueryOp:
case RDCatchEvent::StopDeckOp:
case RDCatchEvent::ReloadDecksOp:
case RDCatchEvent::SendMeterLevelsOp:
case RDCatchEvent::SetInputMonitorOp:
case RDCatchEvent::SetInputMonitorResponseOp:
case RDCatchEvent::NullOp:
@@ -900,7 +905,7 @@ void MainWidget::playStoppedData(int handle)
rda->cae()->unloadPlay(catch_play_handle);
}
/*
void MainWidget::meterLevelData(int serial,int deck,int l_r,int level)
{
DeckMon *monitor;
@@ -918,7 +923,7 @@ void MainWidget::meterLevelData(int serial,int deck,int l_r,int level)
}
}
}
*/
void MainWidget::selectionChangedData(const QItemSelection &before,
const QItemSelection &after)

View File

@@ -90,7 +90,7 @@ class MainWidget : public RDMainWindow
void initData(bool);
void playedData(int);
void playStoppedData(int);
void meterLevelData(int,int,int,int);
// void meterLevelData(int,int,int,int);
void selectionChangedData(const QItemSelection &before,
const QItemSelection &after);
void doubleClickedData(const QModelIndex &index);

View File

@@ -637,12 +637,14 @@ void RecordListModel::updateRow(int row,RDSqlQuery *q)
//
// Qt::BackgroundRole:
//
if(q->value(25).toInt()==0) {
d_back_colors[row]=QVariant();
if(d_statuses.at(row)==RDDeck::Idle) { // So we don't trump a realtime status
if(q->value(25).toInt()==0) {
d_back_colors[row]=QVariant();
}
else {
d_back_colors[row]=QColor(EVENT_ERROR_COLOR);
}
}
else {
d_back_colors[row]=QColor(EVENT_ERROR_COLOR);
}
//
// Qt::DecorationType
@@ -949,6 +951,9 @@ QString RecordListModel::GetDestinationName(QString station,int matrix,
void RecordListModel::UpdateStatus(int line)
{
printf("RecordListModel::UpdateStatus(%d)\n",line);
printf(" using status: %u\n",d_statuses.at(line));
switch(d_statuses.at(line)) {
case RDDeck::Offline:
case RDDeck::LastStatus:
@@ -972,6 +977,8 @@ void RecordListModel::UpdateStatus(int line)
break;
}
return;
RDRecording::ExitCode code=RDRecording::InternalError;
QString err_text=tr("Unknown");