2015-08-30 Fred Gleason <fredg@paravelsystems.com>

* Added a --frames=' parameter in 'tests/audio_peaks_test.cpp'.
	* Fixed a benchpost bug in generating peak energy data in
	'lib/rdwavefile.cpp'.
This commit is contained in:
Fred Gleason 2015-08-31 12:03:45 -04:00
parent c9eb7884fc
commit 07869f9ee9
4 changed files with 28 additions and 2 deletions

View File

@ -14864,3 +14864,7 @@
* Incremented the package version to 2.10.3-pcm24.0.
2015-08-30 Fred Gleason <fredg@paravelsystems.com>
* Incremented the package version to 2.10.3pcm24.0.
2015-08-30 Fred Gleason <fredg@paravelsystems.com>
* Added a --frames=' parameter in 'tests/audio_peaks_test.cpp'.
* Fixed a benchpost bug in generating peak energy data in
'lib/rdwavefile.cpp'.

View File

@ -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"));

View File

@ -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);

View File

@ -23,7 +23,7 @@
#include <qobject.h>
#define AUDIO_PEAKS_TEST_USAGE "[options]\n\nTest the Rivendell audio peak routines\n\nOptions are:\n--filename=<wav-file>\n\n"
#define AUDIO_PEAKS_TEST_USAGE "[options]\n\nTest the Rivendell audio peak routines\n\nOptions are:\n--filename=<wav-file>\n File to process.\n\n--frame=<num>\n Print value for block number <num>.\n\n"
class MainObject : public QObject
{