Merged v2.16

This commit is contained in:
Fred Gleason 2018-03-30 13:51:23 -04:00
commit 779c36c246
43 changed files with 670 additions and 1788 deletions

View File

@ -16757,3 +16757,16 @@
2018-03-25 Fred Gleason <fredg@paravelsystems.com> 2018-03-25 Fred Gleason <fredg@paravelsystems.com>
* Removed the conditional installation of 'rdalsaconfig-root' * Removed the conditional installation of 'rdalsaconfig-root'
when building RPMs. when building RPMs.
2018-03-30 Fred Gleason <fredg@paravelsystems.com>
* Added support for DMA bus-mastering to the HPI driver.
2018-03-30 Fred Gleason <fredg@paravelsystems.com>
* Updated switch() statement formatting in 'rdhpi/'.
2018-03-30 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdlogmanager(1) that caused DB corruption when
a clock was deleted while still being assigned to a grid.
2018-03-30 Fred Gleason <fredg@paravelsystems.com>
* Removed rdhpiinfo(8).
2018-03-30 Fred Gleason <fredg@paravelsystems.com>
* Removed event checks when update Playout events in rdcatch(1).
2018-03-30 Fred Gleason <fredg@paravelsystems.com>
* Updated the date in the copyright notice in rdadmin(1).

24
NEWS
View File

@ -1,5 +1,29 @@
The NEWS file for the Rivendell package. The NEWS file for the Rivendell package.
-------------------------------------------------------------------------------
v2.19.1 -- 3/27/2018
Changes:
HPI Support. Implemented support for DMA bus-mastering for AudioScience
HPI devices.
RDHpiInfo. Removed rdhpiinfo(8). Replaced by the stand-alone 'hpiinfo'
package.
RDCatch Play Events. Removed the event time check for Playout events in
rdcatch(1), as there is no sane way to determine a consistently 'free'
playout time in the face of shifting cut lengths.
RDLogManager. Fixed a bug in rdlogmanager(1) that caused DB corruption
when a clock was deleted while still being assigned to a grid.
Database Update:
This version of Rivendell uses database schema version 275, and will
automatically upgrade any earlier versions. To see the current schema
version prior to upgrade, see RDAdmin->SystemInfo.
As always, be sure to run RDAdmin immediately after upgrading to allow
any necessary changes to the database schema to be applied.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
v2.19.0 -- 2/22/2018 v2.19.0 -- 2/22/2018

View File

@ -1 +1 @@
2.19.0 2.19.1

View File

