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

* Removed vestigal code for RDCatch control via TCP connection.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-11-03 12:44:29 -04:00
parent ae3542f9a4
commit 9161d9014e
22 changed files with 110 additions and 1325 deletions

View File

@@ -2,7 +2,7 @@
##
## Automake.am for rivendell/rdcatch
##
## (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
## (C) Copyright 2002-2022 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,7 +41,6 @@ all:
bin_PROGRAMS = rdcatch
dist_rdcatch_SOURCES = add_recording.cpp add_recording.h\
catch_monitor.cpp catch_monitor.h\
catchtableview.cpp catchtableview.h\
colors.h\
deckmon.cpp deckmon.h\

View File

@@ -1,72 +0,0 @@
// catch_monitor.cpp
//
// A container class for RDCatch deck monitors and assorted metadata.
//
// (C) Copyright 2002-2018 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 <catch_monitor.h>
CatchMonitor::CatchMonitor()
{
catch_deck_mon=NULL;
catch_serial_number=-1;
catch_channel_number=-1;
}
CatchMonitor::CatchMonitor(DeckMon *mon,int serial,int channel)
{
catch_deck_mon=mon;
catch_serial_number=serial;
catch_channel_number=channel;
}
DeckMon *CatchMonitor::deckMon() const
{
return catch_deck_mon;
}
void CatchMonitor::setDeckMon(DeckMon *mon)
{
catch_deck_mon=mon;
}
int CatchMonitor::serialNumber() const
{
return catch_serial_number;
}
void CatchMonitor::setSerialNumber(int num)
{
catch_serial_number=num;
}
int CatchMonitor::channelNumber() const
{
return catch_channel_number;
}
void CatchMonitor::setChannelNumber(int num)
{
catch_channel_number=num;
}

View File

@@ -1,46 +0,0 @@
// catch_monitor.h
//
// A container class for RDCatch deck monitors and assorted metadata.
//
// (C) Copyright 2002-2018 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 CATCH_MONITOR_H
#define CATCH_MONITOR_H
#include <deckmon.h>
class CatchMonitor
{
public:
CatchMonitor();
CatchMonitor(DeckMon *mon,int serial,int channel);
DeckMon *deckMon() const;
void setDeckMon(DeckMon *mon);
int serialNumber() const;
void setSerialNumber(int num);
int channelNumber() const;
void setChannelNumber(int num);
private:
DeckMon *catch_deck_mon;
int catch_serial_number;
int catch_channel_number;
};
#endif // CATCH_MONITOR_H

View File

