mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 17:13:47 +02: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:
@@ -21,6 +21,7 @@
|
||||
//
|
||||
//
|
||||
|
||||
#include <syslog.h>
|
||||
|
||||
#include <qtimer.h>
|
||||
#include <rdhpisoundcard.h>
|
||||
@@ -226,18 +227,15 @@ RDHPISoundCard::SourceNode RDHPISoundCard::getInputPortMux(int card,int port)
|
||||
{
|
||||
uint16_t type;
|
||||
uint16_t index;
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_Multiplexer_GetSource(NULL,input_mux_control[card][port],
|
||||
&type,&index);
|
||||
LogHpi(HPI_Multiplexer_GetSource(NULL,input_mux_control[card][port],
|
||||
&type,&index));
|
||||
return (RDHPISoundCard::SourceNode)type;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::setInputPortMux(int card,int port,RDHPISoundCard::SourceNode node)
|
||||
{
|
||||
hpi_err_t hpi_error;
|
||||
|
||||
switch(node) {
|
||||
case RDHPISoundCard::LineIn:
|
||||
if(HPI_Multiplexer_SetSource(NULL,
|
||||
@@ -247,10 +245,9 @@ bool RDHPISoundCard::setInputPortMux(int card,int port,RDHPISoundCard::SourceNod
|
||||
}
|
||||
break;
|
||||
case RDHPISoundCard::AesEbuIn:
|
||||
if((hpi_error=
|
||||
HPI_Multiplexer_SetSource(NULL,
|
||||
input_mux_control[card][port],node,
|
||||
input_mux_index[card][port][1]))!=0) {
|
||||
if(HPI_Multiplexer_SetSource(NULL,
|
||||
input_mux_control[card][port],node,
|
||||
input_mux_index[card][port][1])!=0) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@@ -265,12 +262,11 @@ bool RDHPISoundCard::setInputPortMux(int card,int port,RDHPISoundCard::SourceNod
|
||||
unsigned short RDHPISoundCard::getInputPortError(int card,int port)
|
||||
{
|
||||
uint16_t error_word=0;
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(input_port_aesebu[card][port]) {
|
||||
hpi_err=HPI_AESEBU_Receiver_GetErrorStatus(NULL,
|
||||
input_port_aesebu_control[card][port],
|
||||
&error_word);
|
||||
LogHpi(HPI_AESEBU_Receiver_GetErrorStatus(NULL,
|
||||
input_port_aesebu_control[card][port],
|
||||
&error_word));
|
||||
}
|
||||
return error_word;
|
||||
}
|
||||
@@ -366,64 +362,55 @@ int RDHPISoundCard::tunerHighFrequency(int card,int port,
|
||||
|
||||
bool RDHPISoundCard::inputStreamMeter(int card,int stream,short *level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(card>=card_quantity) {
|
||||
return false;
|
||||
}
|
||||
if(stream>=card_input_streams[card]) {
|
||||
return false;
|
||||
}
|
||||
hpi_err=HPI_MeterGetPeak(NULL,
|
||||
input_stream_meter_control[card][stream],level);
|
||||
LogHpi(HPI_MeterGetPeak(NULL,
|
||||
input_stream_meter_control[card][stream],level));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::outputStreamMeter(int card,int stream,short *level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(card>=card_quantity) {
|
||||
return false;
|
||||
}
|
||||
if(stream>=card_output_streams[card]) {
|
||||
return false;
|
||||
}
|
||||
hpi_err=HPI_MeterGetPeak(NULL,
|
||||
output_stream_meter_control[card][stream],level);
|
||||
LogHpi(HPI_MeterGetPeak(NULL,
|
||||
output_stream_meter_control[card][stream],level));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::inputPortMeter(int card,int port,short *level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(card>=card_quantity) {
|
||||
return false;
|
||||
}
|
||||
if(port>=card_input_ports[card]) {
|
||||
return false;
|
||||
}
|
||||
hpi_err=HPI_MeterGetPeak(NULL,
|
||||
input_port_meter_control[card][port],level);
|
||||
LogHpi(HPI_MeterGetPeak(NULL,
|
||||
input_port_meter_control[card][port],level));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::outputPortMeter(int card,int port,short *level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(card>=card_quantity) {
|
||||
return false;
|
||||
}
|
||||
if(port>=card_output_ports[card]) {
|
||||
return false;
|
||||
}
|
||||
hpi_err=HPI_MeterGetPeak(NULL,
|
||||
output_port_meter_control[card][port],level);
|
||||
LogHpi(HPI_MeterGetPeak(NULL,output_port_meter_control[card][port],level));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -471,10 +458,9 @@ bool RDHPISoundCard::haveInputStreamMux(int card,int stream) const
|
||||
int RDHPISoundCard::getInputVolume(int card,int stream,int port)
|
||||
{
|
||||
short gain[2];
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VolumeGetGain(NULL,
|
||||
input_stream_volume_control[card][stream][port],gain);
|
||||
LogHpi(HPI_VolumeGetGain(NULL,
|
||||
input_stream_volume_control[card][stream][port],gain));
|
||||
return gain[0];
|
||||
}
|
||||
|
||||
@@ -482,10 +468,9 @@ int RDHPISoundCard::getInputVolume(int card,int stream,int port)
|
||||
int RDHPISoundCard::getOutputVolume(int card,int stream,int port)
|
||||
{
|
||||
short gain[2];
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VolumeGetGain(NULL,
|
||||
output_stream_volume_control[card][stream][port],gain);
|
||||
LogHpi(HPI_VolumeGetGain(NULL,
|
||||
output_stream_volume_control[card][stream][port],gain));
|
||||
return gain[0];
|
||||
}
|
||||
|
||||
@@ -493,10 +478,8 @@ int RDHPISoundCard::getOutputVolume(int card,int stream,int port)
|
||||
int RDHPISoundCard::getInputLevel(int card,int port)
|
||||
{
|
||||
short gain[2];
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VolumeGetGain(NULL,
|
||||
input_port_level_control[card][port],gain);
|
||||
LogHpi(HPI_VolumeGetGain(NULL,input_port_level_control[card][port],gain));
|
||||
return gain[0];
|
||||
}
|
||||
|
||||
@@ -504,10 +487,8 @@ int RDHPISoundCard::getInputLevel(int card,int port)
|
||||
int RDHPISoundCard::getOutputLevel(int card,int port)
|
||||
{
|
||||
short gain[2];
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VolumeGetGain(NULL,
|
||||
output_port_level_control[card][port],gain);
|
||||
LogHpi(HPI_VolumeGetGain(NULL,output_port_level_control[card][port],gain));
|
||||
return gain[0];
|
||||
}
|
||||
|
||||
@@ -515,31 +496,28 @@ int RDHPISoundCard::getOutputLevel(int card,int port)
|
||||
|
||||
void RDHPISoundCard::setInputVolume(int card,int stream,int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(!haveInputVolume(card,stream,0)) {
|
||||
return;
|
||||
}
|
||||
short gain[2];
|
||||
gain[0]=level;
|
||||
gain[1]=level;
|
||||
hpi_err=HPI_VolumeSetGain(NULL,
|
||||
input_stream_volume_control[card][stream][0],gain);
|
||||
LogHpi(HPI_VolumeSetGain(NULL,
|
||||
input_stream_volume_control[card][stream][0],gain));
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setOutputVolume(int card,int stream,int port,int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(!haveOutputVolume(card,stream,port)) {
|
||||
return;
|
||||
}
|
||||
short gain[2];
|
||||
gain[0]=level;
|
||||
gain[1]=level;
|
||||
hpi_err=HPI_VolumeSetGain(NULL,
|
||||
output_stream_volume_control[card][stream][port],gain);
|
||||
LogHpi(HPI_VolumeSetGain(NULL,
|
||||
output_stream_volume_control[card][stream][port],
|
||||
gain));
|
||||
}
|
||||
|
||||
|
||||
@@ -547,8 +525,6 @@ void RDHPISoundCard::setOutputVolume(int card,int stream,int port,int level)
|
||||
void RDHPISoundCard::fadeOutputVolume(int card,int stream,int port,
|
||||
int level,int length)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(!haveOutputVolume(card,stream,port)) {
|
||||
return;
|
||||
}
|
||||
@@ -556,15 +532,14 @@ void RDHPISoundCard::fadeOutputVolume(int card,int stream,int port,
|
||||
|
||||
gain[0]=level;
|
||||
gain[1]=level;
|
||||
hpi_err=HPI_VolumeAutoFadeProfile(NULL,
|
||||
output_stream_volume_control[card][stream][port],
|
||||
gain,length,hpi_fade_type);
|
||||
LogHpi(HPI_VolumeAutoFadeProfile(NULL,
|
||||
output_stream_volume_control[card][stream][port],
|
||||
gain,length,hpi_fade_type));
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setInputLevel(int card,int port,int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
short gain[HPI_MAX_CHANNELS];
|
||||
|
||||
if(!haveInputLevel(card,port)) {
|
||||
@@ -573,13 +548,12 @@ void RDHPISoundCard::setInputLevel(int card,int port,int level)
|
||||
for(unsigned i=0;i<HPI_MAX_CHANNELS;i++) {
|
||||
gain[i]=level;
|
||||
}
|
||||
hpi_err=HPI_LevelSetGain(NULL,input_port_level_control[card][port],gain);
|
||||
LogHpi(HPI_LevelSetGain(NULL,input_port_level_control[card][port],gain));
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setOutputLevel(int card,int port,int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
short gain[HPI_MAX_CHANNELS];
|
||||
|
||||
if(!haveOutputLevel(card,port)) {
|
||||
@@ -588,41 +562,34 @@ void RDHPISoundCard::setOutputLevel(int card,int port,int level)
|
||||
for(unsigned i=0;i<HPI_MAX_CHANNELS;i++) {
|
||||
gain[i]=level;
|
||||
}
|
||||
hpi_err=HPI_LevelSetGain(NULL,output_port_level_control[card][port],gain);
|
||||
LogHpi(HPI_LevelSetGain(NULL,output_port_level_control[card][port],gain));
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setInputMode(int card,int port,
|
||||
RDHPISoundCard::ChannelMode mode)
|
||||
{
|
||||
uint16_t hpi_err;
|
||||
|
||||
if(!haveInputMode(card,port)) {
|
||||
return;
|
||||
}
|
||||
hpi_err=HPI_ChannelModeSet(NULL,input_port_mode_control[card][port],mode+1);
|
||||
LogHpi(HPI_ChannelModeSet(NULL,input_port_mode_control[card][port],mode+1));
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setOutputMode(int card,int stream,
|
||||
RDHPISoundCard::ChannelMode mode)
|
||||
{
|
||||
uint16_t hpi_err;
|
||||
|
||||
if(!haveOutputMode(card,stream)) {
|
||||
return;
|
||||
}
|
||||
hpi_err=
|
||||
HPI_ChannelModeSet(NULL,output_stream_mode_control[card][stream],mode+1);
|
||||
LogHpi(HPI_ChannelModeSet(NULL,output_stream_mode_control[card][stream],
|
||||
mode+1));
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setInputStreamVOX(int card,int stream,short gain)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VoxSetThreshold(NULL,
|
||||
input_stream_vox_control[card][stream],gain);
|
||||
LogHpi(HPI_VoxSetThreshold(NULL,input_stream_vox_control[card][stream],gain));
|
||||
}
|
||||
|
||||
|
||||
@@ -635,17 +602,15 @@ bool RDHPISoundCard::havePassthroughVolume(int card,int in_port,int out_port)
|
||||
bool RDHPISoundCard::setPassthroughVolume(int card,int in_port,int out_port,
|
||||
int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(!passthrough_port_volume[card][in_port][out_port]) {
|
||||
return false;
|
||||
}
|
||||
short gain[2];
|
||||
gain[0]=level;
|
||||
gain[1]=level;
|
||||
hpi_err=HPI_VolumeSetGain(NULL,
|
||||
passthrough_port_volume_control[card][in_port][out_port],
|
||||
gain);
|
||||
LogHpi(HPI_VolumeSetGain(NULL,
|
||||
passthrough_port_volume_control[card][in_port][out_port],
|
||||
gain));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -678,23 +643,22 @@ void RDHPISoundCard::HPIProbe()
|
||||
uint16_t l;
|
||||
uint16_t type;
|
||||
uint16_t index;
|
||||
hpi_err_t hpi_err;
|
||||
QString str;
|
||||
|
||||
hpi_fade_type=HPI_VOLUME_AUTOFADE_LOG;
|
||||
#if HPI_VER < 0x00030600
|
||||
hpi_err=HPI_SubSysGetVersion(NULL,&dummy_hpi);
|
||||
LogHpi(HPI_SubSysGetVersion(NULL,&dummy_hpi));
|
||||
HPI_SubSysFindAdapters(NULL,(uint16_t *)&card_quantity,
|
||||
hpi_adapter_list,HPI_MAX_ADAPTERS);
|
||||
#else
|
||||
hpi_err=HPI_SubSysGetVersionEx(NULL,&dummy_hpi);
|
||||
hpi_err=HPI_SubSysGetNumAdapters(NULL,&card_quantity);
|
||||
LogHpi(HPI_SubSysGetVersionEx(NULL,&dummy_hpi));
|
||||
LogHpi(HPI_SubSysGetNumAdapters(NULL,&card_quantity));
|
||||
#endif // HPI_VER
|
||||
for(int i=0;i<card_quantity;i++) {
|
||||
#if HPI_VER < 0x00030600
|
||||
card_index[i]=i;
|
||||
#else
|
||||
hpi_err=HPI_SubSysGetAdapter(NULL,i,card_index+i,hpi_adapter_list+i);
|
||||
LogHpi(HPI_SubSysGetAdapter(NULL,i,card_index+i,hpi_adapter_list+i));
|
||||
#endif // HPI_VER
|
||||
if((hpi_adapter_list[i]&0xF000)==0x6000) {
|
||||
timescale_support[i]=true;
|
||||
@@ -715,12 +679,12 @@ void RDHPISoundCard::HPIProbe()
|
||||
card_output_ports[i]=0;
|
||||
card_description[i]=QString().sprintf("AudioScience %04X [%d]",
|
||||
hpi_adapter_list[i],i+1);
|
||||
hpi_err=HPI_AdapterOpen(NULL,card_index[i]);
|
||||
hpi_err=HPI_AdapterGetInfo(NULL,card_index[i],
|
||||
&card_output_streams[i],
|
||||
&card_input_streams[i],
|
||||
&dummy_version,(uint32_t *)&dummy_serial,
|
||||
&dummy_type);
|
||||
LogHpi(HPI_AdapterOpen(NULL,card_index[i]));
|
||||
LogHpi(HPI_AdapterGetInfo(NULL,card_index[i],
|
||||
&card_output_streams[i],
|
||||
&card_input_streams[i],
|
||||
&dummy_version,(uint32_t *)&dummy_serial,
|
||||
&dummy_type));
|
||||
hpi_info[i].setSerialNumber(dummy_serial);
|
||||
hpi_info[i].setHpiVersion(dummy_hpi);
|
||||
/*
|
||||
@@ -731,7 +695,7 @@ void RDHPISoundCard::HPIProbe()
|
||||
hpi_info[i].setDspMinorVersion((dummy_version>>7)&63);
|
||||
hpi_info[i].setPcbVersion((char)(((dummy_version>>3)&7)+'A'));
|
||||
hpi_info[i].setAssemblyVersion(dummy_version&7);
|
||||
hpi_err=HPI_AdapterClose(NULL,card_index[i]);
|
||||
LogHpi(HPI_AdapterClose(NULL,card_index[i]));
|
||||
str=QString(tr("Input Stream"));
|
||||
for(int j=0;j<card_input_streams[i];j++) {
|
||||
input_stream_description[i][j]=
|
||||
@@ -750,7 +714,7 @@ void RDHPISoundCard::HPIProbe()
|
||||
// Mixer Initialization
|
||||
//
|
||||
for(int i=0;i<card_quantity;i++) {
|
||||
hpi_err=HPI_MixerOpen(NULL,card_index[i],&hpi_mixer[i]);
|
||||
LogHpi(HPI_MixerOpen(NULL,card_index[i],&hpi_mixer[i]));
|
||||
|
||||
//
|
||||
// Get Input Ports
|
||||
@@ -798,11 +762,11 @@ void RDHPISoundCard::HPIProbe()
|
||||
card_output_ports[i]);
|
||||
}
|
||||
}
|
||||
hpi_err=HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
HPI_SOURCENODE_CLOCK_SOURCE,0,
|
||||
0,0,
|
||||
HPI_CONTROL_SAMPLECLOCK,
|
||||
&clock_source_control[i]);
|
||||
LogHpi(HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
HPI_SOURCENODE_CLOCK_SOURCE,0,
|
||||
0,0,
|
||||
HPI_CONTROL_SAMPLECLOCK,
|
||||
&clock_source_control[i]));
|
||||
for(int j=0;j<card_input_streams[i];j++) {
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // VOX Controls
|
||||
0,0,
|
||||
@@ -994,3 +958,15 @@ void RDHPISoundCard::HPIProbe()
|
||||
connect(clock_timer,SIGNAL(timeout()),this,SLOT(clock()));
|
||||
clock_timer->start(METER_INTERVAL);
|
||||
}
|
||||
|
||||
|
||||
hpi_err_t RDHPISoundCard::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