diff --git a/ChangeLog b/ChangeLog index dea0176e..7aa0290f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23604,3 +23604,7 @@ catch command. 2022-11-01 Fred Gleason * Added a 'Reload Decks' operation to 'RDCatchEvent'. +2022-11-02 Fred Gleason + * Refactored rdcatch(1) and rdcatchd(8) to use the notification + mechanism instead for distributing meter updates instead of the + 'Enable Metering' catch command. diff --git a/docs/apis/notification.xml b/docs/apis/notification.xml index cd4ec1d1..2da97a47 100644 --- a/docs/apis/notification.xml +++ b/docs/apis/notification.xml @@ -655,14 +655,14 @@ - - Stop Deck Operation + + Send Meter Levels Operation - Emitted by rdcatch1 to - abort a Record or Play-out event. + Emitted by rdcatchd8 to + update audio meter levels for active record and play-out decks. - - RDCatch Stop Deck Fields +
+ RDCatch Send Meter Levels Fields @@ -686,20 +686,12 @@ Operation 2 - Integer. 4 [RDCatchEvent::StopDeckOp] + Integer. 8 [RDCatchEvent::SendMeterLevelsOp] - Target Hostname + Meter Entry 3 - String, from STATIONS.NAME - - - Deck Channel - 4 - - Integer. Record decks have values in the range 1-127, - while play decks have values in the range 128-254. - + String, chan:left-lvl:right-lvl @@ -817,6 +809,57 @@
+ + Stop Deck Operation + + Emitted by rdcatch1 to + abort a Record or Play-out event. + + + RDCatch Stop Deck Fields + + + + + + + Field + Offset + Value + + + Keyword + 0 + CATCH + + + Originating Hostname + 1 + String, from STATIONS.NAME + + + Operation + 2 + Integer. 4 [RDCatchEvent::StopDeckOp] + + + Target Hostname + 3 + String, from STATIONS.NAME + + + Deck Channel + 4 + + Integer. Record decks have values in the range 1-127, + while play decks have values in the range 128-254. + + + + +
+
+ diff --git a/lib/rdcatchevent.cpp b/lib/rdcatchevent.cpp index 9b68538d..901e8e43 100644 --- a/lib/rdcatchevent.cpp +++ b/lib/rdcatchevent.cpp @@ -23,6 +23,43 @@ #include "rdcatchevent.h" #include "rdapplication.h" +RDCatchMeterLevel::RDCatchMeterLevel(int deck,int16_t *lvls) +{ + d_deck_channel=deck; + for(int i=0;i RDCatchEvent::meterLevels() const +{ + return d_meter_levels; +} + + +void RDCatchEvent::setMeterLevels(const QList &lvls) +{ + d_meter_levels=lvls; +} + + bool RDCatchEvent::read(const QString &str) { // printf("RDCatchEvent::read(\"%s\")\n",str.toUtf8().constData()); @@ -205,6 +254,32 @@ bool RDCatchEvent::read(const QString &str) } break; + case RDCatchEvent::SendMeterLevelsOp: + for(int i=2;i=255) { + d_meter_levels.clear(); + return false; + } + int16_t lvls[RDCatchMeterLevel::LastChannel]; + for(int j=0;j0xFFFF)) { + d_meter_levels.clear(); + return false; + } + lvls[j]=-(int16_t)lvl; + } + d_meter_levels.push_back(RDCatchMeterLevel(chan,lvls)); + } + } + d_operation=op; + d_host_name=f0.at(1); + return true; + break; + case RDCatchEvent::DeckStatusQueryOp: if(f0.size()!=3) { return false; @@ -347,6 +422,12 @@ QString RDCatchEvent::write() const case RDCatchEvent::LastOp: break; + case RDCatchEvent::SendMeterLevelsOp: + for(int i=0;i #include #include #include +class RDCatchMeterLevel +{ + public: + enum Channel {Left=0,Right=1,LastChannel=2}; + RDCatchMeterLevel(int deck,int16_t *lvls); + unsigned deckChannel() const; + int16_t level(Channel chan) const; + QString dump() const; + + private: + unsigned d_deck_channel; + int16_t d_levels[Channel::LastChannel]; +}; + + + + class RDCatchEvent { public: enum Operation {NullOp=0,DeckEventProcessedOp=1, DeckStatusQueryOp=2,DeckStatusResponseOp=3, StopDeckOp=4,SetInputMonitorOp=5,SetInputMonitorResponseOp=6, - ReloadDecksOp=7,LastOp=8}; + ReloadDecksOp=7,SendMeterLevelsOp=8,LastOp=9}; RDCatchEvent(RDDeck::Status status); RDCatchEvent(); Operation operation() const; @@ -55,6 +73,8 @@ class RDCatchEvent void setDeckStatus(RDDeck::Status status); bool inputMonitorActive() const; void setInputMonitorActive(bool state); + QList meterLevels() const; + void setMeterLevels(const QList &lvls); bool read(const QString &str); QString write() const; QString dump() const; @@ -70,6 +90,7 @@ class RDCatchEvent unsigned d_deck_channel; int d_event_number; bool d_input_monitor_active; + QList d_meter_levels; RDDeck::Status d_deck_status; }; diff --git a/rdcatch/deckmon.cpp b/rdcatch/deckmon.cpp index 71f1baf6..5b0dc720 100644 --- a/rdcatch/deckmon.cpp +++ b/rdcatch/deckmon.cpp @@ -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 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 + 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: diff --git a/rdcatch/deckmon.h b/rdcatch/deckmon.h index 98749766..19e49d6f 100644 --- a/rdcatch/deckmon.h +++ b/rdcatch/deckmon.h @@ -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: diff --git a/rdcatch/rdcatch.cpp b/rdcatch/rdcatch.cpp index ec351b50..59e32585 100644 --- a/rdcatch/rdcatch.cpp +++ b/rdcatch/rdcatch.cpp @@ -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) diff --git a/rdcatch/rdcatch.h b/rdcatch/rdcatch.h index 1ea8a635..7a4e4f85 100644 --- a/rdcatch/rdcatch.h +++ b/rdcatch/rdcatch.h @@ -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); diff --git a/rdcatch/recordlistmodel.cpp b/rdcatch/recordlistmodel.cpp index 06064aac..223053fe 100644 --- a/rdcatch/recordlistmodel.cpp +++ b/rdcatch/recordlistmodel.cpp @@ -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"); diff --git a/rdcatchd/rdcatchd.cpp b/rdcatchd/rdcatchd.cpp index 0f0f4e50..792dd4ee 100644 --- a/rdcatchd/rdcatchd.cpp +++ b/rdcatchd/rdcatchd.cpp @@ -526,6 +526,7 @@ void MainObject::catchEventReceivedData(RDCatchEvent *evt) break; case RDCatchEvent::DeckEventProcessedOp: + case RDCatchEvent::SendMeterLevelsOp: case RDCatchEvent::DeckStatusResponseOp: case RDCatchEvent::SetInputMonitorResponseOp: case RDCatchEvent::NullOp: @@ -1152,7 +1153,29 @@ void MainObject::runCartData(int chan,int number,unsigned cartnum) void MainObject::meterData() { short levels[2]; + QList meter_levels; + for(int i=0;icae()-> + inputMeterUpdate(catch_record_card[i],catch_record_stream[i],levels); + meter_levels.push_back(RDCatchMeterLevel(i,levels)); + } + if(catch_playout_deck_status[i]==RDDeck::Recording) { + rda->cae()-> + outputMeterUpdate(catch_playout_card[i],catch_playout_port[i],levels); + meter_levels.push_back(RDCatchMeterLevel(i+129,levels)); + } + } + if(meter_levels.size()>0) { + RDCatchEvent *evt=new RDCatchEvent(); + evt->setOperation(RDCatchEvent::SendMeterLevelsOp); + evt->setMeterLevels(meter_levels); + rda->ripc()->sendCatchEvent(evt); + delete evt; + } + + /* for(int i=0;icae()->inputMeterUpdate(catch_record_card[i],catch_record_stream[i], @@ -1166,6 +1189,7 @@ void MainObject::meterData() SendMeterLevel(i+129,levels); } } + */ }