2023-12-15 Fred Gleason <fredg@paravelsystems.com>

* 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.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2023-12-15 11:41:33 -05:00
parent 81c6ad8d1e
commit 35299494a4
7 changed files with 81 additions and 49 deletions

View File

@ -24543,3 +24543,8 @@
2023-12-14 Fred Gleason <fredg@paravelsystems.com>
* Fixed regressions in the CAE subsystem that broke play-out
positioning and active output port reporting.
2023-12-15 Fred Gleason <fredg@paravelsystems.com>
* 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.

View File

@ -1142,6 +1142,10 @@ void MainObject::updateMeters()
Driver *dvr=GetDriver(i);
if(dvr!=NULL) {
for(int j=0;j<RD_MAX_PORTS;j++) {
//
// Input Port Statuses
//
if(dvr->getInputStatus(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,11 +1166,24 @@ void MainObject::updateMeters()
SendMeterLevelUpdate("O",i,j,levels);
}
}
//
// Output Positions
//
dvr->getOutputPosition(i,positions);
SendMeterPositionUpdate(i,positions);
for(int j=0;j<RD_MAX_STREAMS;j++) {
if(dvr->getStreamOutputMeters(i,j,levels)) {
SendStreamMeterLevelUpdate(i,j,levels);
//
// Output Stream Meters
//
for(QMap<uint64_t,PlaySession *>::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<int> ids=cae_server->connectionIds();
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());
}
for(int l=0;l<ids.size();l++) {
if((cae_server->meterPort(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));
}
}
}

View File

@ -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);

View File

@ -1528,29 +1528,19 @@
</para>
<para>
<computeroutput>MO
<replaceable>card-num</replaceable>
<replaceable>port-num</replaceable>
<replaceable>serial</replaceable>
<replaceable>left-lvl</replaceable>
<replaceable>right-lvl</replaceable>!</computeroutput>
</para>
<variablelist>
<varlistentry>
<term>
<replaceable>card-num</replaceable>
<replaceable>serial</replaceable>
</term>
<listitem>
<para>
The number of the audio adapter to use.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable>port-num</replaceable>
</term>
<listitem>
<para>
The port number on the audio adapter.
The serial number of the playback event, from the
<command>Load Playback</command> call.
</para>
</listitem>
</varlistentry>

View File

@ -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])
{
__RDCae_PlayChannel *chan=NULL;
if((chan=cae_play_channels.value(serial))!=NULL) {
UpdateMeters();
levels[0]=cae_stream_output_levels[card][stream][0];
levels[1]=cae_stream_output_levels[card][stream][1];
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") {

View File

@ -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<unsigned,__RDCae_PlayChannel *> cae_play_channels;
RDStation *cae_station;
RDConfig *cae_config;

View File

@ -2,7 +2,7 @@
//
// The cart slot widget.
//
// (C) Copyright 2012-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2012-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
@ -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;