@ -306,21 +306,17 @@ if test $HPI_FOUND ; then
AC_SUBST(HPI_FILE2,$LIB_PATH/librdhpi.a) AC_SUBST(HPI_FILE2,$LIB_PATH/librdhpi.a)
AC_SUBST(HPI_FILE3,$LIB_PATH/librdhpi.la) AC_SUBST(HPI_FILE3,$LIB_PATH/librdhpi.la)
AC_SUBST(HPI_FILE4,$LIB_PATH/librdhpi.so) AC_SUBST(HPI_FILE4,$LIB_PATH/librdhpi.so)
AC_SUBST(HPI_FILE5,$PREFIX/bin/rdhpiinfo) AC_SUBST(HPI_FILE5,"")
if test $ar_gcc_distro = suse ; then AC_SUBST(HPI_FILE6,"")
AC_SUBST(HPI_FILE6,"")
else
AC_SUBST(HPI_FILE6,$PREFIX/bin/rdhpiinfo-root)
fi
AC_SUBST(HPI_FILE7,$PREFIX/share/rivendell/rdhpi_es.qm) AC_SUBST(HPI_FILE7,$PREFIX/share/rivendell/rdhpi_es.qm)
AC_SUBST(HPI_FILE8,$PREFIX/share/rivendell/rdhpi_cs.qm) AC_SUBST(HPI_FILE8,$PREFIX/share/rivendell/rdhpi_cs.qm)
AC_SUBST(HPI_FILE9,$PREFIX/share/rivendell/rdhpi_de.qm) AC_SUBST(HPI_FILE9,$PREFIX/share/rivendell/rdhpi_de.qm)
AC_SUBST(HPI_FILE10,$PREFIX/share/rivendell/rdhpi_nn.qm) AC_SUBST(HPI_FILE10,$PREFIX/share/rivendell/rdhpi_nn.qm)
AC_SUBST(HPI_FILE11,$PREFIX/share/rivendell/rdhpi_nb.qm) AC_SUBST(HPI_FILE11,$PREFIX/share/rivendell/rdhpi_nb.qm)
AC_SUBST(HPI_FILE12,$PREFIX/share/rivendell/rdhpi_pt_BR.qm) AC_SUBST(HPI_FILE12,$PREFIX/share/rivendell/rdhpi_pt_BR.qm)
AC_SUBST(HPI_FILE13,$PREFIX/share/applications/rivendell-rdhpiinfo-root.desktop) AC_SUBST(HPI_FILE13,"")
AC_SUBST(HPI_FILE14,/etc/pam.d/rdhpiinfo-root) AC_SUBST(HPI_FILE14,"")
AC_SUBST(HPI_FILE15,/etc/security/console.apps/rdhpiinfo-root) AC_SUBST(HPI_FILE15,"")
else else
AC_SUBST(LIBHPI,"") AC_SUBST(LIBHPI,"")
AC_SUBST(HPI_FILE1,"") AC_SUBST(HPI_FILE1,"")
@ -521,7 +517,6 @@ AC_CONFIG_FILES([rivendell.spec \
utils/rdexport/Makefile \ utils/rdexport/Makefile \
utils/rdgen/Makefile \ utils/rdgen/Makefile \
utils/rdgpimon/Makefile \ utils/rdgpimon/Makefile \
utils/rdhpiinfo/Makefile \
utils/rdimport/Makefile \ utils/rdimport/Makefile \
utils/rdmaint/Makefile \ utils/rdmaint/Makefile \
utils/rdmarkerset/Makefile \ utils/rdmarkerset/Makefile \

View File

@ -126,7 +126,7 @@ InfoDialog::InfoDialog(QWidget *parent)
// //
// Signature // Signature
// //
str=QString(tr("Copyright 2002-2014")); str=QString(tr("Copyright 2002-2018"));
label=new QLabel(QString().sprintf("%s %s",(const char *)str, label=new QLabel(QString().sprintf("%s %s",(const char *)str,
PACKAGE_BUGREPORT),this); PACKAGE_BUGREPORT),this);
label->setGeometry(10,87,sizeHint().width()-20,14); label->setGeometry(10,87,sizeHint().width()-20,14);

View File

@ -4421,7 +4421,11 @@ GNU Library General Public License. Klepněte na tlačítko pro zobrazení povol
</message> </message>
<message> <message>
<source>Copyright 2002-2014</source> <source>Copyright 2002-2014</source>
<translation type="unfinished">Autorské právo 2002-2014</translation> <translation type="obsolete">Autorské právo 2002-2014</translation>
</message>
<message>
<source>Copyright 2002-2018</source>
<translation type="unfinished">Autorské právo 2002-2018</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -4369,7 +4369,11 @@ anzeigen</translation>
</message> </message>
<message> <message>
<source>Copyright 2002-2014</source> <source>Copyright 2002-2014</source>
<translation type="unfinished">Copyright 2002-2014</translation> <translation type="obsolete">Copyright 2002-2014</translation>
</message>
<message>
<source>Copyright 2002-2018</source>
<translation type="unfinished">Copyright 2002-2018</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -4376,7 +4376,11 @@ PARA UN PROPÓSITO PARTICULAR. Oprima el botón &quot;Ver licencia&quot; para d
</message> </message>
<message> <message>
<source>Copyright 2002-2014</source> <source>Copyright 2002-2014</source>
<translation type="unfinished">Copyright 2002-2014</translation> <translation type="obsolete">Copyright 2002-2014</translation>
</message>
<message>
<source>Copyright 2002-2018</source>
<translation type="unfinished">Copyright 2002-2018</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -3901,7 +3901,7 @@ PARTICULAR PURPOSE. Touch the &quot;View License&quot; button for details.</sou
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>Copyright 2002-2014</source> <source>Copyright 2002-2018</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View File

@ -4343,7 +4343,11 @@ Klikk på &quot;Lisens&quot;-knappen for fleire opplysningar.</translation>
</message> </message>
<message> <message>
<source>Copyright 2002-2014</source> <source>Copyright 2002-2014</source>
<translation type="unfinished">Copyright 2002-2014</translation> <translation type="obsolete">Copyright 2002-2014</translation>
</message>
<message>
<source>Copyright 2002-2018</source>
<translation type="unfinished">Copyright 2002-2018</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -4343,7 +4343,11 @@ Klikk på &quot;Lisens&quot;-knappen for fleire opplysningar.</translation>
</message> </message>
<message> <message>
<source>Copyright 2002-2014</source> <source>Copyright 2002-2014</source>
<translation type="unfinished">Copyright 2002-2014</translation> <translation type="obsolete">Copyright 2002-2014</translation>
</message>
<message>
<source>Copyright 2002-2018</source>
<translation type="unfinished">Copyright 2002-2018</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -4362,7 +4362,11 @@ FINALIDADE PARTICULAR. Aperte o botão VER LICENÇA para mais detalhes.</transl
</message> </message>
<message> <message>
<source>Copyright 2002-2014</source> <source>Copyright 2002-2014</source>
<translation type="unfinished">Copyright 2002-2009 {2002-2014?}</translation> <translation type="obsolete">Copyright 2002-2009 {2002-2014?}</translation>
</message>
<message>
<source>Copyright 2002-2018</source>
<translation type="unfinished">Copyright 2002-2009 {2002-2018?}</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -333,11 +333,6 @@ void EditPlayout::selectCutData()
void EditPlayout::saveasData() void EditPlayout::saveasData()
{ {
if(!CheckEvent(true)) {
QMessageBox::warning(this,tr("Duplicate Event"),
tr("An event with these parameters already exists!"));
return;
}
delete edit_recording; delete edit_recording;
edit_recording=new RDRecording(-1,true); edit_recording=new RDRecording(-1,true);
edit_added_events->push_back(edit_recording->id()); edit_added_events->push_back(edit_recording->id());
@ -347,11 +342,6 @@ void EditPlayout::saveasData()
void EditPlayout::okData() void EditPlayout::okData()
{ {
if(!CheckEvent(false)) {
QMessageBox::warning(this,tr("Duplicate Event"),
tr("An event with these parameters already exists!"));
return;
}
Save(); Save();
done(0); done(0);
} }
@ -451,72 +441,3 @@ void EditPlayout::Save()
edit_recording->setSun(edit_sun_button->isChecked()); edit_recording->setSun(edit_sun_button->isChecked());
edit_recording->setOneShot(edit_oneshot_box->isChecked()); edit_recording->setOneShot(edit_oneshot_box->isChecked());
} }
bool EditPlayout::CheckEvent(bool include_myself)
{
char station[65];
char gunk[3];
int chan;
QTime test_start_time;
QTime test_end_time;
RDCut *cut=new RDCut(edit_cutname);
QTime start_time=edit_starttime_edit->time();
QTime end_time=edit_starttime_edit->time().addMSecs(cut->length());
delete cut;
sscanf((const char *)edit_station_box->currentText(),"%s%s%d",
station,gunk,&chan);
QString sql=
QString().sprintf("select RECORDINGS.START_TIME,CUTS.LENGTH\
from RECORDINGS left join CUTS\
on(RECORDINGS.CUT_NAME=CUTS.CUT_NAME)\
where (RECORDINGS.STATION_NAME=\"%s\")&&\
(RECORDINGS.TYPE=%d)&&(RECORDINGS.CHANNEL=%d)",
station,RDRecording::Playout,chan+128);
if(edit_sun_button->isChecked()) {
sql+="&&(RECORDINGS.SUN=\"Y\")";
}
if(edit_mon_button->isChecked()) {
sql+="&&(RECORDINGS.MON=\"Y\")";
}
if(edit_tue_button->isChecked()) {
sql+="&&(RECORDINGS.TUE=\"Y\")";
}
if(edit_wed_button->isChecked()) {
sql+="&&(RECORDINGS.WED=\"Y\")";
}
if(edit_thu_button->isChecked()) {
sql+="&&(RECORDINGS.THU=\"Y\")";
}
if(edit_fri_button->isChecked()) {
sql+="&&(RECORDINGS.FRI=\"Y\")";
}
if(edit_sat_button->isChecked()) {
sql+="&&(RECORDINGS.SAT=\"Y\")";
}
if(!include_myself) {
sql+=QString().sprintf("&&(RECORDINGS.ID!=%d)",edit_recording->id());
}
RDSqlQuery *q=new RDSqlQuery(sql);
while(q->next()) {
test_start_time=q->value(0).toTime();
test_end_time=q->value(0).toTime().addMSecs(q->value(1).toUInt());
if(test_end_time<test_start_time) {
test_end_time=QTime(23,59,59);
}
if(((start_time<test_start_time)&&(start_time<test_end_time)&&
(end_time<test_start_time)&&(end_time<test_end_time))||
((start_time>test_start_time)&&(start_time>test_end_time)&&
(end_time>test_start_time)&&(end_time>test_end_time))) {
}
else {
delete q;
return false;
}
}
delete q;
return true;
}

View File

@ -59,7 +59,6 @@ class EditPlayout : public QDialog
private: private:
void PopulateDecks(QComboBox *box); void PopulateDecks(QComboBox *box);
void Save(); void Save();
bool CheckEvent(bool include_myself);
RDDeck *edit_deck; RDDeck *edit_deck;
RDRecording *edit_recording; RDRecording *edit_recording;
QCheckBox *edit_active_button; QCheckBox *edit_active_button;

View File

@ -432,11 +432,11 @@ nové</translation>
</message> </message>
<message> <message>
<source>Duplicate Event</source> <source>Duplicate Event</source>
<translation>Zdvojená událost</translation> <translation type="obsolete">Zdvojená událost</translation>
</message> </message>
<message> <message>
<source>An event with these parameters already exists!</source> <source>An event with these parameters already exists!</source>
<translation>Událost s těmito parametry již existuje!</translation> <translation type="obsolete">Událost s těmito parametry již existuje!</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -432,11 +432,11 @@ Neu</translation>
</message> </message>
<message> <message>
<source>Duplicate Event</source> <source>Duplicate Event</source>
<translation>Doppeltes Event</translation> <translation type="obsolete">Doppeltes Event</translation>
</message> </message>
<message> <message>
<source>An event with these parameters already exists!</source> <source>An event with these parameters already exists!</source>
<translation>Ein Event mit diesen Parametern existiert bereits!</translation> <translation type="obsolete">Ein Event mit diesen Parametern existiert bereits!</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -426,11 +426,11 @@ como Nuevo</translation>
</message> </message>
<message> <message>
<source>Duplicate Event</source> <source>Duplicate Event</source>
<translation>Evento duplicado</translation> <translation type="obsolete">Evento duplicado</translation>
</message> </message>
<message> <message>
<source>An event with these parameters already exists!</source> <source>An event with these parameters already exists!</source>
<translation>¡Un evento con esos parámetros ya existe!</translation> <translation type="obsolete">¡Un evento con esos parámetros ya existe!</translation>
</message> </message>
<message> <message>
<source>&amp;Save As <source>&amp;Save As

View File

@ -427,14 +427,6 @@ New</source>
<source>&amp;Cancel</source> <source>&amp;Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Duplicate Event</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An event with these parameters already exists!</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditRecording</name> <name>EditRecording</name>

View File

@ -429,11 +429,11 @@ New</source>
</message> </message>
<message> <message>
<source>Duplicate Event</source> <source>Duplicate Event</source>
<translation>Kopier hending</translation> <translation type="obsolete">Kopier hending</translation>
</message> </message>
<message> <message>
<source>An event with these parameters already exists!</source> <source>An event with these parameters already exists!</source>
<translation>Det finst alt ei hending med dette oppsettet!</translation> <translation type="obsolete">Det finst alt ei hending med dette oppsettet!</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -429,11 +429,11 @@ New</source>
</message> </message>
<message> <message>
<source>Duplicate Event</source> <source>Duplicate Event</source>
<translation>Kopier hending</translation> <translation type="obsolete">Kopier hending</translation>
</message> </message>
<message> <message>
<source>An event with these parameters already exists!</source> <source>An event with these parameters already exists!</source>
<translation>Det finst alt ei hending med dette oppsettet!</translation> <translation type="obsolete">Det finst alt ei hending med dette oppsettet!</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -432,11 +432,11 @@ Novo</translation>
</message> </message>
<message> <message>
<source>Duplicate Event</source> <source>Duplicate Event</source>
<translation>Duplicar Evento</translation> <translation type="obsolete">Duplicar Evento</translation>
</message> </message>
<message> <message>
<source>An event with these parameters already exists!</source> <source>An event with these parameters already exists!</source>
<translation>Um Evento com estes parâmetros existe!</translation> <translation type="obsolete">Um Evento com estes parâmetros existe!</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -2,7 +2,7 @@
// //
// A class for playing Microsoft WAV files. // A class for playing Microsoft WAV files.
// //
// (C) Copyright 2002-2007,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2007,2016-2018 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
@ -66,7 +66,10 @@ RDHPIPlayStream::RDHPIPlayStream(RDHPISoundCard *card,QWidget *parent)
// hpi_err_t hpi_err; // hpi_err_t hpi_err;
int quan; int quan;
uint16_t type[HPI_MAX_ADAPTERS]; uint16_t type[HPI_MAX_ADAPTERS];
struct hpi_format fmt;
uint32_t dma_size=0;
dma_buffer_size=0;
sound_card=card; sound_card=card;
card_number=-1; card_number=-1;
stream_number=-1; stream_number=-1;
@ -94,16 +97,28 @@ RDHPIPlayStream::RDHPIPlayStream(RDHPISoundCard *card,QWidget *parent)
card_index[i]=i; card_index[i]=i;
} }
#else #else
LogHpi(HPI_SubSysGetNumAdapters(NULL,&quan)); LogHpi(HPI_SubSysGetNumAdapters(NULL,&quan),__LINE__);
for(int i=0;i<quan;i++) { for(int i=0;i<quan;i++) {
LogHpi(HPI_SubSysGetAdapter(NULL,i,card_index+i,type+i)); LogHpi(HPI_SubSysGetAdapter(NULL,i,card_index+i,type+i),__LINE__);
} }
#endif // HPI_VER #endif // HPI_VER
clock=new QTimer(this,"clock"); //
// Calculate DMA Buffer Size
//
memset(&fmt,0,sizeof(fmt)); // Worst case situation
fmt.dwSampleRate=48000;
fmt.wChannels=2;
fmt.wFormat=HPI_FORMAT_PCM32_FLOAT;
if(LogHpi(HPI_StreamEstimateBufferSize(&fmt,FRAGMENT_TIME,&dma_size),
__LINE__)==0) {
dma_buffer_size=dma_size;
}
clock=new QTimer(this);
connect(clock,SIGNAL(timeout()),this,SLOT(tickClock())); connect(clock,SIGNAL(timeout()),this,SLOT(tickClock()));
play_timer=new QTimer(this,"play_timer"); play_timer=new QTimer(this);
connect(play_timer,SIGNAL(timeout()),this,SLOT(pause())); connect(play_timer,SIGNAL(timeout()),this,SLOT(pause()));
} }
@ -126,26 +141,26 @@ QString RDHPIPlayStream::errorString(RDHPIPlayStream::Error err)
QString str; QString str;
switch(err) { switch(err) {
case RDHPIPlayStream::Ok: case RDHPIPlayStream::Ok:
return QString(tr("Ok")); return QString(tr("Ok"));
break; break;
case RDHPIPlayStream::NoFile: case RDHPIPlayStream::NoFile:
return QString(tr("No such file or directory")); return QString(tr("No such file or directory"));
break; break;
case RDHPIPlayStream::NoStream: case RDHPIPlayStream::NoStream:
return QString(tr("No output stream available")); return QString(tr("No output stream available"));
break; break;
case RDHPIPlayStream::AlreadyOpen: case RDHPIPlayStream::AlreadyOpen:
return QString(tr("Stream is already open")); return QString(tr("Stream is already open"));
break; break;
default: default:
str=QString(tr("Unknown Error:")); str=QString(tr("Unknown Error:"));
return QString().sprintf("%s %d\n",(const char *)str,err); return QString().sprintf("%s %d\n",(const char *)str,err);
break; break;
} }
} }
@ -171,7 +186,9 @@ bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
} }
if(!is_open) { if(!is_open) {
for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) { for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) {
if(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hostream)==0) { if(LogHpi(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hostream),
__LINE__)==0) {
syslog(LOG_NOTICE,"buffer_size: %u\n",dma_buffer_size);
found=true; found=true;
break; break;
} }
@ -179,52 +196,58 @@ bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
if(!found) { if(!found) {
return false; return false;
} }
if(LogHpi(HPI_OutStreamHostBufferAllocate(NULL,hostream,dma_buffer_size),
__LINE__)!=0) {
LogHpi(HPI_OutStreamClose(NULL,hostream),__LINE__);
return false;
}
} }
else { else {
hostream=hpi_stream; hostream=hpi_stream;
} }
switch(format) { switch(format) {
case RDWaveFile::Pcm16: case RDWaveFile::Pcm16:
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(), LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_PCM16_SIGNED, HPI_FORMAT_PCM16_SIGNED,
getSamplesPerSec(),getHeadBitRate(),0)); getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format); state=LogHpi(HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format),__LINE__);
break; break;
case RDWaveFile::Pcm24: case RDWaveFile::Pcm24:
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(), LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_PCM24_SIGNED, HPI_FORMAT_PCM24_SIGNED,
getSamplesPerSec(),getHeadBitRate(),0)); getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format); state=LogHpi(HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format),__LINE__);
break; break;
case RDWaveFile::MpegL1: case RDWaveFile::MpegL1:
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(), LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L1, HPI_FORMAT_MPEG_L1,
getSamplesPerSec(),getHeadBitRate(),0)); getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format); state=LogHpi(HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format),__LINE__);
break; break;
case RDWaveFile::MpegL2: case RDWaveFile::MpegL2:
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(), LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L2, HPI_FORMAT_MPEG_L2,
getSamplesPerSec(),getHeadBitRate(),0)); getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format); state=LogHpi(HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format),__LINE__);
break;; break;
case RDWaveFile::MpegL3: case RDWaveFile::MpegL3:
LogHpi(HPI_FormatCreate(&hpi_format,getChannels(), LogHpi(HPI_FormatCreate(&hpi_format,getChannels(),
HPI_FORMAT_MPEG_L3, HPI_FORMAT_MPEG_L3,
getSamplesPerSec(),getHeadBitRate(),0)); getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format); state=LogHpi(HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format),__LINE__);
break; break;
default: default:
state=1; state=1;
break; break;
} }
if(!is_open) { if(!is_open) {
LogHpi(HPI_OutStreamClose(NULL,hostream)); LogHpi(HPI_OutStreamHostBufferFree(NULL,hostream),__LINE__);
LogHpi(HPI_OutStreamClose(NULL,hostream),__LINE__);
} }
if(state!=0) { if(state!=0) {
return false; return false;
@ -236,46 +259,46 @@ bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
bool RDHPIPlayStream::formatSupported() bool RDHPIPlayStream::formatSupported()
{ {
switch(getFormatTag()) { switch(getFormatTag()) {
case WAVE_FORMAT_PCM: case WAVE_FORMAT_PCM:
switch(getBitsPerSample()) { switch(getBitsPerSample()) {
case 8: case 8:
return formatSupported(RDWaveFile::Pcm8); return formatSupported(RDWaveFile::Pcm8);
break; break;
case 16: case 16:
return formatSupported(RDWaveFile::Pcm16); return formatSupported(RDWaveFile::Pcm16);
break; break;
case 24: case 24:
return formatSupported(RDWaveFile::Pcm24); return formatSupported(RDWaveFile::Pcm24);
break; break;
default: default:
return false; return false;
} }
break; break;
case WAVE_FORMAT_MPEG: case WAVE_FORMAT_MPEG:
switch(getHeadLayer()) { switch(getHeadLayer()) {
case 1: case 1:
return formatSupported(RDWaveFile::MpegL1); return formatSupported(RDWaveFile::MpegL1);
break; break;
case 2: case 2:
return formatSupported(RDWaveFile::MpegL2); return formatSupported(RDWaveFile::MpegL2);
break; break;
case 3: case 3:
return formatSupported(RDWaveFile::MpegL3); return formatSupported(RDWaveFile::MpegL3);
break; break;
default: default:
return false; return false;
} }
break; break;
default: default:
return false; return false;
} }
} }
@ -396,10 +419,10 @@ bool RDHPIPlayStream::play()
if((!playing)&&(!is_paused)) { if((!playing)&&(!is_paused)) {
LogHpi(HPI_OutStreamSetTimeScale(NULL,hpi_stream, LogHpi(HPI_OutStreamSetTimeScale(NULL,hpi_stream,
(uint16_t)((RD_TIMESCALE_DIVISOR/(double)play_speed)* (uint16_t)((RD_TIMESCALE_DIVISOR/(double)play_speed)*
HPI_OSTREAM_TIMESCALE_UNITS))); HPI_OSTREAM_TIMESCALE_UNITS)),__LINE__);
if(HPI_OutStreamGetInfoEx(NULL,hpi_stream, if(LogHpi(HPI_OutStreamGetInfoEx(NULL,hpi_stream,
&state,&buffer_size,&data_to_play, &state,&buffer_size,&data_to_play,
&samples_played,&reserved)!=0) { &samples_played,&reserved),__LINE__)!=0) {
return false; return false;
} }
fragment_size=buffer_size/4; fragment_size=buffer_size/4;
@ -414,62 +437,66 @@ bool RDHPIPlayStream::play()
return false; return false;
} }
switch(getFormatTag()) { switch(getFormatTag()) {
case WAVE_FORMAT_PCM: case WAVE_FORMAT_PCM:
case WAVE_FORMAT_VORBIS: case WAVE_FORMAT_VORBIS:
switch(getBitsPerSample()) { switch(getBitsPerSample()) {
case 8: case 8:
LogHpi(HPI_FormatCreate(&format,getChannels(), LogHpi(HPI_FormatCreate(&format,getChannels(),HPI_FORMAT_PCM8_UNSIGNED,
HPI_FORMAT_PCM8_UNSIGNED, getSamplesPerSec(),0,0),__LINE__);
getSamplesPerSec(),0,0)); break;
break;
case 16: case 16:
LogHpi(HPI_FormatCreate(&format,getChannels(), LogHpi(HPI_FormatCreate(&format,getChannels(),HPI_FORMAT_PCM16_SIGNED,
HPI_FORMAT_PCM16_SIGNED, getSamplesPerSec(),0,0),__LINE__);
getSamplesPerSec(),0,0)); break;
break;
case 24: case 24:
LogHpi(HPI_FormatCreate(&format,getChannels(), LogHpi(HPI_FormatCreate(&format,getChannels(),HPI_FORMAT_PCM24_SIGNED,
HPI_FORMAT_PCM24_SIGNED, getSamplesPerSec(),0,0),__LINE__);
getSamplesPerSec(),0,0)); break;
break;
case 32: case 32:
LogHpi(HPI_FormatCreate(&format,getChannels(), LogHpi(HPI_FormatCreate(&format,getChannels(),HPI_FORMAT_PCM32_SIGNED,
HPI_FORMAT_PCM32_SIGNED, getSamplesPerSec(),0,0),__LINE__);
getSamplesPerSec(),0,0)); break;
break;
default: default:
LogHpi(HPI_AdapterClose(NULL,card_index[card_number])); LogHpi(HPI_AdapterClose(NULL,card_index[card_number]),__LINE__);
return false; return false;
break; }
} break;
break; case WAVE_FORMAT_MPEG:
case WAVE_FORMAT_MPEG: switch(getHeadLayer()) {
switch(getHeadLayer()) { case 1:
case 1: LogHpi(HPI_FormatCreate(&format,getChannels(),HPI_FORMAT_MPEG_L1,
LogHpi(HPI_FormatCreate(&format,getChannels(), getSamplesPerSec(),getHeadBitRate(),
HPI_FORMAT_MPEG_L1,getSamplesPerSec(), getHeadFlags()),__LINE__);
getHeadBitRate(),getHeadFlags())); break;
break;
case 2: case 2:
LogHpi(HPI_FormatCreate(&format,getChannels(), LogHpi(HPI_FormatCreate(&format,getChannels(),HPI_FORMAT_MPEG_L2,
HPI_FORMAT_MPEG_L2,getSamplesPerSec(), getSamplesPerSec(),getHeadBitRate(),
getHeadBitRate(),getHeadFlags())); getHeadFlags()),__LINE__);
break; break;
case 3:
LogHpi(HPI_FormatCreate(&format,getChannels(), case 3:
HPI_FORMAT_MPEG_L3,getSamplesPerSec(), LogHpi(HPI_FormatCreate(&format,getChannels(),
getHeadBitRate(),getHeadFlags())); HPI_FORMAT_MPEG_L3,getSamplesPerSec(),
break; getHeadBitRate(),getHeadFlags()),__LINE__);
default: break;
LogHpi(HPI_AdapterClose(NULL,card_index[card_number]));
return false; default:
} LogHpi(HPI_AdapterClose(NULL,card_index[card_number]),__LINE__);
break; return false;
default: }
return false; break;
default:
return false;
} }
#if HPI_VER < 0x00030500 #if HPI_VER < 0x00030500
if(HPI_DataCreate(&hpi_data,&format,pdata,fragment_size)!=0) { if(LogHpi(HPI_DataCreate(&hpi_data,&format,pdata,fragment_size),__LINE__)!=
0) {
return false; return false;
} }
#endif #endif
@ -488,15 +515,15 @@ bool RDHPIPlayStream::play()
} }
readWave(pdata,read_bytes); readWave(pdata,read_bytes);
#if HPI_VER > 0x00030500 #if HPI_VER > 0x00030500
LogHpi(HPI_OutStreamWriteBuf(NULL,hpi_stream,pdata,read_bytes,&format)); LogHpi(HPI_OutStreamWriteBuf(NULL,hpi_stream,pdata,read_bytes,&format),
__LINE__);
#else #else
LogHpi(HPI_DataCreate(&hpi_data,&format,pdata,read_bytes)); LogHpi(HPI_DataCreate(&hpi_data,&format,pdata,read_bytes),__LINE__);
LogHpi(HPI_OutStreamWrite(NULL,hpi_stream,&hpi_data)); LogHpi(HPI_OutStreamWrite(NULL,hpi_stream,&hpi_data),__LINE__);
#endif #endif
if(HPI_OutStreamStart(NULL,hpi_stream)!=0) { if(LogHpi(HPI_OutStreamStart(NULL,hpi_stream),__LINE__)!=0) {
return false; return false;
} }
clock->start(50);
clock->start(FRAGMENT_TIME); clock->start(FRAGMENT_TIME);
playing=true; playing=true;
is_paused=false; is_paused=false;
@ -513,7 +540,7 @@ bool RDHPIPlayStream::play()
} }
} }
if((!playing)&(is_paused|repositioned)) { if((!playing)&(is_paused|repositioned)) {
LogHpi(HPI_OutStreamStart(NULL,hpi_stream)); LogHpi(HPI_OutStreamStart(NULL,hpi_stream),__LINE__);
clock->start(FRAGMENT_TIME); clock->start(FRAGMENT_TIME);
playing=true; playing=true;
stopping=false; stopping=false;
@ -543,19 +570,20 @@ void RDHPIPlayStream::pause()
return; return;
} }
if(playing) { if(playing) {
LogHpi(HPI_OutStreamStop(NULL,hpi_stream)); LogHpi(HPI_OutStreamStop(NULL,hpi_stream),__LINE__);
clock->stop(); clock->stop();
LogHpi(HPI_OutStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size, LogHpi(HPI_OutStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size,
&data_to_play,&samples_played,&reserved)); &data_to_play,&samples_played,&reserved),
__LINE__);
switch(getFormatTag()) { switch(getFormatTag()) {
case WAVE_FORMAT_PCM: case WAVE_FORMAT_PCM:
samples_pending=data_to_play/(getChannels()*getBitsPerSample()/8); samples_pending=data_to_play/(getChannels()*getBitsPerSample()/8);
break; break;
case WAVE_FORMAT_MPEG: case WAVE_FORMAT_MPEG:
samples_pending= samples_pending=
1152*data_to_play/(144*getHeadBitRate()/getSamplesPerSec()); 1152*data_to_play/(144*getHeadBitRate()/getSamplesPerSec());
break; break;
} }
playing=false; playing=false;
is_paused=true; is_paused=true;
@ -580,12 +608,12 @@ void RDHPIPlayStream::stop()
return; return;
} }
if(playing|is_paused) { if(playing|is_paused) {
LogHpi(HPI_OutStreamStop(NULL,hpi_stream)); LogHpi(HPI_OutStreamStop(NULL,hpi_stream),__LINE__);
clock->stop(); clock->stop();
playing=false; playing=false;
is_paused=false; is_paused=false;
seekWave(0,SEEK_SET); seekWave(0,SEEK_SET);
LogHpi(HPI_OutStreamReset(NULL,hpi_stream)); LogHpi(HPI_OutStreamReset(NULL,hpi_stream),__LINE__);
samples_pending=0; samples_pending=0;
samples_skipped=0; samples_skipped=0;
stream_state=RDHPIPlayStream::Stopped; stream_state=RDHPIPlayStream::Stopped;
@ -632,26 +660,27 @@ bool RDHPIPlayStream::setPosition(unsigned samples)
is_paused=false; is_paused=false;
repositioned=true; repositioned=true;
} }
LogHpi(HPI_OutStreamReset(NULL,hpi_stream)); LogHpi(HPI_OutStreamReset(NULL,hpi_stream),__LINE__);
samples_played=0; samples_played=0;
switch(getFormatTag()) { switch(getFormatTag()) {
case WAVE_FORMAT_PCM: case WAVE_FORMAT_PCM:
case WAVE_FORMAT_VORBIS: case WAVE_FORMAT_VORBIS:
samples_skipped= samples_skipped=
(unsigned)((double)getBlockAlign()* (unsigned)((double)getBlockAlign()*
((double)samples/(double)getBlockAlign())); ((double)samples/(double)getBlockAlign()));
seekWave((int)((double)samples_skipped*(double)getBlockAlign()), seekWave((int)((double)samples_skipped*(double)getBlockAlign()),
SEEK_SET); SEEK_SET);
break; break;
case WAVE_FORMAT_MPEG:
samples_skipped= case WAVE_FORMAT_MPEG:
(unsigned)((double)getBlockAlign()* samples_skipped=
((double)samples/(double)getBlockAlign())); (unsigned)((double)getBlockAlign()*
seekWave((int)((double)(getAvgBytesPerSec())* ((double)samples/(double)getBlockAlign()));
((double)(samples_skipped)/ seekWave((int)((double)(getAvgBytesPerSec())*
((double)getSamplesPerSec()))), ((double)(samples_skipped)/
SEEK_SET); ((double)getSamplesPerSec()))),
break; SEEK_SET);
break;
} }
emit position(samples); emit position(samples);
} }
@ -686,24 +715,25 @@ void RDHPIPlayStream::tickClock()
char hpi_text[100]; char hpi_text[100];
int n; int n;
hpi_err=HPI_OutStreamGetInfoEx(NULL,hpi_stream, hpi_err=LogHpi(HPI_OutStreamGetInfoEx(NULL,hpi_stream,
&state,&buffer_size,&data_to_play, &state,&buffer_size,&data_to_play,
&samples_played,&reserved); &samples_played,&reserved),__LINE__);
if(!stopping) { if(!stopping) {
while((buffer_size-data_to_play)>=fragment_size) { while((buffer_size-data_to_play)>=fragment_size) {
n=readWave(pdata,fragment_size); n=readWave(pdata,fragment_size);
if((n<=0)||(((uint32_t)n)<fragment_size)) { if((n<=0)||(((uint32_t)n)<fragment_size)) {
// End of file // End of file
#if HPI_VER > 0x00030500 #if HPI_VER > 0x00030500
if((hpi_err=HPI_OutStreamWriteBuf(NULL,hpi_stream, if((hpi_err=LogHpi(HPI_OutStreamWriteBuf(NULL,hpi_stream,
pdata,n,&format))!=0) { pdata,n,&format),__LINE__))!=
0) {
HPI_GetErrorText(hpi_err,hpi_text); HPI_GetErrorText(hpi_err,hpi_text);
fprintf(stderr,"*** HPI Error: %s ***\n",hpi_text); fprintf(stderr,"*** HPI Error: %s ***\n",hpi_text);
} }
#else #else
HPI_DataCreate(&hpi_data,&format,pdata,n); HPI_DataCreate(&hpi_data,&format,pdata,n);
if((hpi_err=HPI_OutStreamWrite(NULL,hpi_stream, if((hpi_err=LogHpi(HPI_OutStreamWrite(NULL,hpi_stream,
&hpi_data))!=0) { &hpi_data),__LINE__))!=0) {
HPI_GetErrorText(hpi_err,hpi_text); HPI_GetErrorText(hpi_err,hpi_text);
fprintf(stderr,"*** HPI Error: %s ***\n",hpi_text); fprintf(stderr,"*** HPI Error: %s ***\n",hpi_text);
} }
@ -714,26 +744,28 @@ void RDHPIPlayStream::tickClock()
} }
left_to_write-=n; left_to_write-=n;
#if HPI_VER > 0x00030500 #if HPI_VER > 0x00030500
hpi_err=HPI_OutStreamWriteBuf(NULL,hpi_stream, hpi_err=LogHpi(HPI_OutStreamWriteBuf(NULL,hpi_stream,pdata,n,&format),
pdata,n,&format); __LINE__);
#else #else
hpi_err=HPI_DataCreate(&hpi_data,&format,pdata,n); hpi_err=LogHpi(HPI_DataCreate(&hpi_data,&format,pdata,n),__LINE__);
hpi_err=HPI_OutStreamWrite(NULL,hpi_stream,&hpi_data); hpi_err=LogHpi(HPI_OutStreamWrite(NULL,hpi_stream,&hpi_data),__LINE__);
#endif #endif
hpi_err=HPI_OutStreamGetInfoEx(NULL,hpi_stream, hpi_err=LogHpi(HPI_OutStreamGetInfoEx(NULL,hpi_stream,
&state,&buffer_size,&data_to_play, &state,&buffer_size,&data_to_play,
&samples_played,&reserved); &samples_played,&reserved),
__LINE__);
} }
} }
else { else {
if(state==HPI_STATE_DRAINED) { if(state==HPI_STATE_DRAINED) {
hpi_err=HPI_OutStreamStop(NULL,hpi_stream); LogHpi(HPI_OutStreamStop(NULL,hpi_stream),__LINE__);
hpi_err=HPI_OutStreamClose(NULL,hpi_stream); LogHpi(HPI_OutStreamHostBufferFree(NULL,hpi_stream),__LINE__);
hpi_err=HPI_AdapterClose(NULL,card_index[card_number]); LogHpi(HPI_OutStreamClose(NULL,hpi_stream),__LINE__);
hpi_err=LogHpi(HPI_AdapterClose(NULL,card_index[card_number]),__LINE__);
clock->stop(); clock->stop();
playing=false; playing=false;
seekWave(0,SEEK_SET); seekWave(0,SEEK_SET);
hpi_err=HPI_OutStreamReset(NULL,hpi_stream); hpi_err=LogHpi(HPI_OutStreamReset(NULL,hpi_stream),__LINE__);
samples_pending=0; samples_pending=0;
samples_skipped=0; samples_skipped=0;
stream_state=RDHPIPlayStream::Stopped; stream_state=RDHPIPlayStream::Stopped;
@ -761,7 +793,10 @@ int RDHPIPlayStream::GetStream()
#ifdef RDHPIPLAYSTREAM_USE_LOCAL_MUTEX #ifdef RDHPIPLAYSTREAM_USE_LOCAL_MUTEX
for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) { for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) {
if(++stream_mutex[card_number][i]==1) { if(++stream_mutex[card_number][i]==1) {
LogHpi(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hpi_stream)); LogHpi(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hpi_stream),
__LINE__);
LogHpi(HPI_OutStreamHostBufferAllocate(NULL,hpi_stream,dma_buffer_size),
__LINE__);
stream_number=i; stream_number=i;
return stream_number; return stream_number;
} }
@ -772,7 +807,8 @@ int RDHPIPlayStream::GetStream()
return -1; return -1;
#else #else
for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) { for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) {
if(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hpi_stream)==0) { if(LogHpi(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hpi_stream),
__LINE__)==0) {
stream_number=i; stream_number=i;
// syslog(LOG_ERR,"HPI allocating ostream: %d",stream_number); // syslog(LOG_ERR,"HPI allocating ostream: %d",stream_number);
return stream_number; return stream_number;
@ -787,23 +823,25 @@ void RDHPIPlayStream::FreeStream()
{ {
#ifdef RDHPIPLAYSTREAM_USE_LOCAL_MUTEX #ifdef RDHPIPLAYSTREAM_USE_LOCAL_MUTEX
stream_mutex[card_number][stream_number]--; stream_mutex[card_number][stream_number]--;
LogHpi(HPI_OutStreamClose(NULL,hpi_stream)); LogHpi(HPI_OutStreamHostBufferFree(NULL,hpi_stream),__LINE__);
LogHpi(HPI_OutStreamClose(NULL,hpi_stream),__LINE__);
stream_number=-1; stream_number=-1;
#else #else
LogHpi(HPI_OutStreamClose(NULL,hpi_stream)); LogHpi(HPI_OutStreamHostBufferFree(NULL,hpi_stream),__LINE__);
LogHpi(HPI_OutStreamClose(NULL,hpi_stream),__LINE__);
// syslog(LOG_ERR,"HPI closing ostream: %d",stream_number); // syslog(LOG_ERR,"HPI closing ostream: %d",stream_number);
stream_number=-1; stream_number=-1;
#endif #endif
} }
hpi_err_t RDHPIPlayStream::LogHpi(hpi_err_t err) hpi_err_t RDHPIPlayStream::LogHpi(hpi_err_t err,int lineno)
{ {
char err_txt[200]; char err_txt[200];
if(err!=0) { if(err!=0) {
HPI_GetErrorText(err,err_txt); HPI_GetErrorText(err,err_txt);
syslog(LOG_NOTICE,"HPI Error: %s",err_txt); syslog(LOG_NOTICE,"HPI Error: %s, %s line %d",err_txt,__FILE__,lineno);
} }
return err; return err;
} }

View File

@ -87,7 +87,7 @@ class RDHPIPlayStream : public QObject,public RDWaveFile
void Drained(); void Drained();
int GetStream(); int GetStream();
void FreeStream(); void FreeStream();
hpi_err_t LogHpi(hpi_err_t err); hpi_err_t LogHpi(hpi_err_t err,int lineno);
RDHPISoundCard *sound_card; RDHPISoundCard *sound_card;
RDHPIPlayStream::State stream_state; RDHPIPlayStream::State stream_state;
QString wave_name; QString wave_name;
@ -130,6 +130,7 @@ class RDHPIPlayStream : public QObject,public RDWaveFile
bool restart_transport; bool restart_transport;
int samples_pending; int samples_pending;
unsigned current_position; unsigned current_position;
uint32_t dma_buffer_size;
}; };

