mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-13 16:15:51 +01:00
2014-08-14 Fred Gleason <fredg@paravelsystems.com>
* Fixed warnings in 'lib/rdaudioconvert.cpp'. * Fixed warnings in 'lib/rdaudioexport.cpp'. * Fixed warnings in 'lib/rdaudioimport.cpp'. * Fixed warnings in 'lib/rdcart_dialog.cpp'. * Fixed warnings in 'lib/rdconf.cpp'. * Fixed warnings in 'lib/rdcopyaudio.cpp'. * Fixed warnings in 'lib/rdescape_string.cpp'. * Fixed warnings in 'lib/rdevent_line.cpp'. * Fixed warnings in 'lib/rdfeed.cpp'. * Refactored 'RDOneShot' to use int values in 'lib/rdoneshot.cpp' and 'lib/rdoneshot.h'. * Fixed warnings in 'lib/rdpeaksexport.cpp'. * Fixed warnings in 'lib/rdtrimaudio.cpp'. * Fixed warnings in 'lib/rdwavefile.cpp'. * Fixed warnings in 'rdhpi/rdhpiplaystream.cpp'. * Fixed warnings in 'rdhpi/rdhpirecordstream.cpp'. * Fixed warnings in 'rdhpi/rdhpisoundcard.cpp'. * Fixed warnings in 'pam_rd/pam_rd.cpp'. * Fixed warnings in 'rdadmin/edit_rdairplay.cpp'. * Fixed warnings in 'rdairplay/list_log.cpp'. * Fixed warnings in 'rdairplay/log_play.cpp'. * Fixed warnings in 'rdairplay/pie_counter.cpp'. * Fixed warnings in 'rdairplay/rlm_host.cpp'. * Fixed warnings in 'rdcatchd/rdcatchd.cpp'. * Fixed warnings in 'rdlogedit/editlog.cpp'. * Fixed warnings in 'rdlogmanager/rdlogmanager.cpp'. * Fixed warnings in 'rdrepl/replfactory.h'. * Fixed warnings in 'ripcd/acu1p.cpp' and 'ripcd/acu1p.h'. * Fixed warnings in 'ripcd/bt16x2.cpp' and 'ripcd/bt16x2.h'. * Fixed warnings in 'ripcd/btss164.cpp' and 'ripcd/btss164.h'. * Fixed warnings in 'ripcd/btss42.cpp' and 'ripcd/btss42.h'. * Fixed warnings in 'ripcd/btss44.cpp' and 'ripcd/btss44.h'. * Fixed warnings in 'ripcd/btss82.cpp' and 'ripcd/btss82.h'. * Fixed warnings in 'ripcd/btsrc16.cpp' and 'ripcd/btsrc16.h'. * Fixed warnings in 'ripcd/btsrc8iii.cpp' and 'ripcd/btsrc8iii.h'. * Fixed warnings in 'ripcd/livewire_mcastgpio.cpp'. * Fixed warnings in 'ripcd/local_gpio.cpp' and 'ripcd/local_gpio.h'. * Fixed warnings in 'ripcd/sas64000gpi.cpp' and 'ripcd/sas64000gpi.h'. * Fixed warnings in 'ripcd/vguest.cpp' and 'ripcd/vguest.h'. * Fixed warnings in 'utils/rdhpiinfo/rdhpiinfo.cpp' * Fixed warnings in 'utils/rdgen/wavlib.cpp' * Fixed warnings in 'utils/rdimport/rdimport.cpp' * Fixed warnings in 'utils/rdsoftkeys/rdsoftkeys.cpp' * Fixed warnings in 'web/rdxport/export.cpp'
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <syslog.h>
|
||||
#include <fcntl.h>
|
||||
#include <qobject.h>
|
||||
#include <qwidget.h>
|
||||
@@ -39,7 +40,6 @@ RDHPIRecordStream::RDHPIRecordStream(RDHPISoundCard *card,
|
||||
QWidget *parent,const char *name)
|
||||
:QObject(parent,name),RDWaveFile()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
int quan;
|
||||
uint16_t type[HPI_MAX_ADAPTERS];
|
||||
|
||||
@@ -79,9 +79,9 @@ RDHPIRecordStream::RDHPIRecordStream(RDHPISoundCard *card,
|
||||
card_index[i]=i;
|
||||
}
|
||||
#else
|
||||
hpi_err=HPI_SubSysGetNumAdapters(NULL,&quan);
|
||||
LogHpi(HPI_SubSysGetNumAdapters(NULL,&quan));
|
||||
for(int i=0;i<quan;i++) {
|
||||
hpi_err=HPI_SubSysGetAdapter(NULL,i,card_index+i,type+i);
|
||||
LogHpi(HPI_SubSysGetAdapter(NULL,i,card_index+i,type+i));
|
||||
}
|
||||
#endif // HPI_VER
|
||||
|
||||
@@ -179,7 +179,6 @@ bool RDHPIRecordStream::formatSupported(RDWaveFile::Format format)
|
||||
struct hpi_format hformat;
|
||||
#endif
|
||||
hpi_handle_t histream;
|
||||
hpi_err_t hpi_err;
|
||||
bool found=false;
|
||||
|
||||
if(card_number<0) {
|
||||
@@ -207,34 +206,34 @@ bool RDHPIRecordStream::formatSupported(RDWaveFile::Format format)
|
||||
}
|
||||
switch(format) {
|
||||
case RDWaveFile::Pcm8:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),
|
||||
HPI_FORMAT_PCM8_UNSIGNED,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
LogHpi(HPI_FormatCreate(&hformat,getChannels(),
|
||||
HPI_FORMAT_PCM8_UNSIGNED,
|
||||
getSamplesPerSec(),getHeadBitRate(),0));
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
case RDWaveFile::Pcm16:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),
|
||||
HPI_FORMAT_PCM16_SIGNED,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
LogHpi(HPI_FormatCreate(&hformat,getChannels(),
|
||||
HPI_FORMAT_PCM16_SIGNED,
|
||||
getSamplesPerSec(),getHeadBitRate(),0));
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
case RDWaveFile::MpegL1:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L1,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L1,
|
||||
getSamplesPerSec(),getHeadBitRate(),0));
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
case RDWaveFile::MpegL2:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L2,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L2,
|
||||
getSamplesPerSec(),getHeadBitRate(),0));
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
case RDWaveFile::MpegL3:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L3,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L3,
|
||||
getSamplesPerSec(),getHeadBitRate(),0));
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
@@ -243,7 +242,7 @@ bool RDHPIRecordStream::formatSupported(RDWaveFile::Format format)
|
||||
break;
|
||||
}
|
||||
if(!is_open) {
|
||||
hpi_err=HPI_InStreamClose(NULL,histream);
|
||||
LogHpi(HPI_InStreamClose(NULL,histream));
|
||||
}
|
||||
if(state!=0) {
|
||||
return false;
|
||||
@@ -526,8 +525,6 @@ bool RDHPIRecordStream::recordReady()
|
||||
|
||||
void RDHPIRecordStream::record()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: received record()\n");
|
||||
}
|
||||
@@ -538,8 +535,8 @@ void RDHPIRecordStream::record()
|
||||
recordReady();
|
||||
}
|
||||
record_started=false;
|
||||
hpi_err=HPI_InStreamReset(NULL,hpi_stream);
|
||||
hpi_err=HPI_InStreamStart(NULL,hpi_stream);
|
||||
LogHpi(HPI_InStreamReset(NULL,hpi_stream));
|
||||
LogHpi(HPI_InStreamStart(NULL,hpi_stream));
|
||||
is_recording=true;
|
||||
is_paused=false;
|
||||
emit isStopped(false);
|
||||
@@ -556,21 +553,19 @@ void RDHPIRecordStream::record()
|
||||
|
||||
void RDHPIRecordStream::pause()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: received pause()\n");
|
||||
}
|
||||
if(!is_recording) {
|
||||
return;
|
||||
}
|
||||
hpi_err=HPI_InStreamStop(NULL,hpi_stream);
|
||||
LogHpi(HPI_InStreamStop(NULL,hpi_stream));
|
||||
tickClock();
|
||||
hpi_err=HPI_InStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size,
|
||||
&data_recorded,&samples_recorded,&reserved);
|
||||
LogHpi(HPI_InStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size,
|
||||
&data_recorded,&samples_recorded,&reserved));
|
||||
is_recording=false;
|
||||
is_paused=true;
|
||||
hpi_err=HPI_InStreamStart(NULL,hpi_stream);
|
||||
LogHpi(HPI_InStreamStart(NULL,hpi_stream));
|
||||
emit paused();
|
||||
emit stateChanged(card_number,stream_number,2); // Paused
|
||||
if(debug) {
|
||||
@@ -582,13 +577,11 @@ void RDHPIRecordStream::pause()
|
||||
|
||||
void RDHPIRecordStream::stop()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: received stop()\n");
|
||||
}
|
||||
if(is_ready|is_recording|is_paused) {
|
||||
hpi_err=HPI_InStreamStop(NULL,hpi_stream);
|
||||
LogHpi(HPI_InStreamStop(NULL,hpi_stream));
|
||||
tickClock();
|
||||
clock->stop();
|
||||
is_recording=false;
|
||||
@@ -626,11 +619,9 @@ void RDHPIRecordStream::setRecordLength(int length)
|
||||
|
||||
void RDHPIRecordStream::tickClock()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_InStreamGetInfoEx(NULL,hpi_stream,
|
||||
&state,&buffer_size,&data_recorded,
|
||||
&samples_recorded,&reserved);
|
||||
LogHpi(HPI_InStreamGetInfoEx(NULL,hpi_stream,
|
||||
&state,&buffer_size,&data_recorded,
|
||||
&samples_recorded,&reserved));
|
||||
if((!record_started)&&(is_recording)) {
|
||||
if(samples_recorded>0) {
|
||||
if(record_length>0) {
|
||||
@@ -647,23 +638,22 @@ void RDHPIRecordStream::tickClock()
|
||||
}
|
||||
while(data_recorded>fragment_size) {
|
||||
#if HPI_VER > 0x00030500
|
||||
hpi_err=HPI_InStreamReadBuf(NULL,hpi_stream,pdata,fragment_size);
|
||||
LogHpi(HPI_InStreamReadBuf(NULL,hpi_stream,pdata,fragment_size));
|
||||
#else
|
||||
hpi_err=HPI_InStreamRead(NULL,hpi_stream,&hpi_data);
|
||||
LogHpi(HPI_InStreamRead(NULL,hpi_stream,&hpi_data));
|
||||
#endif
|
||||
if(is_recording) {
|
||||
writeWave(pdata,fragment_size);
|
||||
}
|
||||
hpi_err=HPI_InStreamGetInfoEx(NULL,hpi_stream,
|
||||
&state,&buffer_size,&data_recorded,
|
||||
&samples_recorded,&reserved);
|
||||
LogHpi(HPI_InStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size,
|
||||
&data_recorded,&samples_recorded,&reserved));
|
||||
}
|
||||
if(state==HPI_STATE_STOPPED) {
|
||||
#if HPI_VER > 0x00030500
|
||||
hpi_err=HPI_InStreamReadBuf(NULL,hpi_stream,pdata,data_recorded);
|
||||
LogHpi(HPI_InStreamReadBuf(NULL,hpi_stream,pdata,data_recorded));
|
||||
#else
|
||||
hpi_err=HPI_DataCreate(&hpi_data,&format,pdata,data_recorded);
|
||||
hpi_err=HPI_InStreamRead(NULL,hpi_stream,&hpi_data);
|
||||
LogHpi(HPI_DataCreate(&hpi_data,&format,pdata,data_recorded));
|
||||
LogHpi(HPI_InStreamRead(NULL,hpi_stream,&hpi_data));
|
||||
#endif
|
||||
if(is_recording) {
|
||||
writeWave(pdata,data_recorded);
|
||||
@@ -696,8 +686,17 @@ bool RDHPIRecordStream::GetStream()
|
||||
|
||||
void RDHPIRecordStream::FreeStream()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_InStreamClose(NULL,hpi_stream);
|
||||
LogHpi(HPI_InStreamClose(NULL,hpi_stream));
|
||||
}
|
||||
|
||||
|
||||
hpi_err_t RDHPIRecordStream::LogHpi(hpi_err_t err)
|
||||
{
|
||||
char err_txt[200];
|
||||
|
||||
if(err!=0) {
|
||||
HPI_GetErrorText(err,err_txt);
|
||||
syslog(LOG_NOTICE,"HPI Error: %s",err_txt);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user