From 10b626983fdf714d7c5ed73d7a740e0dd5fec609 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 6 Feb 2015 14:00:29 -0500 Subject: [PATCH] 2015-02-06 Fred Gleason * Added a '--auto-segue' switch to rdmarkerset(8) in 'utils/rdmarkerset.cpp' and 'utils/rdmarkerset.h'. * Created a man page for rdmarkerset(8). * Added a reference to rdmarkerset(8) in the rdimport(1) man page. --- ChangeLog | 5 ++ docs/man/Makefile.am | 3 +- docs/man/rdimport.1 | 3 +- docs/man/rdmarkerset.8 | 45 +++++++++++++++++ rivendell.spec.in | 1 + utils/rdmarkerset/rdmarkerset.cpp | 83 +++++++++++++++++++++++++++++-- utils/rdmarkerset/rdmarkerset.h | 7 ++- 7 files changed, 141 insertions(+), 6 deletions(-) create mode 100644 docs/man/rdmarkerset.8 diff --git a/ChangeLog b/ChangeLog index f1b75731..9ac37aec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14738,3 +14738,8 @@ string to be evaluated as invalid. 2015-01-29 Fred Gleason * Incremented the package version to 2.10.2int03. +2015-02-06 Fred Gleason + * Added a '--auto-segue' switch to rdmarkerset(8) in + 'utils/rdmarkerset.cpp' and 'utils/rdmarkerset.h'. + * Created a man page for rdmarkerset(8). + * Added a reference to rdmarkerset(8) in the rdimport(1) man page. diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index 64034b26..b971ad04 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -19,7 +19,8 @@ ## ## Use automake to process this into a Makefile.in -man_MANS = rdimport.1 +man_MANS = rdimport.1\ + rdmarkerset.8 EXTRA_DIST = $(man_MANS) CLEANFILES = *~ diff --git a/docs/man/rdimport.1 b/docs/man/rdimport.1 index f89790bf..49067abe 100644 --- a/docs/man/rdimport.1 +++ b/docs/man/rdimport.1 @@ -1,4 +1,4 @@ -.TH rdimport 1 "October 2014" Linux "Rivendell Radio Automation System" +.TH rdimport 1 "February 2015" Linux "Rivendell Radio Automation System" .SH NAME rdimport \- Audio importation tool for the Rivendell Radio Automation System @@ -355,6 +355,7 @@ appropriate for use with the \fB--normalization-level\fP option. .SH AUTHOR Fred Gleason .SH "SEE ALSO" +.BR rdmarkerset(8), .BR http://www.cartchunk.org/ diff --git a/docs/man/rdmarkerset.8 b/docs/man/rdmarkerset.8 new file mode 100644 index 00000000..d06f6d50 --- /dev/null +++ b/docs/man/rdmarkerset.8 @@ -0,0 +1,45 @@ +.TH rdmarkerset 8 "February 2015" Linux "Rivendell Radio Automation System" +.SH NAME +rdmarkerset \- Tool for mass altering Rivendell audio cut markers + +.SH SYNOPSIS +rdmarkerset [OPTIONS] + +.SH DESCRIPTION +\fBRdmarkerset\fP is a command-line tool for setting or altering audio cut +markers in the Rivendell Radio Automation System. + +.SH OPTIONS +.TP +.B --group=<\fIgroup-name\fP> +Apply marker changes to the audio cuts belonging to <\fIgroup\fP>. This +option may be given multiple times. Use of this option is mutually +exclusive with the \fB--all-groups\fP option, below. + +.TP +.B --all-groups +Apply marker changes to ALL audio cuts in the Library. Use of this option +is mutually exclusive with the \fB--group\fP option, above. Use with caution! + +.TP +.B --auto-trim=<\fIlevel\fP> +Auto-trim the specified cuts to the level indicated by <\fIlevel\fP> dBFS. +Specifying a '0' for <\fIlevel\fP> will remove auto-trim --i.e. move the +Start and End markers to the extreme start and end of the audio data. +Default action is to leave the Start and End markers unaltered. + +.TP +.B --auto-segue=<\fIlevel\fP> +Set the Segue Start marker on the specified cuts to the level indicated +by <\fIlevel\fP> dBFS and the Segue End marker to the position of the End +marker. Specifying a '0' for <\fIlevel\fP> will remove the segue markers. +Default action is to leave the segue markers unaltered. + +.TP +.B --verbose +Print messages to STDOUT describing progress. + +.SH AUTHOR +Fred Gleason +.SH "SEE ALSO" +.BR rdimport(1) diff --git a/rivendell.spec.in b/rivendell.spec.in index d22ea1ea..44ab1e50 100644 --- a/rivendell.spec.in +++ b/rivendell.spec.in @@ -284,6 +284,7 @@ rm -rf $RPM_BUILD_ROOT /etc/pam.d/rdalsaconfig-root /etc/security/console.apps/rdalsaconfig-root %{_mandir}/man1/rdimport.1.gz +%{_mandir}/man8/rdmarkerset.8.gz %doc AUTHORS %doc ChangeLog %doc COPYING diff --git a/utils/rdmarkerset/rdmarkerset.cpp b/utils/rdmarkerset/rdmarkerset.cpp index a31a8bcf..b035812e 100644 --- a/utils/rdmarkerset/rdmarkerset.cpp +++ b/utils/rdmarkerset/rdmarkerset.cpp @@ -55,6 +55,8 @@ MainObject::MainObject(QObject *parent,const char *name) set_all_groups=false; set_auto_trim=1; set_verbose=false; + set_auto_trim=1; + set_auto_segue=1; // // Read Command Options @@ -82,6 +84,14 @@ MainObject::MainObject(QObject *parent,const char *name) } cmd->setProcessed(i,true); } + if(cmd->key(i)=="--auto-segue") { + set_auto_segue=cmd->value(i).toInt(&ok); + if((!ok)||(set_auto_segue>0)) { + fprintf(stderr, + "rdmarkerset: invalid level value specified for --auto-segue\n"); + } + cmd->setProcessed(i,true); + } if(cmd->key(i)=="--verbose") { set_verbose=true; cmd->setProcessed(i,true); @@ -103,6 +113,10 @@ MainObject::MainObject(QObject *parent,const char *name) fprintf(stderr,"rdmarkerset: the --all-groups and --group= options are mutually exclusive\n"); exit(256); } + if((set_auto_trim<0)&&(set_auto_segue<0)&&(set_auto_trim>set_auto_segue)) { + fprintf(stderr,"rdmarkerset: segue cannot be placed after the end marker\n"); + exit(256); + } // // Check for Root Perms @@ -218,9 +232,23 @@ void MainObject::ProcessGroup(const QString &group_name) q->value(1).toString(),q->value(2).toString()); } else { - ClearAutoTrim(RDCut::cartNumber(q->value(0).toString()), - RDCut::cutNumber(q->value(0).toString()), - q->value(1).toString(),q->value(2).toString()); + if(set_auto_trim==0) { + ClearAutoTrim(RDCut::cartNumber(q->value(0).toString()), + RDCut::cutNumber(q->value(0).toString()), + q->value(1).toString(),q->value(2).toString()); + } + } + if(set_auto_segue<0) { + SetAutoSegue(RDCut::cartNumber(q->value(0).toString()), + RDCut::cutNumber(q->value(0).toString()), + q->value(1).toString(),q->value(2).toString()); + } + else { + if(set_auto_segue==0) { + ClearAutoSegue(RDCut::cartNumber(q->value(0).toString()), + RDCut::cutNumber(q->value(0).toString()), + q->value(1).toString(),q->value(2).toString()); + } } } delete q; @@ -333,6 +361,55 @@ void MainObject::ClearAutoTrim(unsigned cartnum,int cutnum,const QString &title, } +void MainObject::SetAutoSegue(unsigned cartnum,int cutnum,const QString &title, + const QString &desc) +{ + RDTrimAudio::ErrorCode err; + RDCart *cart=new RDCart(cartnum); + RDCut *cut=new RDCut(cartnum,cutnum); + RDTrimAudio *trimmer=new RDTrimAudio(set_station,set_config,this); + trimmer->setCartNumber(cartnum); + trimmer->setCutNumber(cutnum); + trimmer->setTrimLevel(100*set_auto_segue); + if((err=trimmer->runTrim(set_user->name(),set_user->password()))== + RDTrimAudio::ErrorOk) { + int end=trimmer->endPoint(); + if(endendPoint()) { + cut->setSegueStartPoint(end); + cut->setSegueEndPoint(cut->endPoint()); + Print(QString().sprintf(" setting segue-start for %06u / %03d [", + cartnum,cutnum)+title+" / "+desc+ + QString().sprintf("] at %d dBFS",set_auto_segue)); + } + else { + Print(QString().sprintf(" segue-start for %06u / %03d [", + cartnum,cutnum)+title+" / "+desc+ + "] cannot be set beyond end marker"); + } + } + else { + if(err!=RDTrimAudio::ErrorNoAudio) { + fprintf(stderr,"rdmarkerset: cart %06u, cut %d trimmer error [%s]\n", + cartnum,cutnum,(const char *)RDTrimAudio::errorText(err)); + exit(256); + } + } + delete trimmer; + delete cut; + delete cart; +} + + +void MainObject::ClearAutoSegue(unsigned cartnum,int cutnum, + const QString &title,const QString &desc) +{ + RDCut *cut=new RDCut(cartnum,cutnum); + cut->setSegueStartPoint(-1); + cut->setSegueEndPoint(-1); + delete cut; +} + + void MainObject::Print(const QString &msg) { if(set_verbose) { diff --git a/utils/rdmarkerset/rdmarkerset.h b/utils/rdmarkerset/rdmarkerset.h index 35d826d1..0cc7881f 100644 --- a/utils/rdmarkerset/rdmarkerset.h +++ b/utils/rdmarkerset/rdmarkerset.h @@ -37,7 +37,7 @@ #include #include -#define RDMARKERSET_USAGE "[options]\nThe following options are recognized:\n\n--group=\n Apply marker changes to the group specified by . This\n option may be given multiple times.\n\n--all-groups\n Apply marker changes to ALL groups.\n\n--auto-trim=\n Auto-trim the specified cuts to the level indicated by dBFS.\n Specifying a '0' for will remove auto-trim --i.e. move the\n Start and End markers to the extreme start and end of the audio data.\n\n--verbose\n Print messages to stdout describing progress.\n\n" +#define RDMARKERSET_USAGE "[options]\nThe following options are recognized:\n\n--group=\n Apply marker changes to the group specified by . This\n option may be given multiple times.\n\n--all-groups\n Apply marker changes to ALL groups.\n\n--auto-trim=\n Auto-trim the specified cuts to the level indicated by dBFS.\n Specifying a '0' for will remove auto-trim --i.e. move the\n Start and End markers to the extreme start and end of the audio data.\n Default action is to leave the Start and End markers unaltered.\n\n--auto-segue=\n Set the Segue Start marker on the specified cuts to the level indicated\n by dBFS and the Segue End marker to the position of the End\n marker. Specifying a '0' for will remove the segue markers.\n Default action is to leave the segue markers unaltered.\n\n--verbose\n Print messages to stdout describing progress.\n\n" class MainObject : public QObject { @@ -54,10 +54,15 @@ class MainObject : public QObject const QString &desc); void ClearAutoTrim(unsigned cartnum,int cutnum,const QString &title, const QString &desc); + void SetAutoSegue(unsigned cartnum,int cutnum,const QString &title, + const QString &desc); + void ClearAutoSegue(unsigned cartnum,int cutnum,const QString &title, + const QString &desc); void Print(const QString &msg); bool set_all_groups; std::vector set_group_names; int set_auto_trim; + int set_auto_segue; bool set_verbose; RDStation *set_station; RDRipc *set_ripc;