View File

@ -2,7 +2,7 @@
// //
// A class for recording Microsoft WAV files. // A class for recording Microsoft WAV files.
// //
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2018 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
@ -37,6 +37,8 @@ RDHPIRecordStream::RDHPIRecordStream(RDHPISoundCard *card,QWidget *parent)
{ {
int quan; int quan;
uint16_t type[HPI_MAX_ADAPTERS]; uint16_t type[HPI_MAX_ADAPTERS];
struct hpi_format fmt;
uint32_t dma_size=0;
if(getenv(DEBUG_VAR)==NULL) { if(getenv(DEBUG_VAR)==NULL) {
debug=false; debug=false;
@ -74,16 +76,28 @@ RDHPIRecordStream::RDHPIRecordStream(RDHPISoundCard *card,QWidget *parent)
card_index[i]=i; card_index[i]=i;
} }
#else #else
LogHpi(HPI_SubSysGetNumAdapters(NULL,&quan)); LogHpi(HPI_SubSysGetNumAdapters(NULL,&quan),__LINE__);
for(int i=0;i<quan;i++) { for(int i=0;i<quan;i++) {
LogHpi(HPI_SubSysGetAdapter(NULL,i,card_index+i,type+i)); LogHpi(HPI_SubSysGetAdapter(NULL,i,card_index+i,type+i),__LINE__);
} }
#endif // HPI_VER #endif // HPI_VER
clock=new QTimer(this,"clock"); //
// Calculate DMA Buffer Size
//
memset(&fmt,0,sizeof(fmt)); // Worst case situation
fmt.dwSampleRate=48000;
fmt.wChannels=2;
fmt.wFormat=HPI_FORMAT_PCM32_FLOAT;
if(LogHpi(HPI_StreamEstimateBufferSize(&fmt,RDHPIRECORDSTREAM_CLOCK_INTERVAL,
&dma_size),__LINE__)==0) {
dma_buffer_size=dma_size;
}
clock=new QTimer(this);
connect(clock,SIGNAL(timeout()),this,SLOT(tickClock())); connect(clock,SIGNAL(timeout()),this,SLOT(tickClock()));
length_timer=new QTimer(this,"length_timer"); length_timer=new QTimer(this);
connect(length_timer,SIGNAL(timeout()),this,SLOT(pause())); connect(length_timer,SIGNAL(timeout()),this,SLOT(pause()));
} }
@ -101,26 +115,26 @@ QString RDHPIRecordStream::errorString(RDHPIRecordStream::Error err)
QString str; QString str;
switch(err) { switch(err) {
case RDHPIRecordStream::Ok: case RDHPIRecordStream::Ok:
return QString(tr("Ok")); return QString(tr("Ok"));
break; break;
case RDHPIRecordStream::NoFile: case RDHPIRecordStream::NoFile:
return QString(tr("Unable to create/open file")); return QString(tr("Unable to create/open file"));
break; break;
case RDHPIRecordStream::NoStream: case RDHPIRecordStream::NoStream:
return QString(tr("Input stream unavailable")); return QString(tr("Input stream unavailable"));
break; break;
case RDHPIRecordStream::AlreadyOpen: case RDHPIRecordStream::AlreadyOpen:
return QString(tr("Stream is already open")); return QString(tr("Stream is already open"));
break; break;
default: default:
str=QString(tr("Unknown Error:")); str=QString(tr("Unknown Error:"));
return QString().sprintf("%s %d\n",(const char *)str,err); return QString().sprintf("%s %d\n",(const char *)str,err);
break; break;
} }
} }
@ -187,7 +201,8 @@ bool RDHPIRecordStream::formatSupported(RDWaveFile::Format format)
} }
if(!is_open) { if(!is_open) {
for(int i=0;i<sound_card->getCardInputStreams(card_number);i++) { for(int i=0;i<sound_card->getCardInputStreams(card_number);i++) {
if(HPI_InStreamOpen(NULL,card_index[card_number],i,&histream)==0) { if(LogHpi(HPI_InStreamOpen(NULL,card_index[card_number],i,&histream),
__LINE__)==0) {
found=true; found=true;
break; break;
} }
@ -195,56 +210,60 @@ bool RDHPIRecordStream::formatSupported(RDWaveFile::Format format)
if(!found) { if(!found) {
return false; return false;
} }
if(LogHpi(HPI_InStreamHostBufferAllocate(NULL,histream,dma_buffer_size),
__LINE__)!=0) {
LogHpi(HPI_InStreamHostBufferFree(NULL,histream),__LINE__);
LogHpi(HPI_InStreamClose(NULL,histream),__LINE__);
return false;
}
} }
else { else {
histream=hpi_stream; histream=hpi_stream;
} }
switch(format) { switch(format) {
case RDWaveFile::Pcm8: case RDWaveFile::Pcm8:
LogHpi(HPI_FormatCreate(&hformat,getChannels(), LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_PCM8_UNSIGNED,
HPI_FORMAT_PCM8_UNSIGNED, getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
getSamplesPerSec(),getHeadBitRate(),0)); state=LogHpi(HPI_InStreamQueryFormat(NULL,histream,&hformat),__LINE__);
state=HPI_InStreamQueryFormat(NULL,histream,&hformat); break;
break;
case RDWaveFile::Pcm16: case RDWaveFile::Pcm16:
LogHpi(HPI_FormatCreate(&hformat,getChannels(), LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_PCM16_SIGNED,
HPI_FORMAT_PCM16_SIGNED, getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
getSamplesPerSec(),getHeadBitRate(),0)); state=LogHpi(HPI_InStreamQueryFormat(NULL,histream,&hformat),__LINE__);
state=HPI_InStreamQueryFormat(NULL,histream,&hformat); break;
break;
case RDWaveFile::Pcm24: case RDWaveFile::Pcm24:
LogHpi(HPI_FormatCreate(&hformat,getChannels(), LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_PCM24_SIGNED,
HPI_FORMAT_PCM24_SIGNED, getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
getSamplesPerSec(),getHeadBitRate(),0)); state=LogHpi(HPI_InStreamQueryFormat(NULL,histream,&hformat),__LINE__);
state=HPI_InStreamQueryFormat(NULL,histream,&hformat); break;
break;
case RDWaveFile::MpegL1: case RDWaveFile::MpegL1:
LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L1, LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L1,
getSamplesPerSec(),getHeadBitRate(),0)); getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
state=HPI_InStreamQueryFormat(NULL,histream,&hformat); state=LogHpi(HPI_InStreamQueryFormat(NULL,histream,&hformat),__LINE__);
break; break;
case RDWaveFile::MpegL2: case RDWaveFile::MpegL2:
LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L2, LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L2,
getSamplesPerSec(),getHeadBitRate(),0)); getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
state=HPI_InStreamQueryFormat(NULL,histream,&hformat); state=LogHpi(HPI_InStreamQueryFormat(NULL,histream,&hformat),__LINE__);
break; break;
case RDWaveFile::MpegL3: case RDWaveFile::MpegL3:
LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L3, LogHpi(HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L3,
getSamplesPerSec(),getHeadBitRate(),0)); getSamplesPerSec(),getHeadBitRate(),0),__LINE__);
state=HPI_InStreamQueryFormat(NULL,histream,&hformat); state=LogHpi(HPI_InStreamQueryFormat(NULL,histream,&hformat),__LINE__);
break; break;
default: default:
state=1; state=1;
break; break;
} }
if(!is_open) { if(!is_open) {
LogHpi(HPI_InStreamClose(NULL,histream)); LogHpi(HPI_InStreamHostBufferFree(NULL,histream),__LINE__);
LogHpi(HPI_InStreamClose(NULL,histream),__LINE__);
} }
if(state!=0) { if(state!=0) {
return false; return false;
@ -256,46 +275,46 @@ bool RDHPIRecordStream::formatSupported(RDWaveFile::Format format)
bool RDHPIRecordStream::formatSupported() bool RDHPIRecordStream::formatSupported()
{ {
switch(getFormatTag()) { switch(getFormatTag()) {
case WAVE_FORMAT_PCM: case WAVE_FORMAT_PCM:
switch(getBitsPerSample()) { switch(getBitsPerSample()) {
case 8: case 8:
return formatSupported(RDWaveFile::Pcm8); return formatSupported(RDWaveFile::Pcm8);
break; break;
case 16: case 16:
return formatSupported(RDWaveFile::Pcm16); return formatSupported(RDWaveFile::Pcm16);
break; break;
case 24: case 24:
return formatSupported(RDWaveFile::Pcm24); return formatSupported(RDWaveFile::Pcm24);
break; break;
default: default:
return false; return false;
} }
break; break;
case WAVE_FORMAT_MPEG: case WAVE_FORMAT_MPEG:
switch(getHeadLayer()) { switch(getHeadLayer()) {
case 1: case 1:
return formatSupported(RDWaveFile::MpegL1); return formatSupported(RDWaveFile::MpegL1);
break; break;
case 2: case 2:
return formatSupported(RDWaveFile::MpegL2); return formatSupported(RDWaveFile::MpegL2);
break; break;
case 3: case 3:
return formatSupported(RDWaveFile::MpegL3); return formatSupported(RDWaveFile::MpegL3);
break; break;
default: default:
return false; return false;
} }
break; break;
default: default:
return false; return false;
} }
} }
@ -381,9 +400,9 @@ bool RDHPIRecordStream::recordReady()
} }
if((!is_recording)&&(!is_paused)) { if((!is_recording)&&(!is_paused)) {
resetWave(); resetWave();
if(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)!=0) { &samples_recorded,&reserved),__LINE__)!=0) {
if(debug) { if(debug) {
printf("RDHPIRecordStream: HPI_InStreamGetInfoEx() failed\n"); printf("RDHPIRecordStream: HPI_InStreamGetInfoEx() failed\n");
} }
@ -412,27 +431,27 @@ bool RDHPIRecordStream::recordReady()
} }
switch(getBitsPerSample()) { switch(getBitsPerSample()) {
case 8: case 8:
hpi_error=HPI_FormatCreate(&format,getChannels(), hpi_error=LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM8_UNSIGNED,getSamplesPerSec(), HPI_FORMAT_PCM8_UNSIGNED,
0,0); getSamplesPerSec(),0,0),__LINE__);
break; break;
case 16: case 16:
hpi_error=HPI_FormatCreate(&format,getChannels(), hpi_error=LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM16_SIGNED,getSamplesPerSec(), HPI_FORMAT_PCM16_SIGNED,
0,0); getSamplesPerSec(),0,0),__LINE__);
break; break;
case 24: case 24:
hpi_error=HPI_FormatCreate(&format,getChannels(), hpi_error=LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM24_SIGNED,getSamplesPerSec(), HPI_FORMAT_PCM24_SIGNED,
0,0); getSamplesPerSec(),0,0),__LINE__);
break; break;
case 32: case 32:
hpi_error=HPI_FormatCreate(&format,getChannels(), hpi_error=LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM32_SIGNED,getSamplesPerSec(), HPI_FORMAT_PCM32_SIGNED,
0,0); getSamplesPerSec(),0,0),__LINE__);
break; break;
default: default:
@ -449,25 +468,29 @@ bool RDHPIRecordStream::recordReady()
} }
switch(getHeadLayer()) { switch(getHeadLayer()) {
case 1: case 1:
hpi_error=HPI_FormatCreate(&format,getChannels(), hpi_error=LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L1,getSamplesPerSec(), HPI_FORMAT_MPEG_L1,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags()); getHeadBitRate(),getHeadFlags()),
__LINE__);
break; break;
case 2: case 2:
hpi_error=HPI_FormatCreate(&format,getChannels(), hpi_error=LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L2,getSamplesPerSec(), HPI_FORMAT_MPEG_L2,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags()); getHeadBitRate(),getHeadFlags()),
__LINE__);
break; break;
case 3: case 3:
hpi_error=HPI_FormatCreate(&format,getChannels(), hpi_error=LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_MPEG_L3,getSamplesPerSec(), HPI_FORMAT_MPEG_L3,getSamplesPerSec(),
getHeadBitRate(),getHeadFlags()); getHeadBitRate(),getHeadFlags()),
__LINE__);
break; break;
default: default:
hpi_error=HPI_AdapterClose(NULL,card_index[card_number]); hpi_error=LogHpi(HPI_AdapterClose(NULL,card_index[card_number]),
__LINE__);
if(debug) { if(debug) {
printf("RDHPIRecordStream: invalid MPEG-1 layer\n"); printf("RDHPIRecordStream: invalid MPEG-1 layer\n");
} }
@ -495,9 +518,9 @@ bool RDHPIRecordStream::recordReady()
if(debug) { if(debug) {
printf("RDHPIRecordStream: using OggVorbis\n"); printf("RDHPIRecordStream: using OggVorbis\n");
} }
hpi_error=HPI_FormatCreate(&format,getChannels(), hpi_error=LogHpi(HPI_FormatCreate(&format,getChannels(),
HPI_FORMAT_PCM16_SIGNED,getSamplesPerSec(), HPI_FORMAT_PCM16_SIGNED,
0,0); getSamplesPerSec(),0,0),__LINE__);
break; break;
default: default:
@ -507,8 +530,8 @@ bool RDHPIRecordStream::recordReady()
return false; return false;
break; break;
} }
if((hpi_error=HPI_InStreamQueryFormat(NULL,hpi_stream, if((hpi_error=LogHpi(HPI_InStreamQueryFormat(NULL,hpi_stream,
&format))!=0) { &format),__LINE__))!=0) {
if(debug) { if(debug) {
HPI_GetErrorText(hpi_error,hpi_text); HPI_GetErrorText(hpi_error,hpi_text);
printf("Num: %d\n",hpi_error); printf("Num: %d\n",hpi_error);
@ -518,12 +541,12 @@ bool RDHPIRecordStream::recordReady()
} }
} }
#if HPI_VER < 0x00030500 #if HPI_VER < 0x00030500
HPI_DataCreate(&hpi_data,&format,pdata,fragment_size); LogHpi(HPI_DataCreate(&hpi_data,&format,pdata,fragment_size),__LINE__);
#endif #endif
hpi_error=HPI_InStreamSetFormat(NULL,hpi_stream,&format); hpi_error=LogHpi(HPI_InStreamSetFormat(NULL,hpi_stream,&format),__LINE__);
hpi_error=HPI_InStreamStart(NULL,hpi_stream); hpi_error=LogHpi(HPI_InStreamStart(NULL,hpi_stream),__LINE__);
// clock->start(2*fragment_time/3); // clock->start(2*fragment_time/3);
clock->start(100); clock->start(RDHPIRECORDSTREAM_CLOCK_INTERVAL);
is_ready=true; is_ready=true;
is_recording=false; is_recording=false;
is_paused=false; is_paused=false;
@ -553,8 +576,8 @@ void RDHPIRecordStream::record()
recordReady(); recordReady();
} }
record_started=false; record_started=false;
LogHpi(HPI_InStreamReset(NULL,hpi_stream)); LogHpi(HPI_InStreamReset(NULL,hpi_stream),__LINE__);
LogHpi(HPI_InStreamStart(NULL,hpi_stream)); LogHpi(HPI_InStreamStart(NULL,hpi_stream),__LINE__);
is_recording=true; is_recording=true;
is_paused=false; is_paused=false;
emit isStopped(false); emit isStopped(false);
@ -577,13 +600,14 @@ void RDHPIRecordStream::pause()
if(!is_recording) { if(!is_recording) {
return; return;
} }
LogHpi(HPI_InStreamStop(NULL,hpi_stream)); LogHpi(HPI_InStreamStop(NULL,hpi_stream),__LINE__);
tickClock(); tickClock();
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__);
is_recording=false; is_recording=false;
is_paused=true; is_paused=true;
LogHpi(HPI_InStreamStart(NULL,hpi_stream)); LogHpi(HPI_InStreamStart(NULL,hpi_stream),__LINE__);
emit paused(); emit paused();
emit stateChanged(card_number,stream_number,2); // Paused emit stateChanged(card_number,stream_number,2); // Paused
if(debug) { if(debug) {
@ -599,7 +623,7 @@ void RDHPIRecordStream::stop()
printf("RDHPIRecordStream: received stop()\n"); printf("RDHPIRecordStream: received stop()\n");
} }
if(is_ready|is_recording|is_paused) { if(is_ready|is_recording|is_paused) {
LogHpi(HPI_InStreamStop(NULL,hpi_stream)); LogHpi(HPI_InStreamStop(NULL,hpi_stream),__LINE__);
tickClock(); tickClock();
clock->stop(); clock->stop();
is_recording=false; is_recording=false;
@ -639,7 +663,7 @@ void RDHPIRecordStream::tickClock()
{ {
LogHpi(HPI_InStreamGetInfoEx(NULL,hpi_stream, LogHpi(HPI_InStreamGetInfoEx(NULL,hpi_stream,
&state,&buffer_size,&data_recorded, &state,&buffer_size,&data_recorded,
&samples_recorded,&reserved)); &samples_recorded,&reserved),__LINE__);
if((!record_started)&&(is_recording)) { if((!record_started)&&(is_recording)) {
if(samples_recorded>0) { if(samples_recorded>0) {
if(record_length>0) { if(record_length>0) {
@ -656,22 +680,23 @@ void RDHPIRecordStream::tickClock()
} }
while(data_recorded>fragment_size) { while(data_recorded>fragment_size) {
#if HPI_VER > 0x00030500 #if HPI_VER > 0x00030500
LogHpi(HPI_InStreamReadBuf(NULL,hpi_stream,pdata,fragment_size)); LogHpi(HPI_InStreamReadBuf(NULL,hpi_stream,pdata,fragment_size),__LINE__);
#else #else
LogHpi(HPI_InStreamRead(NULL,hpi_stream,&hpi_data)); LogHpi(HPI_InStreamRead(NULL,hpi_stream,&hpi_data),__LINE__);
#endif #endif
if(is_recording) { if(is_recording) {
writeWave(pdata,fragment_size); writeWave(pdata,fragment_size);
} }
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__);
} }
if(state==HPI_STATE_STOPPED) { if(state==HPI_STATE_STOPPED) {
#if HPI_VER > 0x00030500 #if HPI_VER > 0x00030500
LogHpi(HPI_InStreamReadBuf(NULL,hpi_stream,pdata,data_recorded)); LogHpi(HPI_InStreamReadBuf(NULL,hpi_stream,pdata,data_recorded),__LINE__);
#else #else
LogHpi(HPI_DataCreate(&hpi_data,&format,pdata,data_recorded)); LogHpi(HPI_DataCreate(&hpi_data,&format,pdata,data_recorded),__LINE__);
LogHpi(HPI_InStreamRead(NULL,hpi_stream,&hpi_data)); LogHpi(HPI_InStreamRead(NULL,hpi_stream,&hpi_data),__LINE__);
#endif #endif
if(is_recording) { if(is_recording) {
writeWave(pdata,data_recorded); writeWave(pdata,data_recorded);
@ -691,30 +716,38 @@ bool RDHPIRecordStream::GetStream()
char hpi_text[100]; char hpi_text[100];
if((hpi_err= if((hpi_err=
HPI_InStreamOpen(NULL,card_index[card_number],stream_number,&hpi_stream))!=0) { LogHpi(HPI_InStreamOpen(NULL,card_index[card_number],stream_number,
&hpi_stream),__LINE__))!=0) {
if(debug) { if(debug) {
HPI_GetErrorText(hpi_err,hpi_text); HPI_GetErrorText(hpi_err,hpi_text);
fprintf(stderr,"*** HPI Error: %s ***\n",hpi_text); fprintf(stderr,"*** HPI Error: %s ***\n",hpi_text);
} }
return false; return false;
} }
if(LogHpi(HPI_InStreamHostBufferAllocate(NULL,hpi_stream,dma_buffer_size),
__LINE__)!=0) {
LogHpi(HPI_InStreamHostBufferFree(NULL,hpi_stream),__LINE__);
LogHpi(HPI_InStreamClose(NULL,hpi_stream),__LINE__);
return false;
}
return true; return true;
} }
void RDHPIRecordStream::FreeStream() void RDHPIRecordStream::FreeStream()
{ {
LogHpi(HPI_InStreamClose(NULL,hpi_stream)); LogHpi(HPI_InStreamHostBufferFree(NULL,hpi_stream),__LINE__);
LogHpi(HPI_InStreamClose(NULL,hpi_stream),__LINE__);
} }
hpi_err_t RDHPIRecordStream::LogHpi(hpi_err_t err) hpi_err_t RDHPIRecordStream::LogHpi(hpi_err_t err,int lineno)
{ {
char err_txt[200]; char err_txt[200];
if(err!=0) { if(err!=0) {
HPI_GetErrorText(err,err_txt); HPI_GetErrorText(err,err_txt);
syslog(LOG_NOTICE,"HPI Error: %s",err_txt); syslog(LOG_NOTICE,"HPI Error: %s, %s line %d",err_txt,__FILE__,lineno);
} }
return err; return err;
} }

View File

@ -44,7 +44,6 @@
#define AUDIO_SIZE 32768 #define AUDIO_SIZE 32768
#define RDHPIRECORDSTREAM_CLOCK_INTERVAL 100 #define RDHPIRECORDSTREAM_CLOCK_INTERVAL 100
class RDHPIRecordStream : public QObject,public RDWaveFile class RDHPIRecordStream : public QObject,public RDWaveFile
{ {
Q_OBJECT Q_OBJECT
@ -94,7 +93,7 @@ class RDHPIRecordStream : public QObject,public RDWaveFile
private: private:
bool GetStream(); bool GetStream();
void FreeStream(); void FreeStream();
hpi_err_t LogHpi(hpi_err_t err); hpi_err_t LogHpi(hpi_err_t err,int lineno);
RDHPISoundCard *sound_card; RDHPISoundCard *sound_card;
bool debug; bool debug;
bool xrun; bool xrun;
@ -130,6 +129,7 @@ class RDHPIRecordStream : public QObject,public RDWaveFile
HPI_DATA hpi_data; HPI_DATA hpi_data;
#endif #endif
bool is_open; bool is_open;
uint32_t dma_buffer_size;
}; };

View File

@ -163,22 +163,25 @@ bool RDHPISoundCard::setClockSource(int card,RDHPISoundCard::ClockSource src)
hpi_err_t hpi_err=0; hpi_err_t hpi_err=0;
switch(src) { switch(src) {
case RDHPISoundCard::Internal: case RDHPISoundCard::Internal:
hpi_err=HPI_SampleClock_SetSource(NULL, hpi_err=HPI_SampleClock_SetSource(NULL,
clock_source_control[card], clock_source_control[card],
HPI_SAMPLECLOCK_SOURCE_LOCAL); HPI_SAMPLECLOCK_SOURCE_LOCAL);
break; break;
case RDHPISoundCard::AesEbu:
case RDHPISoundCard::SpDiff: case RDHPISoundCard::AesEbu:
hpi_err=HPI_SampleClock_SetSource(NULL, case RDHPISoundCard::SpDiff:
clock_source_control[card], hpi_err=LogHpi(HPI_SampleClock_SetSource(NULL,
HPI_SAMPLECLOCK_SOURCE_AESEBU_SYNC); clock_source_control[card],
break; HPI_SAMPLECLOCK_SOURCE_AESEBU_SYNC),__LINE__);
case RDHPISoundCard::WordClock: break;
hpi_err=HPI_SampleClock_SetSource(NULL,
clock_source_control[card], case RDHPISoundCard::WordClock:
HPI_SAMPLECLOCK_SOURCE_WORD); hpi_err=LogHpi(HPI_SampleClock_SetSource(NULL,
break; clock_source_control[card],
HPI_SAMPLECLOCK_SOURCE_WORD),
__LINE__);
break;
} }
return hpi_err==0; return hpi_err==0;
} }
@ -226,7 +229,7 @@ RDHPISoundCard::SourceNode RDHPISoundCard::getInputPortMux(int card,int port)
uint16_t index; uint16_t index;
LogHpi(HPI_Multiplexer_GetSource(NULL,input_mux_control[card][port], LogHpi(HPI_Multiplexer_GetSource(NULL,input_mux_control[card][port],
&type,&index)); &type,&index),__LINE__);
return (RDHPISoundCard::SourceNode)type; return (RDHPISoundCard::SourceNode)type;
} }
@ -234,23 +237,25 @@ RDHPISoundCard::SourceNode RDHPISoundCard::getInputPortMux(int card,int port)
bool RDHPISoundCard::setInputPortMux(int card,int port,RDHPISoundCard::SourceNode node) bool RDHPISoundCard::setInputPortMux(int card,int port,RDHPISoundCard::SourceNode node)
{ {
switch(node) { switch(node) {
case RDHPISoundCard::LineIn: case RDHPISoundCard::LineIn:
if(HPI_Multiplexer_SetSource(NULL, if(HPI_Multiplexer_SetSource(NULL,
input_mux_control[card][port], input_mux_control[card][port],node,0)!=0) {
node,0)!=0) { return false;
return false; }
} break;
break;
case RDHPISoundCard::AesEbuIn: case RDHPISoundCard::AesEbuIn:
if(HPI_Multiplexer_SetSource(NULL, if(LogHpi(HPI_Multiplexer_SetSource(NULL,
input_mux_control[card][port],node, input_mux_control[card][port],node,
input_mux_index[card][port][1])!=0) { input_mux_index[card][port][1]),
return false; __LINE__)!=0) {
} return false;
break; }
default: break;
return false;
break; default:
return false;
break;
} }
return true; return true;
} }
@ -263,7 +268,7 @@ unsigned short RDHPISoundCard::getInputPortError(int card,int port)
if(input_port_aesebu[card][port]) { if(input_port_aesebu[card][port]) {
LogHpi(HPI_AESEBU_Receiver_GetErrorStatus(NULL, LogHpi(HPI_AESEBU_Receiver_GetErrorStatus(NULL,
input_port_aesebu_control[card][port], input_port_aesebu_control[card][port],
&error_word)); &error_word),__LINE__);
} }
return error_word; return error_word;
} }
@ -279,12 +284,13 @@ void RDHPISoundCard::setFadeProfile(RDHPISoundCard::FadeProfile profile)
{ {
fade_type=profile; fade_type=profile;
switch(fade_type) { switch(fade_type) {
case RDHPISoundCard::Linear: case RDHPISoundCard::Linear:
hpi_fade_type=HPI_VOLUME_AUTOFADE_LINEAR; hpi_fade_type=HPI_VOLUME_AUTOFADE_LINEAR;
break; break;
case RDHPISoundCard::Log:
hpi_fade_type=HPI_VOLUME_AUTOFADE_LOG; case RDHPISoundCard::Log:
break; hpi_fade_type=HPI_VOLUME_AUTOFADE_LOG;
break;
} }
} }
@ -366,7 +372,8 @@ bool RDHPISoundCard::inputStreamMeter(int card,int stream,short *level)
return false; return false;
} }
LogHpi(HPI_MeterGetPeak(NULL, LogHpi(HPI_MeterGetPeak(NULL,
input_stream_meter_control[card][stream],level)); input_stream_meter_control[card][stream],level),
__LINE__);
return true; return true;
} }
@ -379,8 +386,8 @@ bool RDHPISoundCard::outputStreamMeter(int card,int stream,short *level)
if(stream>=card_output_streams[card]) { if(stream>=card_output_streams[card]) {
return false; return false;
} }
LogHpi(HPI_MeterGetPeak(NULL, LogHpi(HPI_MeterGetPeak(NULL,output_stream_meter_control[card][stream],
output_stream_meter_control[card][stream],level)); level),__LINE__);
return true; return true;
} }
@ -393,8 +400,8 @@ bool RDHPISoundCard::inputPortMeter(int card,int port,short *level)
if(port>=card_input_ports[card]) { if(port>=card_input_ports[card]) {
return false; return false;
} }
LogHpi(HPI_MeterGetPeak(NULL, LogHpi(HPI_MeterGetPeak(NULL,input_port_meter_control[card][port],level),
input_port_meter_control[card][port],level)); __LINE__);
return true; return true;
} }
@ -407,7 +414,8 @@ bool RDHPISoundCard::outputPortMeter(int card,int port,short *level)
if(port>=card_output_ports[card]) { if(port>=card_output_ports[card]) {
return false; return false;
} }
LogHpi(HPI_MeterGetPeak(NULL,output_port_meter_control[card][port],level)); LogHpi(HPI_MeterGetPeak(NULL,output_port_meter_control[card][port],level),
__LINE__);
return true; return true;
} }
@ -433,15 +441,17 @@ bool RDHPISoundCard::haveInputPortMux(int card,int port) const
bool RDHPISoundCard::queryInputPortMux(int card,int port,SourceNode node) const bool RDHPISoundCard::queryInputPortMux(int card,int port,SourceNode node) const
{ {
switch(node) { switch(node) {
case RDHPISoundCard::LineIn: case RDHPISoundCard::LineIn:
return input_port_mux_type[card][port][0]; return input_port_mux_type[card][port][0];
break; break;
case RDHPISoundCard::AesEbuIn:
return input_port_mux_type[card][port][1]; case RDHPISoundCard::AesEbuIn:
break; return input_port_mux_type[card][port][1];
default: break;
return false;
break; default:
return false;
break;
} }
} }
@ -456,8 +466,8 @@ int RDHPISoundCard::getInputVolume(int card,int stream,int port)
{ {
short gain[2]; short gain[2];
LogHpi(HPI_VolumeGetGain(NULL, LogHpi(HPI_VolumeGetGain(NULL,input_stream_volume_control[card][stream][port],
input_stream_volume_control[card][stream][port],gain)); gain),__LINE__);
return gain[0]; return gain[0];
} }
@ -466,8 +476,7 @@ int RDHPISoundCard::getOutputVolume(int card,int stream,int port)
{ {
short gain[2]; short gain[2];
LogHpi(HPI_VolumeGetGain(NULL, LogHpi(HPI_VolumeGetGain(NULL,output_stream_volume_control[card][stream][port],gain),__LINE__);
output_stream_volume_control[card][stream][port],gain));
return gain[0]; return gain[0];
} }
@ -476,7 +485,8 @@ int RDHPISoundCard::getInputLevel(int card,int port)
{ {
short gain[2]; short gain[2];
LogHpi(HPI_VolumeGetGain(NULL,input_port_level_control[card][port],gain)); LogHpi(HPI_VolumeGetGain(NULL,input_port_level_control[card][port],gain),
__LINE__);
return gain[0]; return gain[0];
} }
@ -485,7 +495,8 @@ int RDHPISoundCard::getOutputLevel(int card,int port)
{ {
short gain[2]; short gain[2];
LogHpi(HPI_VolumeGetGain(NULL,output_port_level_control[card][port],gain)); LogHpi(HPI_VolumeGetGain(NULL,output_port_level_control[card][port],gain),
__LINE__);
return gain[0]; return gain[0];
} }
@ -499,8 +510,8 @@ void RDHPISoundCard::setInputVolume(int card,int stream,int level)
short gain[2]; short gain[2];
gain[0]=level; gain[0]=level;
gain[1]=level; gain[1]=level;
LogHpi(HPI_VolumeSetGain(NULL, LogHpi(HPI_VolumeSetGain(NULL,input_stream_volume_control[card][stream][0],
input_stream_volume_control[card][stream][0],gain)); gain),__LINE__);
} }
@ -514,7 +525,7 @@ void RDHPISoundCard::setOutputVolume(int card,int stream,int port,int level)
gain[1]=level; gain[1]=level;
LogHpi(HPI_VolumeSetGain(NULL, LogHpi(HPI_VolumeSetGain(NULL,
output_stream_volume_control[card][stream][port], output_stream_volume_control[card][stream][port],
gain)); gain),__LINE__);
} }
@ -531,7 +542,7 @@ void RDHPISoundCard::fadeOutputVolume(int card,int stream,int port,
gain[1]=level; gain[1]=level;
LogHpi(HPI_VolumeAutoFadeProfile(NULL, LogHpi(HPI_VolumeAutoFadeProfile(NULL,
output_stream_volume_control[card][stream][port], output_stream_volume_control[card][stream][port],
gain,length,hpi_fade_type)); gain,length,hpi_fade_type),__LINE__);
} }
@ -545,7 +556,8 @@ void RDHPISoundCard::setInputLevel(int card,int port,int level)
for(unsigned i=0;i<HPI_MAX_CHANNELS;i++) { for(unsigned i=0;i<HPI_MAX_CHANNELS;i++) {
gain[i]=level; gain[i]=level;
} }
LogHpi(HPI_LevelSetGain(NULL,input_port_level_control[card][port],gain)); LogHpi(HPI_LevelSetGain(NULL,input_port_level_control[card][port],gain),
__LINE__);
} }
@ -559,7 +571,8 @@ void RDHPISoundCard::setOutputLevel(int card,int port,int level)
for(unsigned i=0;i<HPI_MAX_CHANNELS;i++) { for(unsigned i=0;i<HPI_MAX_CHANNELS;i++) {
gain[i]=level; gain[i]=level;
} }
LogHpi(HPI_LevelSetGain(NULL,output_port_level_control[card][port],gain)); LogHpi(HPI_LevelSetGain(NULL,output_port_level_control[card][port],gain),
__LINE__);
} }
@ -569,7 +582,8 @@ void RDHPISoundCard::setInputMode(int card,int port,
if(!haveInputMode(card,port)) { if(!haveInputMode(card,port)) {
return; return;
} }
LogHpi(HPI_ChannelModeSet(NULL,input_port_mode_control[card][port],mode+1)); LogHpi(HPI_ChannelModeSet(NULL,input_port_mode_control[card][port],mode+1),
__LINE__);
} }
@ -580,13 +594,14 @@ void RDHPISoundCard::setOutputMode(int card,int stream,
return; return;
} }
LogHpi(HPI_ChannelModeSet(NULL,output_stream_mode_control[card][stream], LogHpi(HPI_ChannelModeSet(NULL,output_stream_mode_control[card][stream],
mode+1)); mode+1),__LINE__);
} }
void RDHPISoundCard::setInputStreamVOX(int card,int stream,short gain) void RDHPISoundCard::setInputStreamVOX(int card,int stream,short gain)
{ {
LogHpi(HPI_VoxSetThreshold(NULL,input_stream_vox_control[card][stream],gain)); LogHpi(HPI_VoxSetThreshold(NULL,input_stream_vox_control[card][stream],gain),
__LINE__);
} }
@ -607,7 +622,7 @@ bool RDHPISoundCard::setPassthroughVolume(int card,int in_port,int out_port,
gain[1]=level; gain[1]=level;
LogHpi(HPI_VolumeSetGain(NULL, LogHpi(HPI_VolumeSetGain(NULL,
passthrough_port_volume_control[card][in_port][out_port], passthrough_port_volume_control[card][in_port][out_port],
gain)); gain),__LINE__);
return true; return true;
} }
@ -644,18 +659,19 @@ void RDHPISoundCard::HPIProbe()
hpi_fade_type=HPI_VOLUME_AUTOFADE_LOG; hpi_fade_type=HPI_VOLUME_AUTOFADE_LOG;
#if HPI_VER < 0x00030600 #if HPI_VER < 0x00030600
LogHpi(HPI_SubSysGetVersion(NULL,&dummy_hpi)); LogHpi(HPI_SubSysGetVersion(NULL,&dummy_hpi),__LINE__);
HPI_SubSysFindAdapters(NULL,(uint16_t *)&card_quantity, LogHpi(HPI_SubSysFindAdapters(NULL,(uint16_t *)&card_quantity,
hpi_adapter_list,HPI_MAX_ADAPTERS); hpi_adapter_list,HPI_MAX_ADAPTERS),__LINE__);
#else #else
LogHpi(HPI_SubSysGetVersionEx(NULL,&dummy_hpi)); LogHpi(HPI_SubSysGetVersionEx(NULL,&dummy_hpi),__LINE__);
LogHpi(HPI_SubSysGetNumAdapters(NULL,&card_quantity)); LogHpi(HPI_SubSysGetNumAdapters(NULL,&card_quantity),__LINE__);
#endif // HPI_VER #endif // HPI_VER
for(int i=0;i<card_quantity;i++) { for(int i=0;i<card_quantity;i++) {
#if HPI_VER < 0x00030600 #if HPI_VER < 0x00030600
card_index[i]=i; card_index[i]=i;
#else #else
LogHpi(HPI_SubSysGetAdapter(NULL,i,card_index+i,hpi_adapter_list+i)); LogHpi(HPI_SubSysGetAdapter(NULL,i,card_index+i,hpi_adapter_list+i),
__LINE__);
#endif // HPI_VER #endif // HPI_VER
if((hpi_adapter_list[i]&0xF000)==0x6000) { if((hpi_adapter_list[i]&0xF000)==0x6000) {
timescale_support[i]=true; timescale_support[i]=true;
@ -664,32 +680,32 @@ void RDHPISoundCard::HPIProbe()
timescale_support[i]=false; timescale_support[i]=false;
} }
switch(hpi_adapter_list[i]) { switch(hpi_adapter_list[i]) {
case 0x5111: case 0x5111:
case 0x5211: case 0x5211:
input_mux_type[i]=true; input_mux_type[i]=true;
break; break;
default: default:
input_mux_type[i]=false; input_mux_type[i]=false;
break; break;
} }
card_input_ports[i]=0; card_input_ports[i]=0;
card_output_ports[i]=0; card_output_ports[i]=0;
card_description[i]=QString().sprintf("AudioScience %04X [%d]", card_description[i]=QString().sprintf("AudioScience %04X [%d]",
hpi_adapter_list[i],i+1); hpi_adapter_list[i],i+1);
LogHpi(HPI_AdapterOpen(NULL,card_index[i])); LogHpi(HPI_AdapterOpen(NULL,card_index[i]),__LINE__);
LogHpi(HPI_AdapterGetInfo(NULL,card_index[i], LogHpi(HPI_AdapterGetInfo(NULL,card_index[i],
&card_output_streams[i], &card_output_streams[i],
&card_input_streams[i], &card_input_streams[i],
&dummy_version,(uint32_t *)&dummy_serial, &dummy_version,(uint32_t *)&dummy_serial,
&dummy_type)); &dummy_type),__LINE__);
hpi_info[i].setSerialNumber(dummy_serial); hpi_info[i].setSerialNumber(dummy_serial);
hpi_info[i].setHpiVersion(dummy_hpi); hpi_info[i].setHpiVersion(dummy_hpi);
hpi_info[i].setDspMajorVersion((dummy_version>>13)&7); hpi_info[i].setDspMajorVersion((dummy_version>>13)&7);
hpi_info[i].setDspMinorVersion((dummy_version>>7)&63); hpi_info[i].setDspMinorVersion((dummy_version>>7)&63);
hpi_info[i].setPcbVersion((char)(((dummy_version>>3)&7)+'A')); hpi_info[i].setPcbVersion((char)(((dummy_version>>3)&7)+'A'));
hpi_info[i].setAssemblyVersion(dummy_version&7); hpi_info[i].setAssemblyVersion(dummy_version&7);
LogHpi(HPI_AdapterClose(NULL,card_index[i])); LogHpi(HPI_AdapterClose(NULL,card_index[i]),__LINE__);
str=QString(tr("Input Stream")); str=QString(tr("Input Stream"));
for(int j=0;j<card_input_streams[i];j++) { for(int j=0;j<card_input_streams[i];j++) {
input_stream_description[i][j]= input_stream_description[i][j]=
@ -708,7 +724,7 @@ void RDHPISoundCard::HPIProbe()
// Mixer Initialization // Mixer Initialization
// //
for(int i=0;i<card_quantity;i++) { for(int i=0;i<card_quantity;i++) {
LogHpi(HPI_MixerOpen(NULL,card_index[i],&hpi_mixer[i])); LogHpi(HPI_MixerOpen(NULL,card_index[i],&hpi_mixer[i]),__LINE__);
// //
// Get Input Ports // Get Input Ports
@ -744,9 +760,9 @@ void RDHPISoundCard::HPIProbe()
str=QString(tr("Output Port")); str=QString(tr("Output Port"));
for(int k=0;k<HPI_MAX_NODES;k++) { for(int k=0;k<HPI_MAX_NODES;k++) {
if((HPI_MixerGetControl(NULL,hpi_mixer[i], if((HPI_MixerGetControl(NULL,hpi_mixer[i],
HPI_SOURCENODE_OSTREAM,0, HPI_SOURCENODE_OSTREAM,0,
HPI_DESTNODE_LINEOUT,k, HPI_DESTNODE_LINEOUT,k,
HPI_CONTROL_VOLUME, HPI_CONTROL_VOLUME,
&output_stream_volume_control[i][0][k])==0)|| &output_stream_volume_control[i][0][k])==0)||
(HPI_MixerGetControl(NULL,hpi_mixer[i], (HPI_MixerGetControl(NULL,hpi_mixer[i],
HPI_SOURCENODE_OSTREAM,0, HPI_SOURCENODE_OSTREAM,0,
@ -765,13 +781,14 @@ void RDHPISoundCard::HPIProbe()
HPI_SOURCENODE_CLOCK_SOURCE,0, HPI_SOURCENODE_CLOCK_SOURCE,0,
0,0, 0,0,
HPI_CONTROL_SAMPLECLOCK, HPI_CONTROL_SAMPLECLOCK,
&clock_source_control[i])); &clock_source_control[i]),__LINE__);
for(int j=0;j<card_input_streams[i];j++) { for(int j=0;j<card_input_streams[i];j++) {
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // VOX Controls if(LogHpi(HPI_MixerGetControl(NULL,hpi_mixer[i], // VOX Controls
0,0, 0,0,
HPI_DESTNODE_ISTREAM,j, HPI_DESTNODE_ISTREAM,j,
HPI_CONTROL_VOX, HPI_CONTROL_VOX,
&input_stream_vox_control[i][j])==0) { &input_stream_vox_control[i][j]),
__LINE__)==0) {
input_stream_vox[i][j]=true; input_stream_vox[i][j]=true;
} }
else { else {
@ -779,27 +796,29 @@ void RDHPISoundCard::HPIProbe()
} }
if(input_mux_type[i]) { if(input_mux_type[i]) {
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // MUX Controls if(LogHpi(HPI_MixerGetControl(NULL,hpi_mixer[i], // MUX Controls
0,0, 0,0,
HPI_DESTNODE_ISTREAM,j, HPI_DESTNODE_ISTREAM,j,
HPI_CONTROL_MULTIPLEXER, HPI_CONTROL_MULTIPLEXER,
&input_mux_control[i][j])==0) { &input_mux_control[i][j]),__LINE__)==0) {
input_stream_mux[i][j]=true; input_stream_mux[i][j]=true;
l=0; l=0;
input_port_mux_type[i][j][0]=false; input_port_mux_type[i][j][0]=false;
input_port_mux_type[i][j][1]=false; input_port_mux_type[i][j][1]=false;
while(HPI_Multiplexer_QuerySource(NULL, while(LogHpi(HPI_Multiplexer_QuerySource(NULL,
input_mux_control[i][j], input_mux_control[i][j],
l++,&type,&index)==0) { l++,&type,&index),
__LINE__)==0) {
switch(type) { switch(type) {
case HPI_SOURCENODE_LINEIN: case HPI_SOURCENODE_LINEIN:
input_port_mux_type[i][j][0]=true; input_port_mux_type[i][j][0]=true;
input_mux_index[i][j][0]=index; input_mux_index[i][j][0]=index;
break; break;
case HPI_SOURCENODE_AESEBU_IN:
input_port_mux_type[i][j][1]=true; case HPI_SOURCENODE_AESEBU_IN:
input_mux_index[i][j][1]=index; input_port_mux_type[i][j][1]=true;
break; input_mux_index[i][j][1]=index;
break;
} }
} }
} }
@ -836,21 +855,23 @@ void RDHPISoundCard::HPIProbe()
output_stream_volume[i][j][k]=false; output_stream_volume[i][j][k]=false;
} }
} }
if(HPI_MixerGetControl(NULL,hpi_mixer[i], if(LogHpi(HPI_MixerGetControl(NULL,hpi_mixer[i],
0,0, 0,0,
HPI_DESTNODE_ISTREAM,j, HPI_DESTNODE_ISTREAM,j,
HPI_CONTROL_METER, HPI_CONTROL_METER,
&input_stream_meter_control[i][j])==0) { &input_stream_meter_control[i][j]),
__LINE__)==0) {
input_stream_meter[i][j]=true; input_stream_meter[i][j]=true;
} }
else { else {
input_stream_meter[i][j]=false; input_stream_meter[i][j]=false;
} }
if(HPI_MixerGetControl(NULL,hpi_mixer[i], if(LogHpi(HPI_MixerGetControl(NULL,hpi_mixer[i],
HPI_SOURCENODE_OSTREAM,j, HPI_SOURCENODE_OSTREAM,j,
0,0, 0,0,
HPI_CONTROL_METER, HPI_CONTROL_METER,
&output_stream_meter_control[i][j])==0) { &output_stream_meter_control[i][j]),
__LINE__)==0) {
output_stream_meter[i][j]=true; output_stream_meter[i][j]=true;
} }
else { else {
@ -870,8 +891,8 @@ void RDHPISoundCard::HPIProbe()
} }
if((HPI_MixerGetControl(NULL,hpi_mixer[i], // Output Level Controls if((HPI_MixerGetControl(NULL,hpi_mixer[i], // Output Level Controls
0,0, 0,0,
HPI_DESTNODE_LINEOUT,j, HPI_DESTNODE_LINEOUT,j,
HPI_CONTROL_LEVEL, HPI_CONTROL_LEVEL,
&output_port_level_control[i][j])==0)|| &output_port_level_control[i][j])==0)||
(HPI_MixerGetControl(NULL,hpi_mixer[i], (HPI_MixerGetControl(NULL,hpi_mixer[i],
0,0, 0,0,
@ -894,10 +915,10 @@ void RDHPISoundCard::HPIProbe()
input_port_meter[i][j]=false; input_port_meter[i][j]=false;
} }
if((HPI_MixerGetControl(NULL,hpi_mixer[i], // Output Port Meter if((HPI_MixerGetControl(NULL,hpi_mixer[i], // Output Port Meter
0,0, 0,0,
HPI_DESTNODE_LINEOUT,j, HPI_DESTNODE_LINEOUT,j,
HPI_CONTROL_METER, HPI_CONTROL_METER,
&output_port_meter_control[i][j])==0)|| &output_port_meter_control[i][j])==0)||
(HPI_MixerGetControl(NULL,hpi_mixer[i], (HPI_MixerGetControl(NULL,hpi_mixer[i],
0,0, 0,0,
HPI_DESTNODE_AESEBU_OUT,j, HPI_DESTNODE_AESEBU_OUT,j,
@ -928,9 +949,10 @@ void RDHPISoundCard::HPIProbe()
l=0; l=0;
input_port_mux_type[i][j][0]=false; input_port_mux_type[i][j][0]=false;
input_port_mux_type[i][j][1]=false; input_port_mux_type[i][j][1]=false;
while(HPI_Multiplexer_QuerySource(NULL, while(LogHpi(HPI_Multiplexer_QuerySource(NULL,
input_mux_control[i][j], input_mux_control[i][j],
l++,&type,&index)==0) { l++,&type,&index),
__LINE__)==0) {
switch(type) { switch(type) {
case HPI_SOURCENODE_LINEIN: case HPI_SOURCENODE_LINEIN:
input_port_mux_type[i][j][0]=true; input_port_mux_type[i][j][0]=true;
@ -978,13 +1000,13 @@ void RDHPISoundCard::HPIProbe()
} }
hpi_err_t RDHPISoundCard::LogHpi(hpi_err_t err) hpi_err_t RDHPISoundCard::LogHpi(hpi_err_t err,int lineno)
{ {
char err_txt[200]; char err_txt[200];
if(err!=0) { if(err!=0) {
HPI_GetErrorText(err,err_txt); HPI_GetErrorText(err,err_txt);
syslog(LOG_NOTICE,"HPI Error: %s",err_txt); syslog(LOG_NOTICE,"HPI Error: %s, %s line %d",err_txt,__FILE__,lineno);
} }
return err; return err;
} }

View File

@ -169,7 +169,7 @@ class RDHPISoundCard : public QObject
private: private:
void HPIProbe(); void HPIProbe();
hpi_err_t LogHpi(hpi_err_t err); hpi_err_t LogHpi(hpi_err_t err,int lineno);
uint16_t card_input_streams[HPI_MAX_ADAPTERS]; uint16_t card_input_streams[HPI_MAX_ADAPTERS];
uint16_t card_output_streams[HPI_MAX_ADAPTERS]; uint16_t card_output_streams[HPI_MAX_ADAPTERS];
uint16_t card_input_ports[HPI_MAX_ADAPTERS]; uint16_t card_input_ports[HPI_MAX_ADAPTERS];

View File

@ -610,9 +610,10 @@ void ListClocks::DeleteClock(QString clockname)
base_name.replace(" ","_"); base_name.replace(" ","_");
// //
// Delete Active Clocks // Clear Active Clocks
// //
sql=QString("delete from SERVICE_CLOCKS where ")+ sql=QString("update SERVICE_CLOCKS set ")+
"CLOCK_NAME=null where "+
"CLOCK_NAME=\""+RDEscapeString(clockname)+"\""; "CLOCK_NAME=\""+RDEscapeString(clockname)+"\"";
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
delete q; delete q;

Binary file not shown.

View File

@ -20,14 +20,10 @@
## ##
## Use automake to process this into a Makefile.in ## Use automake to process this into a Makefile.in
if HPI_RD_AM
HPIINFO_RD_OPT = rdhpiinfo
endif
if ALSA_RD_AM if ALSA_RD_AM
ALSACONFIG_RD_OPT = rdalsaconfig ALSACONFIG_RD_OPT = rdalsaconfig
endif endif
SUBDIRS = $(ALSACONFIG_RD_OPT)\ SUBDIRS = $(ALSACONFIG_RD_OPT)\
$(HPIINFO_RD_OPT)\
rddbcheck\ rddbcheck\
rddgimport\ rddgimport\
rdcheckcuts\ rdcheckcuts\

View File

@ -1,51 +0,0 @@
## automake.am
##
## Automake.am for utils/rdhpiinfo
##
## (C) Copyright 2002-2007,2016 Fred Gleason <fredg@paravelsystems.com>
##
## 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
## published by the Free Software Foundation.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## Use automake to process this into a Makefile.in
##
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -DQTDIR=\"@QT_DIR@\" @QT_CXXFLAGS@ -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi
LIBS = @QT_LIBS@ -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi
MOC = @QT_MOC@
# The dependency for qt's Meta Object Compiler (moc)
moc_%.cpp: %.h
$(MOC) $< -o $@
bin_PROGRAMS = rdhpiinfo
dist_rdhpiinfo_SOURCES = change_mode.cpp change_mode.h\
rdhpiinfo.cpp rdhpiinfo.h\
virtdetails.cpp virtdetails.h
nodist_rdhpiinfo_SOURCES = moc_change_mode.cpp\
moc_rdhpiinfo.cpp\
moc_virtdetails.cpp
rdhpiinfo_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @LIBHPI@
EXTRA_DIST = rdhpiinfo.pro
CLEANFILES = *~\
*.qm\
moc_*
MAINTAINERCLEANFILES = *~\
Makefile.in\
moc_*

View File

@ -1,194 +0,0 @@
// change_mode.cpp
//
// Change the mode of an AudioScience Adapter.
//
// (C) Copyright 2002-2014,2016 Fred Gleason <fredg@paravelsystems.com>
//
// 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qpushbutton.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <change_mode.h>
ChangeMode::ChangeMode(unsigned short card,unsigned short type,int mode,
QWidget *parent)
: QDialog(parent,"",true)
{
QString str;
//
// Fix the Window Size
//
setMinimumWidth(sizeHint().width());
setMaximumWidth(sizeHint().width());
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
setCaption(tr("RdHPIInfo - Change Mode"));
//
// Create Fonts
//
QFont font=QFont("Helvetica",12,QFont::Normal);
font.setPixelSize(12);
QFont label_font=QFont("Helvetica",12,QFont::Bold);
label_font.setPixelSize(12);
//
// Adapter Type
//
QLabel *label=new QLabel(QString().sprintf("AudioScience %X",type),this);
label->setGeometry(10,10,sizeHint().width()-20,15);
label->setFont(label_font);
label->setAlignment(AlignCenter);
//
// Adapter Mode
//
change_mode_box=new QComboBox(this);
change_mode_box->setGeometry(10,35,sizeHint().width()-20,22);
change_mode_box->setFont(font);
int index=0;
for(uint32_t i=1;i<14;i++) {
if(HPI_AdapterSetModeEx(NULL,card,i,HPI_ADAPTER_MODE_QUERY)==0) {
switch(i) {
case HPI_ADAPTER_MODE_4OSTREAM:
change_mode_box->insertItem(tr("Four Output Streams"));
break;
case HPI_ADAPTER_MODE_6OSTREAM:
change_mode_box->insertItem(tr("Six Output Streams"));
break;
case HPI_ADAPTER_MODE_8OSTREAM:
change_mode_box->insertItem(tr("Eight Output Streams"));
break;
case HPI_ADAPTER_MODE_12OSTREAM:
change_mode_box->insertItem(tr("Twelve Output Streams"));
break;
case HPI_ADAPTER_MODE_16OSTREAM:
change_mode_box->insertItem(tr("Sixteen Output Streams"));
break;
case HPI_ADAPTER_MODE_1OSTREAM:
change_mode_box->insertItem(tr("One Output Stream"));
break;
case HPI_ADAPTER_MODE_1:
change_mode_box->insertItem(tr("Mode 1"));
break;
case HPI_ADAPTER_MODE_2:
change_mode_box->insertItem(tr("Mode 2"));
break;
case HPI_ADAPTER_MODE_3:
change_mode_box->insertItem(tr("Mode 3"));
break;
case HPI_ADAPTER_MODE_MULTICHANNEL:
change_mode_box->insertItem(tr("Surround Sound [SSX]"));
break;
case HPI_ADAPTER_MODE_9OSTREAM:
change_mode_box->insertItem(tr("Nine Output Stream"));
break;
case HPI_ADAPTER_MODE_MONO:
change_mode_box->insertItem(tr("Mono Mode"));
break;
case HPI_ADAPTER_MODE_LOW_LATENCY:
change_mode_box->insertItem(tr("Low Latency Mode"));
break;
default:
str=QString(tr("Unknown"));
change_mode_box->
insertItem(QString().sprintf(" %s [MODE=%u]\n",
(const char *)str,(unsigned)i));
break;
}
hpi_mode_map[index]=i;
if(mode==(int)i) {
change_mode_box->setCurrentItem(index);
change_index=index;
}
index++;
}
}
//
// Ok Button
//
QPushButton *ok_button=new QPushButton(this);
ok_button->setGeometry(sizeHint().width()-140,sizeHint().height()-40,60,30);
ok_button->setDefault(true);
ok_button->setFont(font);
ok_button->setText(tr("&OK"));
connect(ok_button,SIGNAL(clicked()),this,SLOT(okData()));
//
// Cancel Button
//
QPushButton *cancel_button=new QPushButton(this);
cancel_button->setGeometry(sizeHint().width()-70,sizeHint().height()-40,
60,30);
cancel_button->setFont(font);
cancel_button->setText(tr("&Cancel"));
connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
}
QSize ChangeMode::sizeHint() const
{
return QSize(280,110);
}
QSizePolicy ChangeMode::sizePolicy() const
{
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
void ChangeMode::closeEvent(QCloseEvent *e)
{
cancelData();
}
void ChangeMode::okData()
{
if(change_mode_box->currentItem()==change_index) {
done(-1);
return;
}
if(QMessageBox::warning(this,"RDHPIInfo",tr("The HPI driver will need to be restarted\nafter changing the mode. Continue?"),QMessageBox::Yes,QMessageBox::No)==QMessageBox::No) {
return;
}
done(hpi_mode_map[change_mode_box->currentItem()]);
return;
}
void ChangeMode::cancelData()
{
done(-1);
}

View File

@ -1,58 +0,0 @@
// change_mode.h
//
// Change the mode of an AudioScience Adapter
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
//
// 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef CHANGE_MODE_H
#define CHANGE_MODE_H
#define MAX_HPI_MODES 11
#include <qdialog.h>
#include <qcombobox.h>
#include <asihpi/hpi.h>
#ifndef HPI_ADAPTER_MODE_MULTICHANNEL
#define HPI_ADAPTER_MODE_MULTICHANNEL (9)
#endif
class ChangeMode : public QDialog
{
Q_OBJECT
public:
ChangeMode(unsigned short card,unsigned short type,int mode,
QWidget *parent=0);
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
protected:
void closeEvent(QCloseEvent *e);
private slots:
void okData();
void cancelData();
private:
int change_index;
uint32_t hpi_mode_map[MAX_HPI_MODES];
QComboBox *change_mode_box;
};
#endif

View File

@ -1,481 +0,0 @@
// rdhpiinfo.cpp
//
// A Qt-based application for display information on ASI cards.
//
// (C) Copyright 2002-2014,2016 Fred Gleason <fredg@paravelsystems.com>
//
// 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <stdlib.h>
#include <stdint.h>
#include <qapplication.h>
#include <qwindowsstyle.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qtextcodec.h>
#include <qtranslator.h>
#include <rdcmd_switch.h>
#include "rdhpiinfo.h"
#include "change_mode.h"
#include "virtdetails.h"
MainWidget::MainWidget(QWidget *parent)
:QWidget(parent)
{
setCaption(tr("RDHPIInfo")+" v"+VERSION);
//
// Fix the Window Size
//
setMinimumWidth(sizeHint().width());
setMaximumWidth(sizeHint().width());
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
//
// Load the command-line arguments
//
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdhpiinfo",
RDHPIINFO_USAGE);
delete cmd;
//
// Generate Fonts
//
QFont font("Helvetica",12,QFont::Normal);
font.setPixelSize(12);
QFont label_font("Helvetica",12,QFont::Bold);
label_font.setPixelSize(12);
//
// Open HPI
//
if(HPI_SubSysCreate()==NULL) {
QMessageBox::warning(this,tr("HPI Error"),
tr("The ASI HPI Driver is not loaded!"));
exit(1);
}
//
// HPI Version
//
HpiErr(HPI_SubSysGetVersionEx(NULL,&hpi_version),"HPI_SubSysGetVersionEx");
QLabel *label=new QLabel(tr("HPI Version:"),this);
label->setGeometry(10,10,85,20);
label->setFont(label_font);
label=new QLabel(QString().sprintf("%d.%02d.%02d",
(unsigned)((hpi_version>>16)&0xffff),
(unsigned)((hpi_version>>8)&0xff),
(unsigned)hpi_version&0xff),this);
label->setGeometry(100,10,100,20);
label->setFont(font);
//
// Adapter Name
//
info_name_box=new QComboBox(this);
info_name_box->setGeometry(100,34,sizeHint().width()-110,20);
info_name_box->setFont(font);
info_name_label=new QLabel(info_name_box,tr("Adapter:"),this);
info_name_label->setGeometry(10,34,85,20);
info_name_label->setFont(label_font);
info_name_label->setAlignment(AlignRight|AlignVCenter);
connect(info_name_box,SIGNAL(activated(int)),
this,SLOT(nameActivatedData(int)));
//
// Adapter Index
//
label=new QLabel(tr("Adapter Index:"),this);
label->setGeometry(10,58,105,20);
label->setFont(label_font);
label->setAlignment(AlignRight|AlignVCenter);
info_index_label=new QLabel(this);
info_index_label->setGeometry(120,58,100,20);
info_index_label->setFont(font);
info_index_label->setAlignment(AlignLeft|AlignVCenter);
//
// Serial Number
//
label=new QLabel(tr("Serial Number:"),this);
label->setGeometry(10,78,105,20);
label->setFont(label_font);
label->setAlignment(AlignRight|AlignVCenter);
info_serial_label=new QLabel(this);
info_serial_label->setGeometry(120,78,100,20);
info_serial_label->setFont(font);
info_serial_label->setAlignment(AlignLeft|AlignVCenter);
//
// Output Streams
//
label=new QLabel(tr("Input Streams:"),this);
label->setGeometry(10,98,105,20);
label->setFont(label_font);
label->setAlignment(AlignRight|AlignVCenter);
info_istreams_label=new QLabel(this);
info_istreams_label->setGeometry(120,98,100,20);
info_istreams_label->setFont(font);
info_istreams_label->setAlignment(AlignLeft|AlignVCenter);
//
// Input Streams
//
label=new QLabel(tr("Output Streams:"),this);
label->setGeometry(10,118,105,20);
label->setFont(label_font);
label->setAlignment(AlignRight|AlignVCenter);
info_ostreams_label=new QLabel(this);
info_ostreams_label->setGeometry(120,118,100,20);
info_ostreams_label->setFont(font);
info_ostreams_label->setAlignment(AlignLeft|AlignVCenter);
//
// DSP Version
//
label=new QLabel(tr("DSP Version:"),this);
label->setGeometry(10,138,105,20);
label->setFont(label_font);
label->setAlignment(AlignRight|AlignVCenter);
info_dsp_label=new QLabel(this);
info_dsp_label->setGeometry(120,138,100,20);
info_dsp_label->setFont(font);
info_dsp_label->setAlignment(AlignLeft|AlignVCenter);
//
// Adapter Version
//
label=new QLabel(tr("Adapter Version:"),this);
label->setGeometry(10,158,105,20);
label->setFont(label_font);
label->setAlignment(AlignRight|AlignVCenter);
info_adapter_label=new QLabel(this);
info_adapter_label->setGeometry(120,158,100,20);
info_adapter_label->setFont(font);
info_adapter_label->setAlignment(AlignLeft|AlignVCenter);
//
// DSP Utilization
//
info_utilization_label=new QLabel(tr("DSP Utilization")+":",this);
info_utilization_label->setGeometry(10,183,105,20);
info_utilization_label->setFont(label_font);
info_utilization_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
info_utilization_label->setDisabled(true);
info_utilization_edit=new QLineEdit(this);
info_utilization_edit->setGeometry(120,183,60,20);
info_utilization_edit->setFont(font);
info_utilization_edit->setReadOnly(true);
info_utilization_edit->setDisabled(true);
info_utilization_button=new QPushButton(tr("Details"),this);
info_utilization_button->setGeometry(190,180,70,26);
info_utilization_button->setFont(font);
info_utilization_button->setDisabled(true);
connect(info_utilization_button,SIGNAL(clicked()),
this,SLOT(utilizationData()));
//
// Adapter Mode
//
label=new QLabel(tr("Adapter Mode:"),this);
label->setGeometry(10,213,105,20);
label->setFont(label_font);
label->setAlignment(AlignRight|AlignVCenter);
info_mode_edit=new QLineEdit(this);
info_mode_edit->setGeometry(120,213,sizeHint().width()-210,20);
info_mode_edit->setReadOnly(true);
info_mode_edit->setFont(font);
info_mode_edit->setAlignment(AlignLeft|AlignVCenter);
info_changemode_button=
new QPushButton(tr("Change"),this);
info_changemode_button->setGeometry(sizeHint().width()-80,210,70,26);
info_changemode_button->setFont(font);
connect(info_changemode_button,SIGNAL(clicked()),
this,SLOT(changeModeData()));
//
// Close Button
//
QPushButton *button=new QPushButton(tr("Close"),this);
button->setGeometry(sizeHint().width()-60,sizeHint().height()-40,50,30);
button->setFont(label_font);
connect(button,SIGNAL(clicked()),qApp,SLOT(quit()));
LoadAdapters();
hpi_profile_timer=new QTimer(this);
connect(hpi_profile_timer,SIGNAL(timeout()),
this,SLOT(updateDspUtilization()));
if(info_name_box->count()>0) {
nameActivatedData(0);
hpi_profile_timer->start(1000);
}
}
MainWidget::~MainWidget()
{
HPI_SubSysFree(NULL);
}
QSize MainWidget::sizeHint() const
{
return QSize(400,290);
}
QSizePolicy MainWidget::sizePolicy() const
{
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
void MainWidget::nameActivatedData(int id)
{
QString str;
int card=name_map[id];
info_index_label->
setText(QString().sprintf("%u",(unsigned)hpi_indexes[card]+1));
info_serial_label->
setText(QString().sprintf("%u",(unsigned)hpi_serial[card]));
info_istreams_label->
setText(QString().sprintf("%d",hpi_istreams[card]));
info_ostreams_label->
setText(QString().sprintf("%d",hpi_ostreams[card]));
info_dsp_label->setText(QString().sprintf("%d.%d",
hpi_card_version[card]>>13,
(hpi_card_version[card]>>7)&63));
info_adapter_label->
setText(QString().sprintf("%c%d",
((hpi_card_version[card]>>3)&15)+'A',
hpi_card_version[card]&7));
switch(hpi_mode[card]) {
case 0: // No mode support
info_mode_edit->setText(tr("Standard"));
info_changemode_button->setDisabled(true);
break;
case HPI_ADAPTER_MODE_4OSTREAM:
info_mode_edit->setText(tr("Four Output Streams"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_6OSTREAM:
info_mode_edit->setText(tr("Six Output Streams"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_8OSTREAM:
info_mode_edit->setText(tr("Eight Output Streams"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_12OSTREAM:
info_mode_edit->setText(tr("Twelve Output Streams"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_16OSTREAM:
info_mode_edit->setText(tr("Sixteen Output Streams"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_1OSTREAM:
info_mode_edit->setText(tr("One Output Stream"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_1:
info_mode_edit->setText(tr("Mode 1"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_2:
info_mode_edit->setText(tr("Mode 2"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_3:
info_mode_edit->setText(tr("Mode 3"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_MULTICHANNEL:
info_mode_edit->setText(tr("Surround Sound [SSX]"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_9OSTREAM:
info_mode_edit->setText(tr("Nine Output Stream"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_MONO:
info_mode_edit->setText(tr("Mono Mode"));
info_changemode_button->setEnabled(true);
break;
case HPI_ADAPTER_MODE_LOW_LATENCY:
info_mode_edit->setText(tr("Low Latency Mode"));
info_changemode_button->setEnabled(true);
break;
default:
info_mode_edit->setText(tr("N/A"));
info_changemode_button->setDisabled(true);
if(hpi_mode[card]!=hpi_serial[card]) {
str=QString(tr("rdhpiinfo: unknown adapter mode"));
fprintf(stderr,"%s %d\n",(const char *)str,hpi_mode[card]);
}
break;
}
}
void MainWidget::changeModeData()
{
int card=name_map[info_name_box->currentItem()];
int mode;
QString str;
hpi_err_t hpi_err;
char hpi_text[100];
ChangeMode *dialog=new ChangeMode(card,hpi_type[card],hpi_mode[card],this);
if((mode=dialog->exec())<0) {
delete dialog;
return;
}
delete dialog;
hpi_err=HPI_AdapterOpen(NULL,card);
if((hpi_err=HPI_AdapterSetMode(NULL,card,mode))==0) {
QMessageBox::information(this,tr("RdhpiInfo"),
tr("The adapter mode has been changed.\nYou must now restart the HPI driver!"));
}
else {
HPI_GetErrorText(hpi_err,hpi_text);
str=QString(tr("HPI Error"));
QMessageBox::warning(this,tr("RdhpiInfo"),
QString().sprintf("%s %d:\n\"%s\"",(const char *)str,
(int)hpi_err,hpi_text));
}
hpi_err=HPI_AdapterClose(NULL,card);
}
void MainWidget::utilizationData()
{
VirtDetails *d=new VirtDetails(hpi_indexes[info_name_box->currentItem()],
hpi_profile[info_name_box->currentItem()],
hpi_profile_quan[info_name_box->currentItem()],
this);
hpi_profile_timer->stop();
d->exec();
hpi_profile_timer->start(1000);
delete d;
}
void MainWidget::updateDspUtilization()
{
uint32_t util=0;
if(HpiErr(HPI_ProfileGetUtilization(NULL,
hpi_profile[info_name_box->currentItem()],
&util))==0) {
info_utilization_edit->setText(QString().sprintf("%5.1lf%%",
(double)util/100.0));
info_utilization_label->setEnabled(true);
info_utilization_edit->setEnabled(true);
info_utilization_button->setEnabled(true);
}
else {
info_utilization_edit->setText("xx.x");
info_utilization_label->setDisabled(true);
info_utilization_edit->setDisabled(true);
info_utilization_button->setDisabled(true);
}
}
void MainWidget::LoadAdapters()
{
int num_adapters;
HpiErr(HPI_SubSysGetNumAdapters(NULL,&num_adapters),
"HPI_SubSysGetNumAdapters");
for(int i=0;i<num_adapters;i++) {
HpiErr(HPI_SubSysGetAdapter(NULL,i,hpi_indexes+i,hpi_type+i),
"HPI_SubSysGetAdapter");
hpi_ostreams[i]=0;
hpi_istreams[i]=0;
hpi_card_version[i]=0;
hpi_serial[i]=0;
hpi_mode[i]=0;
if(hpi_type[i]!=0) {
info_name_box->insertItem(QString().sprintf("AudioScience %X [%d]",
hpi_type[i],i+1));
name_map[info_name_box->count()-1]=i;
HpiErr(HPI_AdapterOpen(NULL,hpi_indexes[i]),"HPI_AdapterOpen");
HpiErr(HPI_AdapterGetInfo(NULL,hpi_indexes[i],&hpi_ostreams[i],&hpi_istreams[i],
&hpi_card_version[i],hpi_serial+i,
&hpi_type[i]),"HPI_AdapterGetInfo");
HpiErr(HPI_AdapterGetMode(NULL,hpi_indexes[i],&hpi_mode[i]),
"HPI_AdapterGetMode");
HpiErr(HPI_AdapterClose(NULL,hpi_indexes[i]),"HPI_AdapterClose");
HpiErr(HPI_ProfileOpenAll(NULL,hpi_indexes[i],0,&hpi_profile[i],
&hpi_profile_quan[i]));
}
}
}
hpi_err_t MainWidget::HpiErr(hpi_err_t err,const char *func_name) const
{
char hpi_str[200];
if(err==HPI_ERROR_INVALID_FUNC) {
return err;
}
if(err!=0) {
HPI_GetErrorText(err,hpi_str);
if(func_name==NULL) {
fprintf(stderr,"rdhpiinfo: %s\n",hpi_str);
}
else {
fprintf(stderr,"rdhpiinfo[%s]: %s\n",func_name,hpi_str);
}
}
return err;
}
int main(int argc,char *argv[])
{
QApplication a(argc,argv);
//
// Start Event Loop
//
MainWidget *w=new MainWidget();
a.setMainWidget(w);
w->setGeometry(QRect(QPoint(0,0),w->sizeHint()));
w->show();
return a.exec();
}

View File

@ -1,86 +0,0 @@
// rdhpiinfo.h
//
// A Qt-based application for display info about ASI cards.
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
//
// 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef RDHPIINFO_H
#define RDHPIINFO_H
#include <qwidget.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qtimer.h>
#include <asihpi/hpi.h>
#if HPI_VER < 0x040600
typedef uint16_t hpi_err_t;
typedef uint32_t hpi_handle_t;
#endif
#define RDHPIINFO_USAGE "\n"
class MainWidget : public QWidget
{
Q_OBJECT
public:
MainWidget(QWidget *parent=0);
~MainWidget();
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
private slots:
void nameActivatedData(int id);
void changeModeData();
void utilizationData();
void updateDspUtilization();
private:
void LoadAdapters();
hpi_err_t HpiErr(hpi_err_t err,const char *func_name=0) const;
QLabel *info_name_label;
QComboBox *info_name_box;
QLabel *info_utilization_label;
QLineEdit *info_utilization_edit;
QPushButton *info_utilization_button;
QLabel *info_index_label;
QLabel *info_serial_label;
QLabel *info_istreams_label;
QLabel *info_ostreams_label;
QLabel *info_dsp_label;
QLabel *info_adapter_label;
QLineEdit *info_mode_edit;
QPushButton *info_changemode_button;
uint32_t hpi_version;
QString hpi_name[HPI_MAX_ADAPTERS];
int name_map[HPI_MAX_ADAPTERS];
uint32_t hpi_indexes[HPI_MAX_ADAPTERS];
uint16_t hpi_ostreams[HPI_MAX_ADAPTERS];
uint16_t hpi_istreams[HPI_MAX_ADAPTERS];
uint16_t hpi_card_version[HPI_MAX_ADAPTERS];
uint32_t hpi_serial[HPI_MAX_ADAPTERS];
uint16_t hpi_type[HPI_MAX_ADAPTERS];
uint32_t hpi_mode[HPI_MAX_ADAPTERS];
hpi_handle_t hpi_profile[HPI_MAX_ADAPTERS];
uint16_t hpi_profile_quan[HPI_MAX_ADAPTERS];
QTimer *hpi_profile_timer;
};
#endif // RDHPIINFO_H

View File

@ -1,200 +0,0 @@
// virtdetails.cpp
//
// Show profile details for an AudioScience adapter.
//
// (C) Copyright 2014 Fred Gleason <fredg@paravelsystems.com>
//
// 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qlabel.h>
#include <qpushbutton.h>
#include <qtimer.h>
#include "virtdetails.h"
VirtDetails::VirtDetails(uint16_t card,hpi_handle_t profile,
uint16_t profile_quan,QWidget *parent)
: QDialog(parent,"",true)
{
char name[200];
virt_card=card;
virt_profile=profile;
//
// Fix the Window Size
//
setMinimumWidth(sizeHint().width());
setMaximumWidth(sizeHint().width());
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
setCaption(tr("RdHPIInfo - Profile Details"));
//
// Create Fonts
//
QFont font=QFont("Helvetica",12,QFont::Normal);
font.setPixelSize(12);
QFont label_font=QFont("Helvetica",12,QFont::Bold);
label_font.setPixelSize(12);
//
// Adapter Mode
//
virt_profile_box=new QComboBox(this);
virt_profile_box->setGeometry(75,10,sizeHint().width()-85,20);
virt_profile_box->setFont(font);
virt_profile_label=new QLabel(virt_profile_box,tr("Profile")+":",this);
virt_profile_label->setGeometry(10,10,60,20);
virt_profile_label->setFont(label_font);
virt_profile_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
for(uint16_t i=0;i<profile_quan;i++) {
if(HPI_ProfileGetName(NULL,profile,i,name,200)==0) {
if(QString(name).lower()!="unassigned") {
virt_profile_box->insertItem(name);
}
}
}
//
// Utilization Counter
//
virt_utilization_label=new QLabel(tr("Overall DSP Utilization")+":",this);
virt_utilization_label->setGeometry(10,35,160,20);
virt_utilization_label->setFont(label_font);
virt_utilization_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
virt_utilization_edit=new QLineEdit(this);
virt_utilization_edit->setGeometry(175,35,90,20);
virt_utilization_edit->setFont(font);
virt_utilization_edit->setReadOnly(true);
//
// Profile Interval Counter
//
virt_interval_label=new QLabel(tr("Profile Interval")+":",this);
virt_interval_label->setGeometry(10,57,160,20);
virt_interval_label->setFont(label_font);
virt_interval_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
virt_interval_edit=new QLineEdit(this);
virt_interval_edit->setGeometry(175,57,90,20);
virt_interval_edit->setFont(font);
virt_interval_edit->setReadOnly(true);
//
// Total Tick Count Counter
//
virt_total_ticks_label=new QLabel(tr("Total Tick Count")+":",this);
virt_total_ticks_label->setGeometry(10,79,160,20);
virt_total_ticks_label->setFont(label_font);
virt_total_ticks_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
virt_total_ticks_edit=new QLineEdit(this);
virt_total_ticks_edit->setGeometry(175,79,90,20);
virt_total_ticks_edit->setFont(font);
virt_total_ticks_edit->setReadOnly(true);
//
// Call Count Counter
//
virt_call_count_label=new QLabel(tr("Call Count")+":",this);
virt_call_count_label->setGeometry(10,101,160,20);
virt_call_count_label->setFont(label_font);
virt_call_count_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
virt_call_count_edit=new QLineEdit(this);
virt_call_count_edit->setGeometry(175,101,90,20);
virt_call_count_edit->setFont(font);
virt_call_count_edit->setReadOnly(true);
//
// Maximum Ticks Counter
//
virt_max_ticks_label=new QLabel(tr("Maximum Ticks / Pass")+":",this);
virt_max_ticks_label->setGeometry(10,123,160,20);
virt_max_ticks_label->setFont(label_font);
virt_max_ticks_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
virt_max_ticks_edit=new QLineEdit(this);
virt_max_ticks_edit->setGeometry(175,123,90,20);
virt_max_ticks_edit->setFont(font);
virt_max_ticks_edit->setReadOnly(true);
//
// Ticks per Millisecond Counter
//
virt_ticks_per_ms_label=new QLabel(tr("Ticks / mS")+":",this);
virt_ticks_per_ms_label->setGeometry(10,145,160,20);
virt_ticks_per_ms_label->setFont(label_font);
virt_ticks_per_ms_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
virt_ticks_per_ms_edit=new QLineEdit(this);
virt_ticks_per_ms_edit->setGeometry(175,145,90,20);
virt_ticks_per_ms_edit->setFont(font);
virt_ticks_per_ms_edit->setReadOnly(true);
//
// Close Button
//
QPushButton *close_button=new QPushButton(this);
close_button->setGeometry(sizeHint().width()-70,sizeHint().height()-40,
60,30);
close_button->setFont(font);
close_button->setText(tr("&Close"));
connect(close_button,SIGNAL(clicked()),this,SLOT(closeData()));
QTimer *timer=new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(updateProfileData()));
timer->start(1000);
}
QSize VirtDetails::sizeHint() const
{
return QSize(280,222);
}
QSizePolicy VirtDetails::sizePolicy() const
{
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
void VirtDetails::updateProfileData()
{
uint32_t utilization;
uint16_t interval;
uint32_t total_ticks;
uint32_t call_count;
uint32_t max_ticks;
uint32_t ticks_per_ms;
if(HPI_ProfileGetUtilization(NULL,virt_profile,&utilization)==0) {
virt_utilization_edit->
setText(QString().sprintf("%5.1lf%%",(double)utilization/100.0));
}
if(HPI_ProfileGet(NULL,virt_profile,virt_profile_box->currentItem(),
&interval,&total_ticks,&call_count,&max_ticks,
&ticks_per_ms)==0) {
virt_interval_edit->setText(QString().sprintf("%u sec",interval));
virt_total_ticks_edit->setText(QString().sprintf("%u",total_ticks));
virt_call_count_edit->setText(QString().sprintf("%u",call_count));
virt_max_ticks_edit->setText(QString().sprintf("%u",max_ticks));
virt_ticks_per_ms_edit->setText(QString().sprintf("%u",ticks_per_ms));
}
}
void VirtDetails::closeData()
{
done(0);
}

View File

@ -1,66 +0,0 @@
// virtdetails.h
//
// Show profiling data for an AudioScience adapter
//
// (C) Copyright 2014 Fred Gleason <fredg@paravelsystems.com>
//
// 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef VIRTDETAILS_H
#define VIRTDETAILS_H
#include <stdint.h>
#include <qcombobox.h>
#include <qdialog.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <asihpi/hpi.h>
class VirtDetails : public QDialog
{
Q_OBJECT
public:
VirtDetails(uint16_t card,hpi_handle_t profile,uint16_t profile_quan,
QWidget *parent=0);
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
private slots:
void updateProfileData();
void closeData();
private:
uint16_t virt_card;
hpi_handle_t virt_profile;
QLabel *virt_utilization_label;
QLineEdit *virt_utilization_edit;
QLabel *virt_profile_label;
QComboBox *virt_profile_box;
QLabel *virt_interval_label;
QLineEdit *virt_interval_edit;
QLabel *virt_total_ticks_label;
QLineEdit *virt_total_ticks_edit;
QLabel *virt_call_count_label;
QLineEdit *virt_call_count_edit;
QLabel *virt_max_ticks_label;
QLineEdit *virt_max_ticks_edit;
QLabel *virt_ticks_per_ms_label;
QLineEdit *virt_ticks_per_ms_edit;
};
#endif // VIRTDETAILS_H

View File

@ -31,7 +31,6 @@ install-exec-am:
cp rivendell-rddgimport.desktop $(DESTDIR)@prefix@/share/applications/ cp rivendell-rddgimport.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rddiscimport.desktop $(DESTDIR)@prefix@/share/applications/ cp rivendell-rddiscimport.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rdgpimon.desktop $(DESTDIR)@prefix@/share/applications/ cp rivendell-rdgpimon.desktop $(DESTDIR)@prefix@/share/applications/
if test -f ../rdhpi/.libs/librdhpi-@VERSION@.so ; then cp rivendell-rdhpiinfo-root.desktop $(DESTDIR)@prefix@/share/applications/ ; fi
cp rivendell-rdlibrary.desktop $(DESTDIR)@prefix@/share/applications/ cp rivendell-rdlibrary.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rdlogedit.desktop $(DESTDIR)@prefix@/share/applications/ cp rivendell-rdlogedit.desktop $(DESTDIR)@prefix@/share/applications/
cp rivendell-rdlogin.desktop $(DESTDIR)@prefix@/share/applications/ cp rivendell-rdlogin.desktop $(DESTDIR)@prefix@/share/applications/
@ -48,30 +47,21 @@ install-exec-am:
cp *.menu $(DESTDIR)/etc/xdg/menus/applications-merged/ cp *.menu $(DESTDIR)/etc/xdg/menus/applications-merged/
mkdir -p $(DESTDIR)/etc/pam.d mkdir -p $(DESTDIR)/etc/pam.d
cp rdalsaconfig-root-pam $(DESTDIR)/etc/pam.d/rdalsaconfig-root cp rdalsaconfig-root-pam $(DESTDIR)/etc/pam.d/rdalsaconfig-root
if test -f ../rdhpi/.libs/librdhpi-@VERSION@.so ; then cp rdhpiinfo-root-pam $(DESTDIR)/etc/pam.d/rdhpiinfo-root ; fi
mkdir -p $(DESTDIR)/etc/security/console.apps mkdir -p $(DESTDIR)/etc/security/console.apps
cp rdalsaconfig-root-consolehelper $(DESTDIR)/etc/security/console.apps/rdalsaconfig-root cp rdalsaconfig-root-consolehelper $(DESTDIR)/etc/security/console.apps/rdalsaconfig-root
if test -f ../rdhpi/.libs/librdhpi-@VERSION@.so ; then cp rdhpiinfo-root-consolehelper $(DESTDIR)/etc/security/console.apps/rdhpiinfo-root ; fi
rm -f $(DESTDIR)$(prefix)/bin/rdalsaconfig-root rm -f $(DESTDIR)$(prefix)/bin/rdalsaconfig-root
ln -s /usr/bin/consolehelper $(DESTDIR)$(prefix)/bin/rdalsaconfig-root ln -s /usr/bin/consolehelper $(DESTDIR)$(prefix)/bin/rdalsaconfig-root
rm -f $(DESTDIR)$(prefix)/bin/rdhpiinfo-root
if test -f ../rdhpi/.libs/librdhpi-@VERSION@.so ; then ln -s /usr/bin/consolehelper $(DESTDIR)$(prefix)/bin/rdhpiinfo-root ; fi
uninstall-local: uninstall-local:
rm -f $(DESTDIR)@prefix@/share/applications/rivendell-*.desktop rm -f $(DESTDIR)@prefix@/share/applications/rivendell-*.desktop
rm -f $(DESTDIR)@prefix@/share/desktop-directories/rivendell-*.directory rm -f $(DESTDIR)@prefix@/share/desktop-directories/rivendell-*.directory
rm -f $(DESTDIR)/etc/xdg/menus/applications-merged/rivendell-*.menu rm -f $(DESTDIR)/etc/xdg/menus/applications-merged/rivendell-*.menu
rm -f $(DESTDIR)/etc/pam.d/rdalsaconfig-root rm -f $(DESTDIR)/etc/pam.d/rdalsaconfig-root
rm -f $(DESTDIR)/etc/pam.d/rdhpiinfo-root
rm -f $(DESTDIR)/etc/security/console.apps/rdalsaconfig-root rm -f $(DESTDIR)/etc/security/console.apps/rdalsaconfig-root
rm -f $(DESTDIR)/etc/security/console.apps/rdhpiinfo-root
rm -f $(DESTDIR)$(prefix)/bin/rdalsaconfig-root rm -f $(DESTDIR)$(prefix)/bin/rdalsaconfig-root
rm -f $(DESTIDR)$(prefix)/bin/rdhpiinfo-root
EXTRA_DIST = rdalsaconfig-root-consolehelper\ EXTRA_DIST = rdalsaconfig-root-consolehelper\
rdalsaconfig-root-pam\ rdalsaconfig-root-pam\
rdhpiinfo-root-consolehelper\
rdhpiinfo-root-pam\
rivendell-configuration.directory\ rivendell-configuration.directory\
rivendell-documentation.directory\ rivendell-documentation.directory\
rivendell-logtools.directory\ rivendell-logtools.directory\
@ -87,8 +77,6 @@ EXTRA_DIST = rdalsaconfig-root-consolehelper\
rivendell-rddgimport.desktop\ rivendell-rddgimport.desktop\
rivendell-rddiscimport.desktop\ rivendell-rddiscimport.desktop\
rivendell-rdgpimon.desktop\ rivendell-rdgpimon.desktop\
rivendell-rdhpiinfo.desktop\
rivendell-rdhpiinfo-root.desktop\
rivendell-rdlibrary.desktop\ rivendell-rdlibrary.desktop\
rivendell-rdlogedit.desktop\ rivendell-rdlogedit.desktop\
rivendell-rdlogin.desktop\ rivendell-rdlogin.desktop\

View File

@ -1,3 +0,0 @@
USER=root
PROGRAM=/usr/bin/rdhpiinfo
SESSION=true

View File

@ -1,4 +0,0 @@
#%PAM-1.0
auth include config-util
account include config-util
session include config-util

View File

@ -1,10 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Terminal=false
Categories=Qt;KDE;Rivendell;
Name=RDHPIInfo
GenericName=AudioScience Card Information
Exec=rdhpiinfo-root
Icon=rivendell
Type=Application
Terminal=false

View File

@ -1,12 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Terminal=false
Categories=Qt;KDE;Rivendell;
Name=RDHPIInfo
GenericName=AudioScience Card Information
Exec=rdhpiinfo
Icon=rivendell
Type=Application
Terminal=false
X-KDE-SubstituteUID=true
X-KDE-Username=root