2014-12-01 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in 'utils/rdimport/rdimport.cpp' that failed to
	apply automatic segues correctly when the audio store was not
	locally accessible.
	* Fixed a bug in 'utils/rdimport/rdimport.cpp' that caused the
	value of the '--segue-level' options to be wrong by a factor of
	100.
	* Refactored the 'RDCut::autoSegue()' method to fetch trim data
	via 'RDTrimAudio'.
	* Added language in the rdimport(1) man page to resolve ambiguity
	regarding how the --segue-level location is dteremined when
	normalization is specified.
This commit is contained in:
Fred Gleason 2014-12-01 17:50:54 -05:00
parent 9e75d1c7da
commit f8d2a7905c
5 changed files with 41 additions and 20 deletions

View File

@ -14676,3 +14676,15 @@
2014-12-01 Fred Gleason <fredg@paravelsystems.com>
* Adjust value of 'STAGE1BUFSIZE' to '16384' in
'lib/rdaudioconvert.cpp'.
2014-12-01 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'utils/rdimport/rdimport.cpp' that failed to
apply automatic segues correctly when the audio store was not
locally accessible.
* Fixed a bug in 'utils/rdimport/rdimport.cpp' that caused the
value of the '--segue-level' options to be wrong by a factor of
100.
* Refactored the 'RDCut::autoSegue()' method to fetch trim data
via 'RDTrimAudio'.
* Added language in the rdimport(1) man page to resolve ambiguity
regarding how the --segue-level location is dteremined when
normalization is specified.

View File

@ -176,8 +176,9 @@ Length of the added segue in msecs. See \fB--segue-level\fP below.
.TP
.B --segue-level=<\fIlevel\fP>
Specify the threshold level to use for setting the segue markers, in dBFS.
Default action is not to create segue markers.
Specify the threshold level to use for setting the segue markers, in dBFS,
as measured after any specified normalization has been applied. Default
action is not to create segue markers.
.TP
.B --set-datetimes=<\fIstart-datetime\fP>,<\fIend-datetime\fP>

View File

@ -40,6 +40,7 @@
#include <rdescape_string.h>
#include <rdweb.h>
#include <rdcopyaudio.h>
#include <rdtrimaudio.h>
//
// Global Classes
@ -1295,11 +1296,12 @@ void RDCut::autoTrim(RDCut::AudioEnd end,int level)
}
void RDCut::autoSegue(int level,int length)
void RDCut::autoSegue(int level,int length,RDStation *station,RDUser *user,
RDConfig *config)
{
#ifndef WIN32
int point;
int start_point;
// int start_point;
if(!exists()) {
return;
@ -1311,17 +1313,23 @@ void RDCut::autoSegue(int level,int length)
return;
}
if(level<0) {
if((point=wave->endTrim(+REFERENCE_LEVEL-level))>-1) {
start_point=(int)(1000.0*(double)point/(double)wave->getSamplesPerSec());
setSegueStartPoint(start_point);
if(length>0 && (start_point+length)<endPoint()){
setSegueEndPoint(start_point+length);
}
else {
setSegueEndPoint(endPoint());
}
RDTrimAudio *trim=new RDTrimAudio(station,config);
trim->setCartNumber(cart_number);
trim->setCutNumber(cut_number);
trim->setTrimLevel(level);
if(trim->runTrim(user->name(),user->password())==RDTrimAudio::ErrorOk) {
if((point=trim->endPoint())>=0) {
setSegueStartPoint(trim->endPoint());
if(length>0 && (trim->endPoint()+length)<endPoint()){
setSegueEndPoint(trim->endPoint()+length);
}
else {
setSegueEndPoint(endPoint());
}
}
}
delete trim;
}
else {
if(length>0) {
if((endPoint()-length)>startPoint()){

View File

@ -131,7 +131,8 @@ class RDCut
bool checkInRecording(const QString &stationname,RDSettings *settings,
unsigned msecs) const;
void autoTrim(RDCut::AudioEnd end,int level);
void autoSegue(int level,int length);
void autoSegue(int level,int length,RDStation *station,RDUser *user,
RDConfig *config);
void reset() const;
void connect(QObject *receiver,const char *member) const;
void disconnect(QObject *receiver,const char *member) const;

View File

@ -2,9 +2,7 @@
//
// A Batch Importer for Rivendell.
//
// (C) Copyright 2002-2008 Fred Gleason <fredg@paravelsystems.com>
//
// $Id: rdimport.cpp,v 1.34.4.9.2.3 2014/07/15 00:45:16 cvs Exp $
// (C) Copyright 2002-2014 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
@ -532,8 +530,8 @@ MainObject::MainObject(QObject *parent,const char *name)
if(import_cmd->key(i)=="--segue-level") {
n=import_cmd->value(i).toInt(&ok);
if(ok&&(n<=0)) {
import_segue_level=100*n;
}
import_segue_level=n;
}
else {
fprintf(stderr,"rdimport: invalid segue level\n");
delete import_cmd;
@ -1172,7 +1170,8 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
}
cut->setMetadata(wavedata);
}
cut->autoSegue(import_segue_level,import_segue_length);
cut->autoSegue(import_segue_level,import_segue_length,import_station,
import_user,import_config);
if((wavedata->title().length()==0)||
((wavedata->title().length()>0)&&(wavedata->title()[0] == '\0'))) {
QString title=effective_group->generateTitle(filename);