mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 09:03:40 +02:00
Initial import of CVS-v2_8_branch
This commit is contained in:
52
utils/rdhpiinfo/Makefile.am
Normal file
52
utils/rdhpiinfo/Makefile.am
Normal file
@@ -0,0 +1,52 @@
|
||||
## automake.am
|
||||
##
|
||||
## Automake.am for utils/rdhpiinfo
|
||||
##
|
||||
## (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## $Id: Makefile.am,v 1.4.8.1 2012/11/29 01:37:38 cvs Exp $
|
||||
##
|
||||
## 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@
|
||||
INCLUDES = -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
|
||||
|
||||
nodist_rdhpiinfo_SOURCES = moc_change_mode.cpp\
|
||||
moc_rdhpiinfo.cpp
|
||||
|
||||
rdhpiinfo_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @LIBHPI@
|
||||
|
||||
EXTRA_DIST = rdhpiinfo.pro
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.qm\
|
||||
moc_*
|
||||
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
Makefile.in\
|
||||
moc_*
|
194
utils/rdhpiinfo/change_mode.cpp
Normal file
194
utils/rdhpiinfo/change_mode.cpp
Normal file
@@ -0,0 +1,194 @@
|
||||
// change_mode.cpp
|
||||
//
|
||||
// Change the mode of an AudioScience Adapter.
|
||||
//
|
||||
// (C) Copyright 2002-2005 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: change_mode.cpp,v 1.6 2011/05/18 14:38:13 cvs Exp $
|
||||
//
|
||||
// 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,const char *name)
|
||||
: QDialog(parent,name,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,"type_label");
|
||||
label->setGeometry(10,10,sizeHint().width()-20,15);
|
||||
label->setFont(label_font);
|
||||
label->setAlignment(AlignCenter);
|
||||
|
||||
//
|
||||
// Adapter Mode
|
||||
//
|
||||
change_mode_box=new QComboBox(this,"change_type_box");
|
||||
change_mode_box->setGeometry(10,35,sizeHint().width()-20,22);
|
||||
change_mode_box->setFont(font);
|
||||
int index=0;
|
||||
for(uint32_t i=1;i<11;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:
|
||||
switch(type) {
|
||||
case 0x6585:
|
||||
change_mode_box->
|
||||
insertItem(tr("Multichannel Surround (Two Output Streams)"));
|
||||
break;
|
||||
|
||||
default:
|
||||
change_mode_box->insertItem(tr("Sixteen Output Streams"));
|
||||
break;
|
||||
}
|
||||
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;
|
||||
|
||||
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");
|
||||
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");
|
||||
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);
|
||||
}
|
61
utils/rdhpiinfo/change_mode.h
Normal file
61
utils/rdhpiinfo/change_mode.h
Normal file
@@ -0,0 +1,61 @@
|
||||
// change_mode.h
|
||||
//
|
||||
// Change the mode of an AudioScience Adapter
|
||||
//
|
||||
// (C) Copyright 2002-2005 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: change_mode.h,v 1.5 2011/05/18 14:38:14 cvs Exp $
|
||||
//
|
||||
// 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,const char *name=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
|
||||
|
420
utils/rdhpiinfo/rdhpiinfo.cpp
Normal file
420
utils/rdhpiinfo/rdhpiinfo.cpp
Normal file
@@ -0,0 +1,420 @@
|
||||
// rdhpiinfo.cpp
|
||||
//
|
||||
// A Qt-based application for display information on ASI cards.
|
||||
//
|
||||
// (C) Copyright 2002-2005 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpiinfo.cpp,v 1.8.6.4 2014/01/21 21:59:34 cvs Exp $
|
||||
//
|
||||
// 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>
|
||||
|
||||
MainWidget::MainWidget(QWidget *parent,const char *name)
|
||||
:QWidget(parent,name)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
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) {
|
||||
printf("HERE\n");
|
||||
QMessageBox::warning(this,tr("HPI Error"),
|
||||
tr("The ASI HPI Driver is not loaded!"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// HPI Version
|
||||
//
|
||||
hpi_err=HPI_SubSysGetVersionEx(NULL,&hpi_version);
|
||||
QLabel *label=new QLabel(tr("HPI Version:"),this,"hpi_version_label");
|
||||
label->setGeometry(10,10,85,20);
|
||||
label->setFont(label_font);
|
||||
label=new QLabel(QString().sprintf("%X.%02X.%02X",
|
||||
(unsigned)((hpi_version>>16)&0xffff),
|
||||
(unsigned)((hpi_version>>8)&0xff),
|
||||
(unsigned)hpi_version&0xff),
|
||||
this,"hpi_version");
|
||||
label->setGeometry(100,10,100,20);
|
||||
label->setFont(font);
|
||||
|
||||
//
|
||||
// Adapter Name
|
||||
//
|
||||
info_name_box=new QComboBox(this,"info_name_box");
|
||||
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");
|
||||
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,"index_number_label");
|
||||
label->setGeometry(10,58,105,20);
|
||||
label->setFont(label_font);
|
||||
label->setAlignment(AlignRight|AlignVCenter);
|
||||
info_index_label=new QLabel(this,"info_index_label");
|
||||
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,"serial_number_label");
|
||||
label->setGeometry(10,78,105,20);
|
||||
label->setFont(label_font);
|
||||
label->setAlignment(AlignRight|AlignVCenter);
|
||||
info_serial_label=new QLabel(this,"info_serial_label");
|
||||
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,"input_streams_label");
|
||||
label->setGeometry(10,98,105,20);
|
||||
label->setFont(label_font);
|
||||
label->setAlignment(AlignRight|AlignVCenter);
|
||||
info_istreams_label=new QLabel(this,"info_istreams_label");
|
||||
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,"output_streams_label");
|
||||
label->setGeometry(10,118,105,20);
|
||||
label->setFont(label_font);
|
||||
label->setAlignment(AlignRight|AlignVCenter);
|
||||
info_ostreams_label=new QLabel(this,"info_ostreams_label");
|
||||
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,"dsp_version_label");
|
||||
label->setGeometry(10,138,105,20);
|
||||
label->setFont(label_font);
|
||||
label->setAlignment(AlignRight|AlignVCenter);
|
||||
info_dsp_label=new QLabel(this,"info_dsp_label");
|
||||
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,"adapter_version_label");
|
||||
label->setGeometry(10,158,105,20);
|
||||
label->setFont(label_font);
|
||||
label->setAlignment(AlignRight|AlignVCenter);
|
||||
info_adapter_label=new QLabel(this,"info_adapter_label");
|
||||
info_adapter_label->setGeometry(120,158,100,20);
|
||||
info_adapter_label->setFont(font);
|
||||
info_adapter_label->setAlignment(AlignLeft|AlignVCenter);
|
||||
|
||||
//
|
||||
// Adapter Mode
|
||||
//
|
||||
label=new QLabel(tr("Adapter Mode:"),this,"adapter_mode_label");
|
||||
label->setGeometry(10,178,105,20);
|
||||
label->setFont(label_font);
|
||||
label->setAlignment(AlignRight|AlignVCenter);
|
||||
info_mode_label=new QLabel(this,"info_mode_label");
|
||||
info_mode_label->setGeometry(120,178,sizeHint().width()-130,20);
|
||||
info_mode_label->setFont(font);
|
||||
info_mode_label->setAlignment(AlignLeft|AlignVCenter);
|
||||
|
||||
//
|
||||
// Change Mode Button
|
||||
//
|
||||
info_changemode_button=
|
||||
new QPushButton(tr("Change Card Mode"),this,"info_changemode_button");
|
||||
info_changemode_button->setGeometry(130,200,170,30);
|
||||
info_changemode_button->setFont(label_font);
|
||||
connect(info_changemode_button,SIGNAL(clicked()),
|
||||
this,SLOT(changeModeData()));
|
||||
|
||||
//
|
||||
// Close Button
|
||||
//
|
||||
QPushButton *button=new QPushButton(tr("Close"),this,"close_button");
|
||||
button->setGeometry(sizeHint().width()-60,sizeHint().height()-40,50,30);
|
||||
button->setFont(label_font);
|
||||
connect(button,SIGNAL(clicked()),qApp,SLOT(quit()));
|
||||
|
||||
LoadAdapters();
|
||||
if(info_name_box->count()>0) {
|
||||
nameActivatedData(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainWidget::~MainWidget()
|
||||
{
|
||||
HPI_SubSysFree(NULL);
|
||||
}
|
||||
|
||||
|
||||
QSize MainWidget::sizeHint() const
|
||||
{
|
||||
return QSize(400,250);
|
||||
}
|
||||
|
||||
|
||||
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_label->setText(tr("Standard"));
|
||||
info_changemode_button->setDisabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_4OSTREAM:
|
||||
info_mode_label->setText(tr("Four Output Streams"));
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_6OSTREAM:
|
||||
info_mode_label->setText(tr("Six Output Streams"));
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_8OSTREAM:
|
||||
info_mode_label->setText(tr("Eight Output Streams"));
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_12OSTREAM:
|
||||
info_mode_label->setText(tr("Twelve Output Streams"));
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_16OSTREAM:
|
||||
switch(hpi_type[card]) {
|
||||
case 0x6585:
|
||||
info_mode_label->
|
||||
setText(tr("Multichannel Surround (Two Output Streams)"));
|
||||
break;
|
||||
|
||||
default:
|
||||
info_mode_label->setText(tr("Sixteen Output Streams"));
|
||||
break;
|
||||
}
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_1OSTREAM:
|
||||
info_mode_label->setText(tr("One Output Stream"));
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_1:
|
||||
info_mode_label->setText(tr("Mode 1"));
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_2:
|
||||
info_mode_label->setText(tr("Mode 2"));
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_3:
|
||||
info_mode_label->setText(tr("Mode 3"));
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
case HPI_ADAPTER_MODE_MULTICHANNEL:
|
||||
info_mode_label->setText(tr("Surround Sound [SSX]"));
|
||||
info_changemode_button->setEnabled(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
info_mode_label->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,"change_mode_dialog");
|
||||
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::LoadAdapters()
|
||||
{
|
||||
int num_adapters;
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_SubSysGetNumAdapters(NULL,&num_adapters);
|
||||
for(int i=0;i<num_adapters;i++) {
|
||||
hpi_err=HPI_SubSysGetAdapter(NULL,i,hpi_indexes+i,hpi_type+i);
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::HpiErr(hpi_err_t err,const char *func_name) const
|
||||
{
|
||||
char hpi_str[200];
|
||||
|
||||
if(err==HPI_ERROR_INVALID_FUNC) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication a(argc,argv);
|
||||
|
||||
//
|
||||
// Start Event Loop
|
||||
//
|
||||
MainWidget *w=new MainWidget(NULL,"main");
|
||||
a.setMainWidget(w);
|
||||
w->setGeometry(QRect(QPoint(0,0),w->sizeHint()));
|
||||
w->show();
|
||||
return a.exec();
|
||||
}
|
79
utils/rdhpiinfo/rdhpiinfo.h
Normal file
79
utils/rdhpiinfo/rdhpiinfo.h
Normal file
@@ -0,0 +1,79 @@
|
||||
// rdhpiinfo.h
|
||||
//
|
||||
// A Qt-based application for display info about ASI cards.
|
||||
//
|
||||
// (C) Copyright 2002-2005 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpiinfo.h,v 1.5.6.1 2012/05/04 14:56:23 cvs Exp $
|
||||
//
|
||||
// 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 <qpushbutton.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,const char *name=0);
|
||||
~MainWidget();
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
|
||||
private slots:
|
||||
void nameActivatedData(int id);
|
||||
void changeModeData();
|
||||
|
||||
private:
|
||||
void LoadAdapters();
|
||||
void HpiErr(hpi_err_t err,const char *func_name=0) const;
|
||||
QLabel *info_name_label;
|
||||
QComboBox *info_name_box;
|
||||
QLabel *info_index_label;
|
||||
QLabel *info_serial_label;
|
||||
QLabel *info_istreams_label;
|
||||
QLabel *info_ostreams_label;
|
||||
QLabel *info_dsp_label;
|
||||
QLabel *info_adapter_label;
|
||||
QLabel *info_mode_label;
|
||||
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];
|
||||
};
|
||||
|
||||
|
||||
#endif // RDHPIINFO_H
|
0
utils/rdhpiinfo/rdhpiinfo.pro
Normal file
0
utils/rdhpiinfo/rdhpiinfo.pro
Normal file
Reference in New Issue
Block a user