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

* Fixed regressions in 'RDCae' and the HPI driver in caed(8)
	that caused the length of audio captures to be reported incorrectly.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2023-12-18 12:23:24 -05:00
parent f06f3d1453
commit f73c7e5d4c
6 changed files with 13 additions and 6 deletions

View File

@ -24567,3 +24567,6 @@
head and tail audition buttons. head and tail audition buttons.
2023-12-15 Fred Gleason <fredg@paravelsystems.com> 2023-12-15 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in rdcatchd(8) that broke play-out events. * Fixed a regression in rdcatchd(8) that broke play-out events.
2023-12-18 Fred Gleason <fredg@paravelsystems.com>
* Fixed regressions in 'RDCae' and the HPI driver in caed(8)
that caused the length of audio captures to be reported incorrectly.

View File

@ -282,7 +282,7 @@ bool DriverHpi::loadRecord(int card,int port,int coding,int chans,int samprate,
} }
bool DriverHpi::unloadRecord(int card,int port,unsigned *len) bool DriverHpi::unloadRecord(int card,int port,unsigned *len_frames)
{ {
#ifdef HPI #ifdef HPI
if(d_record_streams[card][port]==NULL) { if(d_record_streams[card][port]==NULL) {
@ -292,7 +292,7 @@ bool DriverHpi::unloadRecord(int card,int port,unsigned *len)
d_record_streams[card][port]->pause(); d_record_streams[card][port]->pause();
} }
d_record_streams[card][port]->disconnect(); d_record_streams[card][port]->disconnect();
*len=d_record_streams[card][port]->samplesRecorded(); *len_frames=d_record_streams[card][port]->samplesRecorded();
d_record_streams[card][port]->closeWave(); d_record_streams[card][port]->closeWave();
delete d_record_streams[card][port]; delete d_record_streams[card][port];
d_record_streams[card][port]=NULL; d_record_streams[card][port]=NULL;

View File

@ -51,7 +51,7 @@ class DriverHpi : public Driver
bool timescaleSupported(int card); bool timescaleSupported(int card);
bool loadRecord(int card,int port,int coding,int chans,int samprate, bool loadRecord(int card,int port,int coding,int chans,int samprate,
int bitrate,QString wavename); int bitrate,QString wavename);
bool unloadRecord(int card,int port,unsigned *len); bool unloadRecord(int card,int port,unsigned *len_frames);
bool record(int card,int port,int length,int thres); bool record(int card,int port,int length,int thres);
bool stopRecord(int card,int port); bool stopRecord(int card,int port);
bool setClockSource(int card,int src); bool setClockSource(int card,int src);

View File

@ -589,7 +589,7 @@ void RDCae::DispatchCommand(const QString &cmd)
} }
if((cmds.at(0)=="UR")&&(cmds.size()==5)) { // Unload Record if((cmds.at(0)=="UR")&&(cmds.size()==5)) { // Unload Record
if(cmds.at(3)=='+') { if(cmds.at(4)=='+') {
int card=cmds.at(1).toInt(&ok); int card=cmds.at(1).toInt(&ok);
if(ok&&(card>=0)&&(card<RD_MAX_CARDS)) { if(ok&&(card>=0)&&(card<RD_MAX_CARDS)) {
int port=cmds.at(2).toInt(&ok); int port=cmds.at(2).toInt(&ok);

View File

@ -377,7 +377,7 @@ int RDHPIRecordStream::getPosition() const
unsigned RDHPIRecordStream::samplesRecorded() const unsigned RDHPIRecordStream::samplesRecorded() const
{ {
return samples_recorded; return samples_captured;
} }
@ -394,6 +394,7 @@ bool RDHPIRecordStream::recordReady()
} }
if((!is_recording)&&(!is_paused)) { if((!is_recording)&&(!is_paused)) {
resetWave(); resetWave();
samples_captured=0;
if(LogHpi(HPI_InStreamGetInfoEx(NULL,hpi_stream, if(LogHpi(HPI_InStreamGetInfoEx(NULL,hpi_stream,
&state,&buffer_size,&data_recorded, &state,&buffer_size,&data_recorded,
&samples_recorded,&reserved),__LINE__)!=0) { &samples_recorded,&reserved),__LINE__)!=0) {
@ -599,6 +600,7 @@ void RDHPIRecordStream::pause()
LogHpi(HPI_InStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size, LogHpi(HPI_InStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size,
&data_recorded,&samples_recorded,&reserved), &data_recorded,&samples_recorded,&reserved),
__LINE__); __LINE__);
samples_captured=samples_recorded;
is_recording=false; is_recording=false;
is_paused=true; is_paused=true;
LogHpi(HPI_InStreamStart(NULL,hpi_stream),__LINE__); LogHpi(HPI_InStreamStart(NULL,hpi_stream),__LINE__);
@ -620,6 +622,7 @@ void RDHPIRecordStream::stop()
LogHpi(HPI_InStreamStop(NULL,hpi_stream),__LINE__); LogHpi(HPI_InStreamStop(NULL,hpi_stream),__LINE__);
tickClock(); tickClock();
clock->stop(); clock->stop();
samples_captured=samples_recorded;
is_recording=false; is_recording=false;
is_paused=false; is_paused=false;
is_ready=false; is_ready=false;

View File

@ -2,7 +2,7 @@
// //
// A class for recording Microsoft WAV files. // A class for recording Microsoft WAV files.
// //
// (C) Copyright 2002-2015 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
@ -116,6 +116,7 @@ class RDHPIRecordStream : public QObject,public RDWaveFile
uint32_t buffer_size; uint32_t buffer_size;
uint32_t data_recorded; uint32_t data_recorded;
uint32_t samples_recorded; uint32_t samples_recorded;
uint32_t samples_captured;
uint32_t reserved; uint32_t reserved;
uint32_t fragment_size; uint32_t fragment_size;
int fragment_time; int fragment_time;