@@ -140,84 +140,6 @@ void DeckMon::enableMonitorButton(bool state)
}
void DeckMon::setStatus(RDDeck::Status status,int id,const QString &cutname)
{
if(id==0) {
mon_status_label->setText(tr("IDLE"));
SetCutInfo(0,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setDisabled(true);
mon_event_light->setDisabled(true);
return;
}
switch(status) {
case RDDeck::Offline:
mon_status_label->setText(tr("OFFLINE"));
SetCutInfo(0,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setDisabled(true);
mon_event_light->setDisabled(true);
break;
case RDDeck::Idle:
mon_status_label->setText(tr("IDLE"));
SetCutInfo(0,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setDisabled(true);
mon_event_light->setDisabled(true);
break;
case RDDeck::Ready:
mon_status_label->setText(tr("READY"));
SetCutInfo(id,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setEnabled(true);
mon_event_light->setDisabled(true);
break;
case RDDeck::Waiting:
mon_status_label->setText(tr("WAITING"));
SetCutInfo(id,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setEnabled(true);
mon_event_light->setDisabled(true);
break;
case RDDeck::Recording:
if((mon_channel>0)&&(mon_channel<(MAX_DECKS+1))) {
mon_status_label->setText(tr("RECORDING"));
}
if((mon_channel>128)&&(mon_channel<(MAX_DECKS+129))) {
mon_status_label->setText(tr("PLAYING"));
}
SetCutInfo(id,cutname);
mon_abort_button->setEnabled(true);
mon_event_light->setEnabled(true);
break;
case RDDeck::LastStatus:
break;
}
}
/*
void DeckMon::setLeftMeter(int level)
{
mon_left_meter->setPeakBar(level);
}
void DeckMon::setRightMeter(int level)
{
mon_right_meter->setPeakBar(level);
}
*/
void DeckMon::processCatchEvent(RDCatchEvent *evt)
{
// printf("processCatchEvent(): %s\n",evt->dump().toUtf8().constData());
@@ -234,7 +156,7 @@ void DeckMon::processCatchEvent(RDCatchEvent *evt)
case RDCatchEvent::DeckStatusResponseOp:
if(evt->deckChannel()==mon_channel) {
setStatus(evt->deckStatus(),evt->eventId(),
SetStatus(evt->deckStatus(),evt->eventId(),
RDCut::cutName(evt->cartNumber(),evt->cutNumber()));
}
break;
@@ -303,7 +225,72 @@ void DeckMon::abortButtonData()
rda->ripc()->sendCatchEvent(evt);
delete evt;
// emit abortClicked();
}
void DeckMon::SetStatus(RDDeck::Status status,int id,const QString &cutname)
{
if(id==0) {
mon_status_label->setText(tr("IDLE"));
SetCutInfo(0,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setDisabled(true);
mon_event_light->setDisabled(true);
return;
}
switch(status) {
case RDDeck::Offline:
mon_status_label->setText(tr("OFFLINE"));
SetCutInfo(0,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setDisabled(true);
mon_event_light->setDisabled(true);
break;
case RDDeck::Idle:
mon_status_label->setText(tr("IDLE"));
SetCutInfo(0,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setDisabled(true);
mon_event_light->setDisabled(true);
break;
case RDDeck::Ready:
mon_status_label->setText(tr("READY"));
SetCutInfo(id,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setEnabled(true);
mon_event_light->setDisabled(true);
break;
case RDDeck::Waiting:
mon_status_label->setText(tr("WAITING"));
SetCutInfo(id,"");
mon_left_meter->setPeakBar(-10000);
mon_right_meter->setPeakBar(-10000);
mon_abort_button->setEnabled(true);
mon_event_light->setDisabled(true);
break;
case RDDeck::Recording:
if((mon_channel>0)&&(mon_channel<(MAX_DECKS+1))) {
mon_status_label->setText(tr("RECORDING"));
}
if((mon_channel>128)&&(mon_channel<(MAX_DECKS+129))) {
mon_status_label->setText(tr("PLAYING"));
}
SetCutInfo(id,cutname);
mon_abort_button->setEnabled(true);
mon_event_light->setEnabled(true);
break;
case RDDeck::LastStatus:
break;
}
}

View File

@@ -21,8 +21,8 @@
#ifndef DECKMON_H
#define DECKMON_H
#include <qlabel.h>
#include <qpushbutton.h>
#include <QLabel>
#include <QPushButton>
#include <rddeck.h>
#include <rdframe.h>
@@ -42,9 +42,6 @@ class DeckMon : public RDFrame
void enableMonitorButton(bool state);
public slots:
void setStatus(RDDeck::Status status,int id,const QString &cutname);
// void setLeftMeter(int level);
// void setRightMeter(int level);
void processCatchEvent(RDCatchEvent *evt);
protected:
@@ -55,6 +52,7 @@ class DeckMon : public RDFrame
void abortButtonData();
private:
void SetStatus(RDDeck::Status status,int id,const QString &cutname);
void SetCutInfo(int id,const QString &cutname);
QLabel *mon_station_label;
QLabel *mon_cut_label;

View File

@@ -52,27 +52,6 @@ EditUpload *catch_editupload_dialog;
int catch_audition_card=-1;
int catch_audition_port=-1;
CatchConnector::CatchConnector(RDCatchConnect *conn,const QString &station_name)
{
catch_connect=conn;
catch_station_name=station_name;
}
RDCatchConnect *CatchConnector::connector() const
{
return catch_connect;
}
QString CatchConnector::stationName()
{
return catch_station_name;
}
MainWidget::MainWidget(RDConfig *c,QWidget *parent)
: RDMainWindow("rdcatch",c)
{
@@ -187,22 +166,6 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
"`NAME`!='DEFAULT'";
RDSqlQuery *q=new RDSqlQuery(sql);
while(q->next()) {
catch_connect.push_back(new CatchConnector(new RDCatchConnect(catch_connect.size(),this),q->value(0).toString().toLower()));
connect(catch_connect.back()->connector(),
SIGNAL(statusChanged(int,unsigned,RDDeck::Status,int,const QString &)),
this,
SLOT(statusChangedData(int,unsigned,RDDeck::Status,int,const QString &)));
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());
sql=QString("select ")+
"`CHANNEL`,"+ // 00
"`MON_PORT_NUMBER` "+ // 01
@@ -213,29 +176,18 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
"order by `CHANNEL`";
q1=new RDSqlQuery(sql);
while(q1->next()) {
catch_connect.back()->chan.push_back(q1->value(0).toUInt());
catch_connect.back()->mon_id.push_back(catch_monitor.size());
DeckMon *mon=new DeckMon(q->value(0).toString(),q1->value(0).toUInt(),
catch_monitor_vbox);
catch_deck_monitors.
push_back(new DeckMon(q->value(0).toString(),q1->value(0).toUInt(),
catch_monitor_vbox));
connect(rda->ripc(),SIGNAL(catchEventReceived(RDCatchEvent *)),
mon,SLOT(processCatchEvent(RDCatchEvent *)));
catch_monitor.push_back(new CatchMonitor());
catch_monitor.back()->setDeckMon(mon);
catch_monitor.back()->setSerialNumber(catch_connect.size()-1);
catch_monitor.back()->setChannelNumber(q1->value(0).toUInt());
catch_monitor_vbox->addWidget(catch_monitor.back()->deckMon());
catch_monitor.back()->deckMon()->
enableMonitorButton((q1->value(1).toInt()>=0)&&
(rda->config()->stationName().toLower()==
q->value(0).toString().toLower()));
catch_monitor.back()->deckMon()->show();
catch_deck_monitors.back(),
SLOT(processCatchEvent(RDCatchEvent *)));
catch_monitor_vbox->addWidget(catch_deck_monitors.back());
}
delete q1;
}
delete q;
if(catch_monitor.size()==0) {
if(catch_deck_monitors.size()==0) {
catch_monitor_area->hide();
}
@@ -493,14 +445,6 @@ QSizePolicy MainWidget::sizePolicy() const
}
void MainWidget::connectedData(int serial,bool state)
{
if(state) {
catch_connect[serial]->connector()->enableMetering(true);
}
}
void MainWidget::nextEventData()
{
QTime next_time;
@@ -547,7 +491,6 @@ void MainWidget::nextEventData()
void MainWidget::addData()
{
int conn;
RDNotification *notify=NULL;
QModelIndex row;
RDRecording::Type type=RDRecording::Recording;
@@ -566,11 +509,6 @@ void MainWidget::addData()
if(row.isValid()) {
catch_recordings_view->selectRow(row.row());
}
conn=GetConnection(catch_recordings_model->hostName(row));
if(conn<0) {
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
nextEventData();
}
}
@@ -648,7 +586,6 @@ void MainWidget::deleteData()
{
QString warning;
QString filename;
int conn;
QString sql;
QModelIndexList rows=catch_recordings_view->selectionModel()->selectedRows();
@@ -665,11 +602,6 @@ void MainWidget::deleteData()
QMessageBox::Yes) {
return;
}
conn=GetConnection(catch_recordings_model->hostName(rows.first()));
if(conn<0) {
fprintf(stderr,"rdcatch: invalid connection index!\n");
return;
}
sql=QString("delete from `RECORDINGS` where ")+
QString::asprintf("`ID`=%u",catch_recordings_model->recordId(rows.first()));
RDSqlQuery::apply(sql);
@@ -719,36 +651,6 @@ void MainWidget::ripcUserData()
}
void MainWidget::statusChangedData(int serial,unsigned chan,
RDDeck::Status status,int id,
const QString &cutname)
{
// printf("statusChangedData(%d,%u,%d,%d)\n",serial,chan,status,id);
int mon=GetMonitor(serial,chan);
catch_recordings_model->setRecordStatus(id,status);
if(mon>=0) {
int waiting_count=0;
int active_count=0;
unsigned waiting_id=0;
catch_recordings_model->
channelCounts(chan,&waiting_count,&active_count,&waiting_id);
if(waiting_count>1) {
catch_monitor[mon]->deckMon()->setStatus(status,-1,cutname);
}
else {
if((active_count==0)||(status!=RDDeck::Idle)) {
catch_monitor[mon]->deckMon()->setStatus(status,id,cutname);
}
else {
catch_monitor[mon]->deckMon()->
setStatus(RDDeck::Waiting,waiting_id,cutname);
}
}
}
nextEventData();
}
void MainWidget::catchEventReceivedData(RDCatchEvent *evt)
{
// printf("catchEventReceivedData()\n");
@@ -756,7 +658,6 @@ 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());
@@ -813,8 +714,10 @@ void MainWidget::headButtonData()
RDSetMixerOutputPort(rda->cae(),catch_audition_card,catch_audition_stream,
catch_audition_port);
rda->cae()->positionPlay(catch_play_handle,cut->startPoint());
rda->cae()->setPlayPortActive(catch_audition_card,catch_audition_port,catch_audition_stream);
rda->cae()->setOutputVolume(catch_audition_card,catch_audition_stream,catch_audition_port,
rda->cae()->setPlayPortActive(catch_audition_card,catch_audition_port,
catch_audition_stream);
rda->cae()->setOutputVolume(catch_audition_card,catch_audition_stream,
catch_audition_port,
0+cut->playGain());
rda->cae()->play(catch_play_handle,RDCATCH_AUDITION_LENGTH,
RD_TIMESCALE_DIVISOR,false);
@@ -905,25 +808,6 @@ 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;
for(unsigned i=0;i<catch_connect[serial]->chan.size();i++) {
if(catch_connect[serial]->chan[i]==(unsigned)deck) {
monitor=catch_monitor[catch_connect[serial]->mon_id[i]]->deckMon();
if(l_r==0) {
monitor->setLeftMeter(level);
}
if(l_r==1) {
monitor->setRightMeter(level);
}
return;
}
}
}
*/
void MainWidget::selectionChangedData(const QItemSelection &before,
const QItemSelection &after)
@@ -1126,11 +1010,11 @@ void MainWidget::resizeEvent(QResizeEvent *e)
{
assert(e);
assert(catch_monitor_area);
if(catch_monitor.size()<=RDCATCH_MAX_VISIBLE_MONITORS) {
if(catch_deck_monitors.size()<=RDCATCH_MAX_VISIBLE_MONITORS) {
catch_monitor_area->
setGeometry(10,10,e->size().width()-20,32*catch_monitor.size()+4);
setGeometry(10,10,e->size().width()-20,32*catch_deck_monitors.size()+4);
catch_monitor_vbox->
setGeometry(0,0,e->size().width()-25,32*catch_monitor.size());
setGeometry(0,0,e->size().width()-25,32*catch_deck_monitors.size());
}
else {
catch_monitor_area->
@@ -1139,17 +1023,16 @@ void MainWidget::resizeEvent(QResizeEvent *e)
// This depends on the width of the scrollbar. How to reliably
// determine such on various desktops?
//
// (catch_monitor_area->verticalScrollBar()->geometry().width() is not
// always accurate!)
// N.B. catch_monitor_area->verticalScrollBar()->geometry().width() is not
// always accurate!
//
catch_monitor_vbox->
setGeometry(0,
0,
setGeometry(0,0,
e->size().width()-40, // Works on XFCE, what about others?
32*catch_monitor.size());
32*catch_deck_monitors.size());
}
int deck_height=0;
if (catch_monitor.size()>0){
if (catch_deck_monitors.size()>0){
deck_height=catch_monitor_area->geometry().y()+
catch_monitor_area->geometry().height();
}
@@ -1277,37 +1160,6 @@ void MainWidget::UpdateScroll()
}
int MainWidget::GetMonitor(int serial,int chan)
{
for(unsigned i=0;i<catch_monitor.size();i++) {
if((catch_monitor[i]->serialNumber()==serial)&&
(catch_monitor[i]->channelNumber()==chan)) {
return i;
}
}
return -1;
}
int MainWidget::GetConnection(QString station,unsigned chan)
{
for(unsigned i=0;i<catch_connect.size();i++) {
if(catch_connect[i]->stationName()==station.toLower()) {
if(chan==0) {
return i;
}
for(unsigned j=0;j<catch_connect[i]->chan.size();j++) {
if(catch_connect[i]->chan[j]==chan) {
return i;
}
}
return -1;
}
}
printf(" No connection found!\n");
return -1;
}
QString MainWidget::GeometryFile() {
bool home_found = false;
QString home = RDGetHomeDir(&home_found);

View File

@@ -23,10 +23,10 @@
#include <QCheckBox>
#include <QComboBox>
#include <QList>
#include <QScrollArea>
#include <rdcart_dialog.h>
#include <rdcatch_connect.h>
#include <rdcut_dialog.h>
#include <rdmainwindow.h>
#include <rdtableview.h>
@@ -34,7 +34,6 @@
#include <rdwidget.h>
#include "add_recording.h"
#include "catch_monitor.h"
#include "catchtableview.h"
#include "deckmon.h"
#include "recordlistmodel.h"
@@ -48,21 +47,6 @@
#define RDCATCH_MAX_VISIBLE_MONITORS 8
#define RDCATCH_USAGE "[--offline-host-warnings=yes|no]\n"
class CatchConnector
{
public:
CatchConnector(RDCatchConnect *conn,const QString &station_name);
RDCatchConnect *connector() const;
QString stationName();
std::vector<unsigned> chan;
std::vector<unsigned> mon_id;
private:
RDCatchConnect *catch_connect;
QString catch_station_name;
};
class MainWidget : public RDMainWindow
{
Q_OBJECT
@@ -72,15 +56,12 @@ class MainWidget : public RDMainWindow
QSizePolicy sizePolicy() const;
private slots:
void connectedData(int serial,bool state);
void nextEventData();
void addData();
void editData();
void deleteData();
void ripcConnectedData(bool);
void ripcUserData();
void statusChangedData(int,unsigned,RDDeck::Status,int,
const QString &cutname);
void catchEventReceivedData(RDCatchEvent *evt);
void scrollButtonData();
void reportsButtonData();
@@ -90,7 +71,6 @@ class MainWidget : public RDMainWindow
void initData(bool);
void playedData(int);
void playStoppedData(int);
// void meterLevelData(int,int,int,int);
void selectionChangedData(const QItemSelection &before,
const QItemSelection &after);
void doubleClickedData(const QModelIndex &index);
@@ -110,13 +90,9 @@ class MainWidget : public RDMainWindow
void ProcessNewRecords(std::vector<int> *adds);
void EnableScroll(bool state);
void UpdateScroll();
int GetMonitor(int serial,int chan);
int GetConnection(QString station,unsigned chan=0);
QString GeometryFile();
std::vector<CatchMonitor *> catch_monitor;
QScrollArea *catch_monitor_area;
VBox *catch_monitor_vbox;
std::vector<CatchConnector *> catch_connect;
QSqlDatabase *catch_db;
int catch_audition_stream;
int catch_play_handle;
@@ -154,6 +130,7 @@ class MainWidget : public RDMainWindow
int catch_time_offset;
bool catch_host_warnings;
AddRecording *catch_add_recording_dialog;
QList<DeckMon *> catch_deck_monitors;
};

View File

@@ -32,8 +32,8 @@ x11 {
SOURCES += edit_upload.cpp
SOURCES += eventlight.cpp
SOURCES += eventwidget.cpp
SOURCES += rdcatch.cpp
SOURCES += list_reports.cpp
SOURCES += rdcatch.cpp
SOURCES += recordlistmodel.cpp
}
@@ -50,8 +50,8 @@ x11 {
HEADERS += edit_upload.h
HEADERS += eventlight.h
HEADERS += eventwidget.h
HEADERS += rdcatch.h
HEADERS += list_reports.h
HEADERS += rdcatch.h
HEADERS += recordlistmodel.h
}