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

* Fixed a regression in rdcatchd(8) that caused recordings to
	always be saved in PCM16 format when the 'Normalize' attribute
	was set for the recording event.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2023-12-18 14:34:33 -05:00
parent 1bd4955ce4
commit 1c40f60caf
4 changed files with 43 additions and 3 deletions

View File

@ -24577,3 +24577,7 @@
2023-12-18 Fred Gleason <fredg@paravelsystems.com> 2023-12-18 Fred Gleason <fredg@paravelsystems.com>
* Renamed a parameter in the 'Driver::unloadRecord()' method in * Renamed a parameter in the 'Driver::unloadRecord()' method in
caed(8). caed(8).
2023-12-18 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in rdcatchd(8) that caused recordings to
always be saved in PCM16 format when the 'Normalize' attribute
was set for the recording event.

View File

@ -52,6 +52,35 @@ void RDSettings::setFormat(Format format)
} }
void RDSettings::setFormat(RDCae::AudioCoding coding)
{
RDSettings::Format fmt=RDSettings::Pcm16;
switch(coding) {
case RDCae::Pcm16:
fmt=RDSettings::Pcm16;
break;
case RDCae::MpegL1:
fmt=RDSettings::MpegL1;
break;
case RDCae::MpegL2:
fmt=RDSettings::MpegL2;
break;
case RDCae::MpegL3:
fmt=RDSettings::MpegL2;
break;
case RDCae::Pcm24:
fmt=RDSettings::Pcm24;
break;
}
setFormat(fmt);
}
QString RDSettings::formatName() const QString RDSettings::formatName() const
{ {
return set_format_name; return set_format_name;

View File

@ -23,6 +23,8 @@
#include <qstring.h> #include <qstring.h>
#include <rdcae.h>
class RDSettings class RDSettings
{ {
public: public:
@ -33,6 +35,7 @@ class RDSettings
void setName(const QString &str); void setName(const QString &str);
RDSettings::Format format() const; RDSettings::Format format() const;
void setFormat(Format format); void setFormat(Format format);
void setFormat(RDCae::AudioCoding coding);
QString formatName() const; QString formatName() const;
void setFormatName(const QString &str); void setFormatName(const QString &str);
unsigned channels() const; unsigned channels() const;

View File

@ -2,7 +2,7 @@
// //
// Batch Routines for the Rivendell netcatcher daemon // Batch Routines for the Rivendell netcatcher daemon
// //
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2023 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -451,17 +451,21 @@ bool MainObject::Import(CatchEvent *evt,QString *err_msg)
RDAudioConvert *conv=new RDAudioConvert(this); RDAudioConvert *conv=new RDAudioConvert(this);
conv->setSourceFile(RDEscapeString(evt->tempName())); conv->setSourceFile(RDEscapeString(evt->tempName()));
conv->setDestinationFile(RDCut::pathName(evt->cutName())); conv->setDestinationFile(RDCut::pathName(evt->cutName()));
RDDeck *deck=new RDDeck(rda->station()->name(),evt->channel());
RDSettings *settings=new RDSettings(); RDSettings *settings=new RDSettings();
settings->setFormat(evt->format()); // settings->setFormat(catch_record_coding[evt->channel()-1]);
settings->setFormat(deck->defaultFormat());
settings->setChannels(evt->channels()); settings->setChannels(evt->channels());
settings->setSampleRate(rda->system()->sampleRate()); settings->setSampleRate(rda->system()->sampleRate());
settings->setBitRate(evt->bitrate()); settings->setBitRate(catch_record_bitrate[evt->channel()-1]);
settings->setNormalizationLevel(evt->normalizeLevel()/100); settings->setNormalizationLevel(evt->normalizeLevel()/100);
rda->syslog(LOG_INFO,"started import of %s to cut %s, id=%d", rda->syslog(LOG_INFO,"started import of %s to cut %s, id=%d",
(const char *)evt->tempName().toUtf8(), (const char *)evt->tempName().toUtf8(),
(const char *)evt->cutName().toUtf8(), (const char *)evt->cutName().toUtf8(),
evt->id()); evt->id());
conv->setDestinationSettings(settings); conv->setDestinationSettings(settings);
delete deck;
switch((conv_err=conv->convert())) { switch((conv_err=conv->convert())) {
case RDAudioConvert::ErrorOk: case RDAudioConvert::ErrorOk:
CheckInRecording(evt->cutName(),evt,msecs,evt->trimThreshold()); CheckInRecording(evt->cutName(),evt,msecs,evt->trimThreshold());