diff --git a/ChangeLog b/ChangeLog index a09c0f69..8765340b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24543,3 +24543,8 @@ 2023-12-14 Fred Gleason * Fixed regressions in the CAE subsystem that broke play-out positioning and active output port reporting. +2023-12-15 Fred Gleason + * Modified the call parameters of the 'Output Stream Meter Levels' + ['MO'] CAE command to use play session serial numbers rather than + card and stream numbers. + * Fixed a regression in rdcartslots(1) that broke audio meters. diff --git a/cae/cae.cpp b/cae/cae.cpp index 5963ce2c..adf4e605 100644 --- a/cae/cae.cpp +++ b/cae/cae.cpp @@ -1142,6 +1142,10 @@ void MainObject::updateMeters() Driver *dvr=GetDriver(i); if(dvr!=NULL) { for(int j=0;jgetInputStatus(i,j)!=port_status[i][j]) { port_status[i][j]=dvr->getInputStatus(i,j); if(port_status[i][j]) { @@ -1151,6 +1155,10 @@ void MainObject::updateMeters() cae_server->sendCommand(QString::asprintf("IS %d %d 1!",i,j)); } } + + // + // Port Meters + // if(dvr->getInputMeters(i,j,levels)) { SendMeterLevelUpdate("I",i,j,levels); } @@ -1158,12 +1166,25 @@ void MainObject::updateMeters() SendMeterLevelUpdate("O",i,j,levels); } } + + // + // Output Positions + // dvr->getOutputPosition(i,positions); SendMeterPositionUpdate(i,positions); - for(int j=0;jgetStreamOutputMeters(i,j,levels)) { - SendStreamMeterLevelUpdate(i,j,levels); - } + + // + // Output Stream Meters + // + for(QMap::const_iterator it=play_sessions.begin(); + it!=play_sessions.end();it++) { + if((int)it.value()->cardNumber()==i) { + if(dvr->getStreamOutputMeters(it.value()->cardNumber(), + it.value()->streamNumber(), + levels)) { + SendStreamMeterLevelUpdate(it.value(),levels); + } + } } } } @@ -1587,18 +1608,15 @@ void MainObject::SendMeterLevelUpdate(const QString &type,int cardnum, } -void MainObject::SendStreamMeterLevelUpdate(int cardnum,int streamnum, - short levels[]) +void MainObject::SendStreamMeterLevelUpdate(PlaySession *psess,short levels[]) { - QList ids=cae_server->connectionIds(); - - for(int l=0;lmeterPort(ids.at(l))>0)&& - cae_server->metersEnabled(ids.at(l),cardnum)) { - SendMeterUpdate(QString::asprintf("MO %d %d %d %d", - cardnum,streamnum,levels[0],levels[1]),ids.at(l)); - } + if((cae_server->meterPort(psess->socketDescriptor())>0)&& + cae_server->metersEnabled(psess->socketDescriptor(),psess->cardNumber())) { + SendMeterUpdate(QString::asprintf("MO %u %d %d",psess->serialNumber(), + levels[0],levels[1]), + psess->socketDescriptor()); } + } diff --git a/cae/cae.h b/cae/cae.h index 6206d12c..4e0cb6e2 100644 --- a/cae/cae.h +++ b/cae/cae.h @@ -122,7 +122,7 @@ class MainObject : public QObject void ClearDriverEntries() const; void SendMeterLevelUpdate(const QString &type,int cardnum,int portnum, short levels[]); - void SendStreamMeterLevelUpdate(int cardnum,int streamnum,short levels[]); + void SendStreamMeterLevelUpdate(PlaySession *psess,short levels[]); void SendMeterPositionUpdate(int cardnum,unsigned pos[]); void SendMeterOutputStatusUpdate(); void SendMeterOutputStatusUpdate(int card,int port,int stream); diff --git a/docs/apis/cae.xml b/docs/apis/cae.xml index 4e88c712..101d52fc 100644 --- a/docs/apis/cae.xml +++ b/docs/apis/cae.xml @@ -1528,29 +1528,19 @@ MO - card-num - port-num + serial left-lvl right-lvl! - card-num + serial - The number of the audio adapter to use. - - - - - - port-num - - - - The port number on the audio adapter. + The serial number of the playback event, from the + Load Playback call. diff --git a/lib/rdcae.cpp b/lib/rdcae.cpp index 446a9be3..03673c0c 100644 --- a/lib/rdcae.cpp +++ b/lib/rdcae.cpp @@ -43,6 +43,9 @@ __RDCae_PlayChannel::__RDCae_PlayChannel(unsigned card,unsigned port) d_card=card; d_port=port; d_position=0; + for(int i=0;i<2;i++) { + d_stream_levels[i]=RD_MUTE_DEPTH; + } } @@ -70,6 +73,21 @@ void __RDCae_PlayChannel::setPosition(unsigned pos) } +void __RDCae_PlayChannel::getStreamLevels(short lvls[2]) +{ + for(int i=0;i<2;i++) { + lvls[i]=d_stream_levels[i]; + } +} + + +void __RDCae_PlayChannel::setStreamLevels(short left_lvl,short right_lvl) +{ + d_stream_levels[0]=left_lvl; + d_stream_levels[1]=right_lvl; +} + + bool __RDCae_PlayChannel::operator==(const __RDCae_PlayChannel &other) const { return (d_card==other.d_card)&&(d_port==other.d_port); @@ -151,7 +169,6 @@ RDCae::RDCae(RDStation *station,RDConfig *config,QObject *parent) for(unsigned k=0;k<2;k++) { cae_input_levels[i][j][k]=-10000; cae_output_levels[i][j][k]=-10000; - cae_stream_output_levels[i][j][k]=-10000; } } } @@ -415,11 +432,14 @@ void RDCae::outputMeterUpdate(int card,int port,short levels[2]) } -void RDCae::outputStreamMeterUpdate(int card,int stream,short levels[2]) +void RDCae::outputStreamMeterUpdate(unsigned serial,short levels[2]) { - UpdateMeters(); - levels[0]=cae_stream_output_levels[card][stream][0]; - levels[1]=cae_stream_output_levels[card][stream][1]; + __RDCae_PlayChannel *chan=NULL; + + if((chan=cae_play_channels.value(serial))!=NULL) { + UpdateMeters(); + chan->getStreamLevels(levels); + } } @@ -521,14 +541,12 @@ void RDCae::DispatchCommand(const QString &cmd) } if((cmds.at(0)=="PP")&&(cmds.size()==3)) { // Position Play - printf("Position Play\n"); unsigned serial=cmds.at(1).toUInt(&ok); if(ok) { unsigned pos=cmds.at(2).toUInt(&ok); if(ok) { if((chan=cae_play_channels.value(serial))!=NULL) { if(SerialCheck(serial,LINE_NUMBER)) { - printf("emitting playPositioned(%u,%u)\n",serial,pos); emit playPositioned(serial,pos); } } @@ -654,6 +672,7 @@ void RDCae::UpdateMeters() char msg[1501]; int n; QStringList args; + __RDCae_PlayChannel *chan=NULL; bool ok=false; @@ -675,11 +694,13 @@ void RDCae::UpdateMeters() } } if(args[0]=="MO") { - if(args.size()==5) { - cae_stream_output_levels[args[1].toInt()][args[2].toInt()][0]= - args[3].toInt(); - cae_stream_output_levels[args[1].toInt()][args[2].toInt()][1]= - args[4].toInt(); + if(args.size()==4) { + unsigned serial=args.at(1).toUInt(&ok); + if(ok) { + if((chan=cae_play_channels.value(serial))!=NULL) { + chan->setStreamLevels(args.at(2).toShort(),args.at(3).toShort()); + } + } } } if(args[0]=="MP") { diff --git a/lib/rdcae.h b/lib/rdcae.h index 0107d0b3..0fe15103 100644 --- a/lib/rdcae.h +++ b/lib/rdcae.h @@ -38,12 +38,15 @@ class __RDCae_PlayChannel unsigned port() const; unsigned position() const; void setPosition(unsigned pos); + void getStreamLevels(short lvls[2]); + void setStreamLevels(short left_lvl,short right_lvl); bool operator==(const __RDCae_PlayChannel &other) const; private: unsigned d_card; unsigned d_port; unsigned d_position; + short d_stream_levels[2]; }; @@ -85,7 +88,7 @@ class RDCae : public QObject bool inputStatus(int card,int port) const; void inputMeterUpdate(int card,int port,short levels[2]); void outputMeterUpdate(int card,int port,short levels[2]); - void outputStreamMeterUpdate(int card,int stream,short levels[2]); + void outputStreamMeterUpdate(unsigned serial,short levels[2]); unsigned playPosition(unsigned serial); void requestTimescale(int card); bool playPortStatus(int card,int port,unsigned except_serial=0) const; @@ -128,7 +131,6 @@ class RDCae : public QObject int cae_meter_port_range; short cae_input_levels[RD_MAX_CARDS][RD_MAX_PORTS][2]; short cae_output_levels[RD_MAX_CARDS][RD_MAX_PORTS][2]; - short cae_stream_output_levels[RD_MAX_CARDS][RD_MAX_PORTS][2]; QMap cae_play_channels; RDStation *cae_station; RDConfig *cae_config; diff --git a/lib/rdcartslot.cpp b/lib/rdcartslot.cpp index 0511e298..89955687 100644 --- a/lib/rdcartslot.cpp +++ b/lib/rdcartslot.cpp @@ -2,7 +2,7 @@ // // The cart slot widget. // -// (C) Copyright 2012-2021 Fred Gleason +// (C) Copyright 2012-2023 Fred Gleason // // 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 @@ -373,14 +373,12 @@ void RDCartSlot::setPauseEnabled(bool state) void RDCartSlot::updateMeters() { - /* short lvls[2]; switch(slot_deck->state()) { case RDPlayDeck::Playing: case RDPlayDeck::Stopping: - slot_cae-> - outputStreamMeterUpdate(slot_deck->card(),slot_deck->stream(),lvls); + slot_cae->outputStreamMeterUpdate(slot_deck->serial(),lvls); slot_box->updateMeters(lvls); break; @@ -389,7 +387,6 @@ void RDCartSlot::updateMeters() case RDPlayDeck::Finished: break; } - */ } @@ -470,7 +467,6 @@ void RDCartSlot::optionsData() void RDCartSlot::stateChangedData(int id,RDPlayDeck::State state) { - //printf("stateChangedData(%d,%d)\n",id,state); short lvls[2]={-10000,-10000}; RDCart *cart=NULL;