diff --git a/ChangeLog b/ChangeLog index 47601727..96721a72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14864,3 +14864,7 @@ * Incremented the package version to 2.10.3-pcm24.0. 2015-08-30 Fred Gleason * Incremented the package version to 2.10.3pcm24.0. +2015-08-30 Fred Gleason + * Added a --frames=' parameter in 'tests/audio_peaks_test.cpp'. + * Fixed a benchpost bug in generating peak energy data in + 'lib/rdwavefile.cpp'. diff --git a/lib/rdwavefile.cpp b/lib/rdwavefile.cpp index 85f7574f..5f1e3ce0 100644 --- a/lib/rdwavefile.cpp +++ b/lib/rdwavefile.cpp @@ -4146,7 +4146,7 @@ bool RDWaveFile::MakeLevl() WriteDword(levl_chunk_data,16,levl_channels); // Channels WriteDword(levl_chunk_data,20,levl_frames); // Total Peak Values WriteDword(levl_chunk_data,24,levl_peak_offset); // Offset to Peak-of-Peaks - WriteDword(levl_chunk_data,28,128); // Offset to Peak Data + WriteDword(levl_chunk_data,28,132); // Offset to Peak Data sprintf((char *)levl_chunk_data+32,"%s", (const char *)levl_timestamp.toString("yyyy:MM:dd:hh:mm:ss:000")); diff --git a/tests/audio_peaks_test.cpp b/tests/audio_peaks_test.cpp index ed1199a2..f098ae7b 100644 --- a/tests/audio_peaks_test.cpp +++ b/tests/audio_peaks_test.cpp @@ -33,6 +33,9 @@ MainObject::MainObject(QObject *parent) :QObject(parent) { QString filename; + unsigned frame=0; + bool frame_used=false; + bool ok=false; // // Read Command Options @@ -45,6 +48,15 @@ MainObject::MainObject(QObject *parent) filename=cmd->value(i); cmd->setProcessed(i,true); } + if(cmd->key(i)=="--frame") { + frame=cmd->value(i).toUInt(&ok); + if(!ok) { + fprintf(stderr,"audio_peaks_test: invalid --frame arguument\n"); + exit(256); + } + frame_used=true; + cmd->setProcessed(i,true); + } if(!cmd->processed(i)) { fprintf(stderr,"audio_peaks_test: unknown option \"%s\"\n", (const char *)cmd->value(i)); @@ -66,6 +78,16 @@ MainObject::MainObject(QObject *parent) if(wave->hasEnergy()) { printf("\"%s\" has energy, size: %u\n",(const char *)filename, wave->energySize()); + if(frame_used) { + if(wave->getChannels()==1) { + printf("frame: %u: %d\n",frame,0xFFFF&wave->energy(frame)); + } + else { + printf("frame %u: left: %d right: %d\n",frame, + 0xFFFF&wave->energy(2*frame), + 0xFFFF&wave->energy(2*frame+1)); + } + } } else { printf("\"%s\" does NOT have energy\n",(const char *)filename); diff --git a/tests/audio_peaks_test.h b/tests/audio_peaks_test.h index 089a13aa..848b9ead 100644 --- a/tests/audio_peaks_test.h +++ b/tests/audio_peaks_test.h @@ -23,7 +23,7 @@ #include -#define AUDIO_PEAKS_TEST_USAGE "[options]\n\nTest the Rivendell audio peak routines\n\nOptions are:\n--filename=\n\n" +#define AUDIO_PEAKS_TEST_USAGE "[options]\n\nTest the Rivendell audio peak routines\n\nOptions are:\n--filename=\n File to process.\n\n--frame=\n Print value for block number .\n\n" class MainObject : public QObject {