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:
Fred Gleason
2014-08-14 19:08:38 -04:00
parent e02e625950
commit 89b846f7d6
63 changed files with 423 additions and 448 deletions

View File

@@ -68,7 +68,7 @@ RDHPIPlayStream::RDHPIPlayStream(RDHPISoundCard *card,
QWidget *parent,const char *name)
:QObject(parent,name),RDWaveFile()
{
hpi_err_t hpi_err;
// hpi_err_t hpi_err;
int quan;
uint16_t type[HPI_MAX_ADAPTERS];
@@ -99,9 +99,9 @@ RDHPIPlayStream::RDHPIPlayStream(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
@@ -157,7 +157,6 @@ QString RDHPIPlayStream::errorString(RDHPIPlayStream::Error err)
bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
{
hpi_err_t hpi_error;
#if HPI_VER < 0x30A00
HPI_FORMAT hpi_format;
#else
@@ -177,8 +176,7 @@ bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
}
if(!is_open) {
for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) {
if((hpi_error=HPI_OutStreamOpen(NULL,card_index[card_number],i,
&hostream))==0) {
if(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hostream)==0) {
found=true;
break;
}
@@ -192,30 +190,30 @@ bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
}
switch(format) {
case RDWaveFile::Pcm16:
hpi_error=HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_PCM16_SIGNED,
getSamplesPerSec(),getHeadBitRate(),0);
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_PCM16_SIGNED,
getSamplesPerSec(),getHeadBitRate(),0));
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
break;
case RDWaveFile::MpegL1:
hpi_error=HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L1,
getSamplesPerSec(),getHeadBitRate(),0);
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L1,
getSamplesPerSec(),getHeadBitRate(),0));
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
break;
case RDWaveFile::MpegL2:
hpi_error=HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L2,
getSamplesPerSec(),getHeadBitRate(),0);
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L2,
getSamplesPerSec(),getHeadBitRate(),0));
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
break;;
case RDWaveFile::MpegL3:
hpi_error=HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L3,
getSamplesPerSec(),getHeadBitRate(),0);
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L3,
getSamplesPerSec(),getHeadBitRate(),0));
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
break;
@@ -224,7 +222,7 @@ bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
break;
}
if(!is_open) {
hpi_error=HPI_OutStreamClose(NULL,hostream);
LogHpi(HPI_OutStreamClose(NULL,hostream));
}
if(state!=0) {
return false;
@@ -385,15 +383,14 @@ bool RDHPIPlayStream::play()
#ifdef RPLAYSTREAM_SHOW_SLOTS
printf("play() -- Card: %d Stream: %d\n",card_number,stream_number);
#endif // RPLAYSTREAM_SHOW_SLOTS
hpi_err_t hpi_error;
syslog(LOG_ERR,"Play - 1\n");
if(!is_open) {
return false;
}
if((!playing)&&(!is_paused)) {
hpi_error=HPI_OutStreamSetTimeScale(NULL,hpi_stream,
LogHpi(HPI_OutStreamSetTimeScale(NULL,hpi_stream,
(uint16_t)((RD_TIMESCALE_DIVISOR/(double)play_speed)*
HPI_OSTREAM_TIMESCALE_UNITS));
HPI_OSTREAM_TIMESCALE_UNITS)));
if(HPI_OutStreamGetInfoEx(NULL,hpi_stream,
&state,&buffer_size,&data_to_play,
&samples_played,&reserved)!=0) {
@@ -415,22 +412,22 @@ bool RDHPIPlayStream::play()
case WAVE_FORMAT_VORBIS:
switch(getBitsPerSample()) {
case 8:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM8_UNSIGNED,getSamplesPerSec(),
0,0);
LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM8_UNSIGNED,
getSamplesPerSec(),0,0));
break;
case 16:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM16_SIGNED,getSamplesPerSec(),
0,0);
LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM16_SIGNED,
getSamplesPerSec(),0,0));
break;
case 32:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM32_SIGNED,getSamplesPerSec(),
0,0);
LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM32_SIGNED,
getSamplesPerSec(),0,0));
break;
default:
hpi_error=HPI_AdapterClose(NULL,card_index[card_number]);
LogHpi(HPI_AdapterClose(NULL,card_index[card_number]));
return false;
break;
}
@@ -438,22 +435,22 @@ bool RDHPIPlayStream::play()
case WAVE_FORMAT_MPEG:
switch(getHeadLayer()) {
case 1:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L1,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags());
LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L1,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags()));
break;
case 2:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L2,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags());
LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L2,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags()));
break;
case 3:
hpi_error=HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L3,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags());
LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L3,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags()));
break;
default:
hpi_error=HPI_AdapterClose(NULL,card_index[card_number]);
LogHpi(HPI_AdapterClose(NULL,card_index[card_number]));
return false;
}
break;
@@ -480,11 +477,10 @@ bool RDHPIPlayStream::play()
}
readWave(pdata,read_bytes);
#if HPI_VER > 0x00030500
hpi_error=
HPI_OutStreamWriteBuf(NULL,hpi_stream,pdata,read_bytes,&format);
LogHpi(HPI_OutStreamWriteBuf(NULL,hpi_stream,pdata,read_bytes,&format));
#else
hpi_error=HPI_DataCreate(&hpi_data,&format,pdata,read_bytes);
hpi_error=HPI_OutStreamWrite(NULL,hpi_stream,&hpi_data);
LogHpi(HPI_DataCreate(&hpi_data,&format,pdata,read_bytes));
LogHpi(HPI_OutStreamWrite(NULL,hpi_stream,&hpi_data));
#endif
if(HPI_OutStreamStart(NULL,hpi_stream)!=0) {
return false;
@@ -506,7 +502,7 @@ bool RDHPIPlayStream::play()
}
}
if((!playing)&(is_paused|repositioned)) {
hpi_error=HPI_OutStreamStart(NULL,hpi_stream);
LogHpi(HPI_OutStreamStart(NULL,hpi_stream));
clock->start(FRAGMENT_TIME);
playing=true;
stopping=false;
@@ -527,7 +523,6 @@ void RDHPIPlayStream::pause()
#ifdef RPLAYSTREAM_SHOW_SLOTS
printf("pause() -- Card: %d Stream: %d\n",card_number,stream_number);
#endif // RPLAYSTREAM_SHOW_SLOTS
hpi_err_t hpi_error;
uint16_t state;
uint32_t buffer_size;
uint32_t data_to_play;
@@ -537,10 +532,10 @@ void RDHPIPlayStream::pause()
return;
}
if(playing) {
hpi_error=HPI_OutStreamStop(NULL,hpi_stream);
LogHpi(HPI_OutStreamStop(NULL,hpi_stream));
clock->stop();
hpi_error=HPI_OutStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size,
&data_to_play,&samples_played,&reserved);
LogHpi(HPI_OutStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size,
&data_to_play,&samples_played,&reserved));
switch(getFormatTag()) {
case WAVE_FORMAT_PCM:
samples_pending=data_to_play/(getChannels()*getBitsPerSample()/8);
@@ -569,18 +564,17 @@ void RDHPIPlayStream::stop()
printf("stop() -- Card: %d Stream: %d\n",card_number,stream_number);
#endif // RPLAYSTREAM_SHOW_SLOTS
hpi_err_t hpi_error;
if(!is_open) {
return;
}
if(playing|is_paused) {
hpi_error=HPI_OutStreamStop(NULL,hpi_stream);
LogHpi(HPI_OutStreamStop(NULL,hpi_stream));
clock->stop();
playing=false;
is_paused=false;
seekWave(0,SEEK_SET);
hpi_error=HPI_OutStreamReset(NULL,hpi_stream);
LogHpi(HPI_OutStreamReset(NULL,hpi_stream));
samples_pending=0;
samples_skipped=0;
stream_state=RDHPIPlayStream::Stopped;
@@ -610,8 +604,6 @@ int RDHPIPlayStream::currentPosition()
bool RDHPIPlayStream::setPosition(unsigned samples)
{
hpi_err_t hpi_error;
#ifdef RPLAYSTREAM_SHOW_SLOTS
printf("setPosition(%d) -- Card: %d Stream: %d\n",samples,
card_number,stream_number);
@@ -629,7 +621,7 @@ bool RDHPIPlayStream::setPosition(unsigned samples)
is_paused=false;
repositioned=true;
}
hpi_error=HPI_OutStreamReset(NULL,hpi_stream);
LogHpi(HPI_OutStreamReset(NULL,hpi_stream));
samples_played=0;
switch(getFormatTag()) {
case WAVE_FORMAT_PCM:
@@ -755,12 +747,10 @@ void RDHPIPlayStream::Drained()
int RDHPIPlayStream::GetStream()
{
hpi_err_t hpi_error;
#ifdef RDHPIPLAYSTREAM_USE_LOCAL_MUTEX
for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) {
if(++stream_mutex[card_number][i]==1) {
hpi_error=HPI_OutStreamOpen(NULL,card_index[card_number],i,&hpi_stream);
LogHpi(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hpi_stream));
stream_number=i;
return stream_number;
}
@@ -784,15 +774,25 @@ int RDHPIPlayStream::GetStream()
void RDHPIPlayStream::FreeStream()
{
hpi_err_t hpi_error;
#ifdef RDHPIPLAYSTREAM_USE_LOCAL_MUTEX
stream_mutex[card_number][stream_number]--;
hpi_error=HPI_OutStreamClose(NULL,hpi_stream);
LogHpi(HPI_OutStreamClose(NULL,hpi_stream));
stream_number=-1;
#else
hpi_error=HPI_OutStreamClose(NULL,hpi_stream);
LogHpi(HPI_OutStreamClose(NULL,hpi_stream));
// syslog(LOG_ERR,"HPI closing ostream: %d",stream_number);
stream_number=-1;
#endif
}
hpi_err_t RDHPIPlayStream::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;
}