diff --git a/ChangeLog b/ChangeLog index 5cd1f7f6..409c8701 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24450,3 +24450,6 @@ use serial numbers rather than card/stream numbers. * Fixed a regression in rdcartslots(1) that broke audio level metering. +2023-10-14 Fred Gleason + * Fixed a regression in rdcatch(1) that broke audio audition + play-out. diff --git a/lib/rdcae.h b/lib/rdcae.h index 2a15eb34..727fd330 100644 --- a/lib/rdcae.h +++ b/lib/rdcae.h @@ -135,10 +135,7 @@ 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_stream_output_levels; - unsigned cae_output_positions[RD_MAX_CARDS][RD_MAX_STREAMS]; bool cae_output_status_flags[RD_MAX_CARDS][RD_MAX_PORTS][RD_MAX_STREAMS]; std::vector delayed_cmds; diff --git a/rdcatch/rdcatch.cpp b/rdcatch/rdcatch.cpp index e41978e7..0fa8f443 100644 --- a/rdcatch/rdcatch.cpp +++ b/rdcatch/rdcatch.cpp @@ -58,8 +58,6 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) QString err_msg; catch_host_warnings=false; - catch_audition_stream=-1; - catch_scroll=false; // @@ -90,8 +88,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // // Fix the Window Size // - setMinimumWidth(sizeHint().width()); - setMinimumHeight(sizeHint().height()); + setMinimumSize(sizeHint()); setWindowIcon(rda->iconEngine()->applicationIcon(RDIconEngine::RdCatch,22)); // @@ -110,7 +107,8 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) BUTTON_ACTIVE_BACKGROUND_COLOR); catch_scroll_color[0].setColor(QPalette::Inactive,QPalette::Background, palette().color(QPalette::Background)); - catch_scroll_color[1]=QPalette(palette().color(QPalette::Background),palette().color(QPalette::Background)); + catch_scroll_color[1]=QPalette(palette().color(QPalette::Background), + palette().color(QPalette::Background)); str=QString("RDCatch")+" v"+VERSION+" - "+tr("Host")+":"; setWindowTitle(str+" "+rda->config()->stationName()); @@ -145,11 +143,12 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // // CAE Connection // - connect(rda->cae(),SIGNAL(isConnected(bool)),this,SLOT(initData(bool))); - connect(rda->cae(),SIGNAL(playing(int)),this,SLOT(playedData(int))); - connect(rda->cae(),SIGNAL(playStopped(int)), + connect(rda->cae(),SIGNAL(playbackStopped(int)), this,SLOT(playStoppedData(int))); rda->cae()->connectToHost(); + QList cards; + cards.push_back(rda->station()->cueCard()); + rda->cae()->enableMetering(&cards); // // Deck Monitors @@ -388,6 +387,13 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) catch_tail_button->setDisabled(true); connect(catch_tail_button,SIGNAL(clicked()),this,SLOT(tailButtonData())); + // + // Stop Timer + // + catch_stop_timer=new QTimer(this); + catch_stop_timer->setSingleShot(true); + connect(catch_stop_timer,SIGNAL(timeout()),this,SLOT(stopButtonData())); + // // Play Stop Button // @@ -697,120 +703,88 @@ void MainWidget::reportsButtonData() void MainWidget::headButtonData() { - /* QModelIndexList rows=catch_recordings_view->selectionModel()->selectedRows(); if(rows.size()!=1) { return; } EnableScroll(false); - if((!head_playing)&&(!tail_playing)) { // Start Head Play - RDCut *cut=new RDCut(catch_recordings_model->cutName(rows.first())); - rda->cae()->loadPlay(catch_audition_card,cut->cutName(), - &catch_audition_stream,&catch_play_handle); - if(catch_audition_stream<0) { - return; - } - rda->cae()->setOutputPort(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, - 0+cut->playGain()); - rda->cae()->play(catch_play_handle,RDCATCH_AUDITION_LENGTH, - RD_TIMESCALE_DIVISOR,false); - head_playing=true; - delete cut; + if(head_playing||tail_playing) { + stopButtonData(); } - */ + RDCut *cut=new RDCut(catch_recordings_model->cutName(rows.first())); + // 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()); + catch_play_serial= + rda->cae()->startPlayback(cut->cutName(), + catch_audition_card,catch_audition_port, + cut->startPoint(), + cut->startPoint()+RDCATCH_AUDITION_LENGTH, + RD_TIMESCALE_DIVISOR); + catch_stop_timer->start(RDCATCH_AUDITION_LENGTH); + head_playing=true; + delete cut; + + catch_head_button->on(); + catch_stop_button->off(); } void MainWidget::tailButtonData() { - /* QModelIndexList rows=catch_recordings_view->selectionModel()->selectedRows(); + int start_pos=0; if(rows.size()!=1) { return; } EnableScroll(false); - if((!head_playing)&&(!tail_playing)) { // Start Tail Play - RDCut *cut=new RDCut(catch_recordings_model->cutName(rows.first())); - rda->cae()->loadPlay(catch_audition_card,cut->cutName(), - &catch_audition_stream,&catch_play_handle); - if(catch_audition_stream<0) { - return; - } - rda->cae()->setOutputPort(catch_audition_card,catch_audition_stream, - catch_audition_port); - if((cut->endPoint()-cut->startPoint()-RDCATCH_AUDITION_LENGTH)>0) { - rda->cae()->positionPlay(catch_play_handle, - cut->endPoint()-RDCATCH_AUDITION_LENGTH); - } - else { - 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, - 0+cut->playGain()); - rda->cae()->play(catch_play_handle,RDCATCH_AUDITION_LENGTH, - RD_TIMESCALE_DIVISOR,false); - tail_playing=true; - delete cut; + if(head_playing||tail_playing) { + stopButtonData(); } - */ + RDCut *cut=new RDCut(catch_recordings_model->cutName(rows.first())); + if((cut->endPoint()-cut->startPoint()-RDCATCH_AUDITION_LENGTH)>0) { + start_pos=cut->endPoint()-RDCATCH_AUDITION_LENGTH; + } + else { + start_pos=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, + // 0+cut->playGain()); + catch_play_serial= + rda->cae()->startPlayback(cut->cutName(), + catch_audition_card,catch_audition_port, + start_pos,cut->endPoint(), + RD_TIMESCALE_DIVISOR); + catch_stop_timer->start(RDCATCH_AUDITION_LENGTH); + tail_playing=true; + delete cut; + catch_tail_button->on(); + catch_stop_button->off(); } void MainWidget::stopButtonData() { - /* - if(head_playing||tail_playing) { // Stop Play - rda->cae()->stopPlay(catch_play_handle); - rda->cae()->unloadPlay(catch_play_handle); - } - */ -} - - -void MainWidget::initData(bool state) -{ - if(state) { - QList cards; - cards.push_back(rda->station()->cueCard()); - rda->cae()->enableMetering(&cards); - } - else { - QMessageBox::warning(this,tr("Can't Connect"), - tr("Unable to connect to Core AudioEngine")); - exit(1); + if(head_playing||tail_playing) { + rda->cae()->stopPlayback(catch_play_serial); + catch_stop_timer->stop(); } } -void MainWidget::playedData(int handle) -{ - if(head_playing) { - catch_head_button->on(); - } - if(tail_playing) { - catch_tail_button->on(); - } - catch_stop_button->off(); -} - - -void MainWidget::playStoppedData(int handle) +void MainWidget::playStoppedData(int serial) { head_playing=false; tail_playing=false; catch_head_button->off(); catch_tail_button->off(); catch_stop_button->on(); - // rda->cae()->unloadPlay(catch_play_handle); + catch_stop_timer->stop(); } @@ -819,6 +793,7 @@ void MainWidget::selectionChangedData(const QItemSelection &before, { QModelIndexList rows=catch_recordings_view->selectionModel()->selectedRows(); + stopButtonData(); if(rows.size()!=1) { catch_head_button->setDisabled(true); catch_tail_button->setDisabled(true); diff --git a/rdcatch/rdcatch.h b/rdcatch/rdcatch.h index fc7590e3..f7fd8812 100644 --- a/rdcatch/rdcatch.h +++ b/rdcatch/rdcatch.h @@ -2,7 +2,7 @@ // // The Event Schedule Manager for Rivendell. // -// (C) Copyright 2002-2022 Fred Gleason +// (C) Copyright 2002-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 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -68,9 +69,7 @@ class MainWidget : public RDMainWindow void headButtonData(); void tailButtonData(); void stopButtonData(); - void initData(bool); - void playedData(int); - void playStoppedData(int); + void playStoppedData(int serial); void selectionChangedData(const QItemSelection &before, const QItemSelection &after); void doubleClickedData(const QModelIndex &index); @@ -94,8 +93,7 @@ class MainWidget : public RDMainWindow QScrollArea *catch_monitor_area; VBox *catch_monitor_vbox; QSqlDatabase *catch_db; - int catch_audition_stream; - int catch_play_handle; + int catch_play_serial; CatchTableView *catch_recordings_view; RecordListModel *catch_recordings_model; RDTransportButton *catch_head_button; @@ -109,6 +107,7 @@ class MainWidget : public RDMainWindow QPushButton *catch_reports_button; bool head_playing; bool tail_playing; + QTimer *catch_stop_timer; QString catch_filter; QString catch_group; QString catch_schedcode; diff --git a/rdhpi/rdhpiplaystream.h b/rdhpi/rdhpiplaystream.h index 39bdb2cd..246654fd 100644 --- a/rdhpi/rdhpiplaystream.h +++ b/rdhpi/rdhpiplaystream.h @@ -43,7 +43,7 @@ #define FRAGMENT_TIME 50 #define TIMESCALE_LOW_LIMIT 83300 #define TIMESCALE_HIGH_LIMIT 125000 -//#define RPLAYSTREAM_SHOW_SLOTS yes +#define RPLAYSTREAM_SHOW_SLOTS yes class RDHPIPlayStream : public QObject,public RDWaveFile {