mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-26 07:10:11 +01:00
Initial import of CVS-v2_8_branch
This commit is contained in:
95
rdhpi/Makefile.am
Normal file
95
rdhpi/Makefile.am
Normal file
@@ -0,0 +1,95 @@
|
||||
## automake.am
|
||||
##
|
||||
## Automake.am for rivendell/mlhpi
|
||||
##
|
||||
## by Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
##
|
||||
## (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## $Id: Makefile.am,v 1.7.8.3 2013/01/01 21:36:30 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.
|
||||
##
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -DQTDIR=\"@QT_DIR@\" @QT_CXXFLAGS@
|
||||
INCLUDES = -I$(top_srcdir)/lib
|
||||
LIBS = @QT_LIBS@ -L$(top_srcdir)/lib
|
||||
MOC = @QT_MOC@
|
||||
CWRAP = ../helpers/cwrap
|
||||
|
||||
# The dependency for qt's Meta Object Compiler (moc)
|
||||
moc_%.cpp: %.h
|
||||
$(MOC) $< -o $@
|
||||
|
||||
# The cwrap dependency
|
||||
html_%.cpp: %.html
|
||||
$(CWRAP) -o $@ $<
|
||||
|
||||
instdir = @LOCAL_PREFIX@/lib
|
||||
|
||||
# I18N Stuff
|
||||
install-exec-local:
|
||||
mkdir -p $(DESTDIR)$(prefix)/share/rivendell
|
||||
cp rdhpi_*.qm $(DESTDIR)$(prefix)/share/rivendell
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(prefix)/share/rivendell/rdhpi_*.qm
|
||||
|
||||
all:
|
||||
@QT_BIN@/lupdate rdhpi.pro
|
||||
@QT_BIN@/lrelease rdhpi.pro
|
||||
|
||||
lib_LTLIBRARIES = librdhpi.la
|
||||
dist_librdhpi_la_SOURCES = rdhpicardselector.cpp rdhpicardselector.h\
|
||||
rdhpiinformation.cpp rdhpiinformation.h\
|
||||
rdhpiplaystream.cpp rdhpiplaystream.h\
|
||||
rdhpirecordstream.cpp rdhpirecordstream.h\
|
||||
rdhpisoundcard.cpp rdhpisoundcard.h\
|
||||
rdhpisoundselector.cpp rdhpisoundselector.h
|
||||
|
||||
nodist_librdhpi_la_SOURCES = moc_rdhpicardselector.cpp\
|
||||
moc_rdhpiplaystream.cpp\
|
||||
moc_rdhpirecordstream.cpp\
|
||||
moc_rdhpisoundcard.cpp\
|
||||
moc_rdhpisoundselector.cpp
|
||||
|
||||
|
||||
librdhpi_la_LDFLAGS = -release $(VERSION)
|
||||
|
||||
EXTRA_DIST = rdhpi.pro\
|
||||
rdhpi_cs.ts\
|
||||
rdhpi_de.ts\
|
||||
rdhpi_es.ts\
|
||||
rdhpi_fr.ts\
|
||||
rdhpi_nb.ts\
|
||||
rdhpi_nn.ts\
|
||||
rdhpi_pt_BR.ts
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.idb\
|
||||
*.ilk\
|
||||
*.lib\
|
||||
*.obj\
|
||||
*.pdb\
|
||||
*.qm\
|
||||
moc_*
|
||||
|
||||
DISTCLEAN = Makefile
|
||||
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
Makefile\
|
||||
Makefile.in\
|
||||
moc_*
|
||||
59
rdhpi/rdhpi.pro
Normal file
59
rdhpi/rdhpi.pro
Normal file
@@ -0,0 +1,59 @@
|
||||
# rdhpi.pro
|
||||
#
|
||||
# The rdhpi/ QMake project file for Rivendell.
|
||||
#
|
||||
# (C) Copyright 2003-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
#
|
||||
# $Id: rdhpi.pro,v 1.4.8.1 2013/01/01 21:36:31 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.
|
||||
|
||||
TEMPLATE = lib
|
||||
|
||||
win32 {
|
||||
DEFINES += WIN32
|
||||
DEFINES += VERSION=\"$$[VERSION]\"
|
||||
DEFINES += PACKAGE=\"rivendell\"
|
||||
DEFINES += PACKAGE_VERSION=\"$$[VERSION]\"
|
||||
DEFINES += PACKAGE_NAME=\"rivendell\"
|
||||
DEFINES += PACKAGE_BUGREPORT=\"fredg@paravelsystems.com\"
|
||||
}
|
||||
|
||||
x11 {
|
||||
SOURCES += rdhpicardselector.cpp
|
||||
SOURCES += rdhpiinformation.cpp
|
||||
SOURCES += rdhpiplaystream.cpp
|
||||
SOURCES += rdhpirecordstream.cpp
|
||||
SOURCES += rdhpisoundcard.cpp
|
||||
SOURCES += rdhpisoundselector.cpp
|
||||
}
|
||||
|
||||
x11 {
|
||||
HEADERS += rdhpicardselector.h
|
||||
HEADERS += rdhpiinformation.h
|
||||
HEADERS += rdhpiplaystream.h
|
||||
HEADERS += rdhpirecordstream.h
|
||||
HEADERS += rdhpisoundcard.h
|
||||
HEADERS += rdhpisoundselector.h
|
||||
}
|
||||
|
||||
CONFIG += qt staticlib
|
||||
|
||||
TRANSLATIONS += rdhpi_cs.ts
|
||||
TRANSLATIONS += rdhpi_de.ts
|
||||
TRANSLATIONS += rdhpi_es.ts
|
||||
TRANSLATIONS += rdhpi_fr.ts
|
||||
TRANSLATIONS += rdhpi_nb.ts
|
||||
TRANSLATIONS += rdhpi_nn.ts
|
||||
TRANSLATIONS += rdhpi_pt_BR.ts
|
||||
67
rdhpi/rdhpi_cs.ts
Normal file
67
rdhpi/rdhpi_cs.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE TS><TS>
|
||||
<context>
|
||||
<name>RDHPIPlayStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No such file or directory</source>
|
||||
<translation>Nepodařilo se najít žádný takový soubor nebo adresář</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No output stream available</source>
|
||||
<translation>Není dostupný žádný výstupní proud</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Proud je již otevřen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Neznámá chyba:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPIRecordStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create/open file</source>
|
||||
<translation>Soubor nelze vytvořit/otevřít</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input stream unavailable</source>
|
||||
<translation>Vstupní proud je nedostupný</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Proud je již otevřen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Neznámá chyba:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPISoundCard</name>
|
||||
<message>
|
||||
<source>Input Stream</source>
|
||||
<translation>Vstupní proud</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Stream</source>
|
||||
<translation>Výstupní proud</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input Port</source>
|
||||
<translation>Vstupní přípojka</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Port</source>
|
||||
<translation>Výstupní přípojka</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
67
rdhpi/rdhpi_de.ts
Normal file
67
rdhpi/rdhpi_de.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE TS><TS>
|
||||
<context>
|
||||
<name>RDHPIPlayStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No such file or directory</source>
|
||||
<translation>Keine solche Datei oder Verzeichnis</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No output stream available</source>
|
||||
<translation>Kein Outputstream verfügbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Stream ist schon geöffnet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Unbekannter Fehler:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPIRecordStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create/open file</source>
|
||||
<translation>Kann die Datei nicht erstellen/öffnen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input stream unavailable</source>
|
||||
<translation>Eingangsstream nicht verfügbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Stream ist schon geöffnet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Unbekannter Fehler:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPISoundCard</name>
|
||||
<message>
|
||||
<source>Input Stream</source>
|
||||
<translation>Eingansstream</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Stream</source>
|
||||
<translation>Ausgangsstream</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input Port</source>
|
||||
<translation>Eingangsport</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Port</source>
|
||||
<translation>Ausgangsport</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
67
rdhpi/rdhpi_es.ts
Normal file
67
rdhpi/rdhpi_es.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE TS><TS>
|
||||
<context>
|
||||
<name>RDHPIPlayStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No such file or directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No output stream available</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPIRecordStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create/open file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input stream unavailable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPISoundCard</name>
|
||||
<message>
|
||||
<source>Input Stream</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Stream</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input Port</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Port</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
67
rdhpi/rdhpi_fr.ts
Normal file
67
rdhpi/rdhpi_fr.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE TS><TS>
|
||||
<context>
|
||||
<name>RDHPIPlayStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No such file or directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No output stream available</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPIRecordStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create/open file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input stream unavailable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPISoundCard</name>
|
||||
<message>
|
||||
<source>Input Stream</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Stream</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input Port</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Port</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
67
rdhpi/rdhpi_nb.ts
Normal file
67
rdhpi/rdhpi_nb.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE TS><TS>
|
||||
<context>
|
||||
<name>RDHPIPlayStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>Ok</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No such file or directory</source>
|
||||
<translation>Inga slik fil eller mappe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No output stream available</source>
|
||||
<translation>Ingen tilgjengeleg utstraum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Straumen er alt open</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Ukjend feil:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPIRecordStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>Ok</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create/open file</source>
|
||||
<translation>Greier ikkje opna/laga fila</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input stream unavailable</source>
|
||||
<translation>Innstraumen er ikkje tilgjengeleg</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Straumen er alt open</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Ukjend feil:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPISoundCard</name>
|
||||
<message>
|
||||
<source>Input Stream</source>
|
||||
<translation>Innstraum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Stream</source>
|
||||
<translation>Utstraum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input Port</source>
|
||||
<translation>Innport</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Port</source>
|
||||
<translation>Utport</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
67
rdhpi/rdhpi_nn.ts
Normal file
67
rdhpi/rdhpi_nn.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE TS><TS>
|
||||
<context>
|
||||
<name>RDHPIPlayStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>Ok</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No such file or directory</source>
|
||||
<translation>Inga slik fil eller mappe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No output stream available</source>
|
||||
<translation>Ingen tilgjengeleg utstraum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Straumen er alt open</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Ukjend feil:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPIRecordStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>Ok</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create/open file</source>
|
||||
<translation>Greier ikkje opna/laga fila</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input stream unavailable</source>
|
||||
<translation>Innstraumen er ikkje tilgjengeleg</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Straumen er alt open</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Ukjend feil:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPISoundCard</name>
|
||||
<message>
|
||||
<source>Input Stream</source>
|
||||
<translation>Innstraum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Stream</source>
|
||||
<translation>Utstraum</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input Port</source>
|
||||
<translation>Innport</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Port</source>
|
||||
<translation>Utport</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
67
rdhpi/rdhpi_pt_BR.ts
Normal file
67
rdhpi/rdhpi_pt_BR.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE TS><TS>
|
||||
<context>
|
||||
<name>RDHPIPlayStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>Ok</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No such file or directory</source>
|
||||
<translation>Este arquivo ou diretório não existe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No output stream available</source>
|
||||
<translation>Não há saída de fluxo disponível</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Fluxo já está aberto</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Erro Desconhecido:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPIRecordStream</name>
|
||||
<message>
|
||||
<source>Ok</source>
|
||||
<translation>Ok</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to create/open file</source>
|
||||
<translation>Não foi possível criar/abrir arquivo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input stream unavailable</source>
|
||||
<translation>Não há entrada de fluxo disponível</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stream is already open</source>
|
||||
<translation>Fluxo já está aberto</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown Error:</source>
|
||||
<translation>Erro Desconhecido:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDHPISoundCard</name>
|
||||
<message>
|
||||
<source>Input Stream</source>
|
||||
<translation>Entrada de fluxo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Stream</source>
|
||||
<translation>Saída de fluxo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input Port</source>
|
||||
<translation>Porta de Entrada</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output Port</source>
|
||||
<translation>Porta de Saída</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
176
rdhpi/rdhpicardselector.cpp
Normal file
176
rdhpi/rdhpicardselector.cpp
Normal file
@@ -0,0 +1,176 @@
|
||||
// rdhpicardselector.cpp
|
||||
//
|
||||
// Audio card selector widget for Rivendell
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpicardselector.cpp,v 1.3 2010/07/29 19:32:36 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 <qdialog.h>
|
||||
#include <qstring.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qtextedit.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpainter.h>
|
||||
#include <qevent.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qbuttongroup.h>
|
||||
|
||||
#include <rdhpisoundcard.h>
|
||||
#include <rdhpicardselector.h>
|
||||
|
||||
|
||||
RDHPICardSelector::RDHPICardSelector(QWidget *parent,const char *name)
|
||||
: QWidget(parent,name)
|
||||
{
|
||||
QFont font;
|
||||
|
||||
yoffset=0;
|
||||
|
||||
//
|
||||
// Generate Font
|
||||
//
|
||||
font=QFont("Helvetica",12,QFont::Bold);
|
||||
font.setPixelSize(12);
|
||||
|
||||
//
|
||||
// Title
|
||||
//
|
||||
card_title=new QLabel(this,"card_title");
|
||||
card_title->setGeometry(0,0,geometry().width(),19);
|
||||
card_title->setFont(font);
|
||||
card_title->setAlignment(AlignHCenter);
|
||||
card_title->hide();
|
||||
|
||||
//
|
||||
// Card
|
||||
//
|
||||
card_card_box=new QSpinBox(this,"card_card_box");
|
||||
card_card_box->setGeometry(60,yoffset,50,19);
|
||||
card_card_box->setSpecialValueText("None");
|
||||
card_card_box->setMinValue(-1);
|
||||
card_card_box->setMaxValue(HPI_MAX_ADAPTERS-1);
|
||||
card_card_box->setValue(-1);
|
||||
connect(card_card_box,SIGNAL(valueChanged(int)),this,SLOT(cardData(int)));
|
||||
card_card_label=new QLabel(card_card_box,"Card:",this,
|
||||
"card_card_label");
|
||||
card_card_label->setGeometry(0,yoffset+2,55,19);
|
||||
card_card_label->setAlignment(AlignRight|ShowPrefix);
|
||||
|
||||
//
|
||||
// Port
|
||||
//
|
||||
card_port_box=new QSpinBox(this,"card_port_box");
|
||||
card_port_box->setGeometry(60,yoffset+22,50,19);
|
||||
card_port_box->setMinValue(0);
|
||||
card_port_box->setMaxValue(HPI_MAX_NODES-1);
|
||||
card_port_box->setDisabled(true);
|
||||
connect(card_port_box,SIGNAL(valueChanged(int)),this,SLOT(portData(int)));
|
||||
card_port_label=new QLabel(card_port_box,"Port:",this,
|
||||
"card_port_label");
|
||||
card_port_label->setGeometry(0,yoffset+24,55,19);
|
||||
card_port_label->setAlignment(AlignRight|ShowPrefix);
|
||||
}
|
||||
|
||||
|
||||
RDHPICardSelector::~RDHPICardSelector()
|
||||
{
|
||||
delete card_title;
|
||||
delete card_card_box;
|
||||
delete card_port_box;
|
||||
}
|
||||
|
||||
|
||||
QSize RDHPICardSelector::sizeHint() const
|
||||
{
|
||||
return QSize(110,43+yoffset);
|
||||
}
|
||||
|
||||
|
||||
QSizePolicy RDHPICardSelector::sizePolicy() const
|
||||
{
|
||||
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
|
||||
QString RDHPICardSelector::title() const
|
||||
{
|
||||
return card_title->text();
|
||||
}
|
||||
|
||||
|
||||
void RDHPICardSelector::setTitle(QString title)
|
||||
{
|
||||
card_title->setText(title);
|
||||
if(title.isEmpty()) {
|
||||
yoffset=0;
|
||||
card_title->hide();
|
||||
}
|
||||
else {
|
||||
yoffset=22;
|
||||
card_title->show();
|
||||
}
|
||||
card_card_box->setGeometry(60,yoffset,50,19);
|
||||
card_card_label->setGeometry(0,yoffset+2,55,19);
|
||||
card_port_box->setGeometry(60,yoffset+22,50,19);
|
||||
card_port_label->setGeometry(0,yoffset+24,55,19);
|
||||
}
|
||||
|
||||
|
||||
int RDHPICardSelector::card() const
|
||||
{
|
||||
return card_card_box->value();
|
||||
}
|
||||
|
||||
|
||||
void RDHPICardSelector::setCard(int card)
|
||||
{
|
||||
card_card_box->setValue(card);
|
||||
}
|
||||
|
||||
|
||||
int RDHPICardSelector::port() const
|
||||
{
|
||||
return card_port_box->value();
|
||||
}
|
||||
|
||||
|
||||
void RDHPICardSelector::setPort(int port)
|
||||
{
|
||||
card_port_box->setValue(port);
|
||||
}
|
||||
|
||||
|
||||
void RDHPICardSelector::cardData(int card)
|
||||
{
|
||||
if(card>=0) {
|
||||
card_port_box->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
card_port_box->setDisabled(true);
|
||||
}
|
||||
emit cardChanged(card);
|
||||
}
|
||||
|
||||
|
||||
void RDHPICardSelector::portData(int port)
|
||||
{
|
||||
emit portChanged(port);
|
||||
}
|
||||
|
||||
64
rdhpi/rdhpicardselector.h
Normal file
64
rdhpi/rdhpicardselector.h
Normal file
@@ -0,0 +1,64 @@
|
||||
// rdhpicardselector.h
|
||||
//
|
||||
// Audio Card Selector Widget
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpicardselector.h,v 1.3 2010/07/29 19:32:36 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 RDHPICARDSELECTOR_H
|
||||
#define RDHPICARDSELECTOR_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qlabel.h>
|
||||
|
||||
|
||||
class RDHPICardSelector : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RDHPICardSelector(QWidget *parent=0,const char *name=0);
|
||||
~RDHPICardSelector();
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
QString title() const;
|
||||
void setTitle(QString title);
|
||||
int card() const;
|
||||
void setCard(int card);
|
||||
int port() const;
|
||||
void setPort(int port);
|
||||
|
||||
signals:
|
||||
void cardChanged(int card);
|
||||
void portChanged(int port);
|
||||
|
||||
private slots:
|
||||
void cardData(int);
|
||||
void portData(int);
|
||||
|
||||
private:
|
||||
QLabel *card_card_label;
|
||||
QSpinBox *card_card_box;
|
||||
QLabel *card_port_label;
|
||||
QSpinBox *card_port_box;
|
||||
QLabel *card_title;
|
||||
int yoffset;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDHPICARDSELECTOR_H
|
||||
130
rdhpi/rdhpiinformation.cpp
Normal file
130
rdhpi/rdhpiinformation.cpp
Normal file
@@ -0,0 +1,130 @@
|
||||
// rdhpiinformation.cpp
|
||||
//
|
||||
// A Container Class for AudioScience HPI Adapter Info
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpiinformation.cpp,v 1.4 2011/05/18 15:25:33 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 <rdhpiinformation.h>
|
||||
|
||||
|
||||
RDHPIInformation::RDHPIInformation()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
unsigned RDHPIInformation::serialNumber() const
|
||||
{
|
||||
return serial_number;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIInformation::setSerialNumber(unsigned num)
|
||||
{
|
||||
serial_number=num;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDHPIInformation::hpiMajorVersion() const
|
||||
{
|
||||
return (hpi_version>>16)&0xffff;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDHPIInformation::hpiMinorVersion() const
|
||||
{
|
||||
return (hpi_version>>8)&0xff;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDHPIInformation::hpiPointVersion() const
|
||||
{
|
||||
return hpi_version&0xff;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RDHPIInformation::hpiVersion() const
|
||||
{
|
||||
return hpi_version;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIInformation::setHpiVersion(uint32_t ver)
|
||||
{
|
||||
hpi_version=ver;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDHPIInformation::dspMajorVersion() const
|
||||
{
|
||||
return dsp_major_version;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIInformation::setDspMajorVersion(unsigned ver)
|
||||
{
|
||||
dsp_major_version=ver;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDHPIInformation::dspMinorVersion() const
|
||||
{
|
||||
return dsp_minor_version;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIInformation::setDspMinorVersion(unsigned ver)
|
||||
{
|
||||
dsp_minor_version=ver;
|
||||
}
|
||||
|
||||
|
||||
char RDHPIInformation::pcbVersion() const
|
||||
{
|
||||
return pcb_version;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIInformation::setPcbVersion(char ver)
|
||||
{
|
||||
pcb_version=ver;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDHPIInformation::assemblyVersion() const
|
||||
{
|
||||
return assembly_version;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIInformation::setAssemblyVersion(unsigned ver)
|
||||
{
|
||||
assembly_version=ver;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIInformation::clear()
|
||||
{
|
||||
serial_number=0;
|
||||
hpi_version=0;
|
||||
dsp_major_version=0;
|
||||
dsp_minor_version=0;
|
||||
pcb_version='0';
|
||||
assembly_version=0;
|
||||
}
|
||||
63
rdhpi/rdhpiinformation.h
Normal file
63
rdhpi/rdhpiinformation.h
Normal file
@@ -0,0 +1,63 @@
|
||||
// rdhpiinformation.h
|
||||
//
|
||||
// A Container Class for AudioScience HPI Adapter Info
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpiinformation.h,v 1.2 2011/05/18 15:25:33 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 RDHPIINFORMATION_H
|
||||
#define RDHPIINFORMATION_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class RDHPIInformation
|
||||
{
|
||||
public:
|
||||
RDHPIInformation();
|
||||
unsigned serialNumber() const;
|
||||
void setSerialNumber(unsigned num);
|
||||
unsigned hpiMajorVersion() const;
|
||||
void setHpiMajorVersion(unsigned ver);
|
||||
unsigned hpiMinorVersion() const;
|
||||
void setHpiMinorVersion(unsigned ver);
|
||||
unsigned hpiPointVersion() const;
|
||||
void setHpiPointVersion(unsigned ver);
|
||||
uint32_t hpiVersion() const;
|
||||
void setHpiVersion(uint32_t ver);
|
||||
unsigned dspMajorVersion() const;
|
||||
void setDspMajorVersion(unsigned ver);
|
||||
unsigned dspMinorVersion() const;
|
||||
void setDspMinorVersion(unsigned ver);
|
||||
char pcbVersion() const;
|
||||
void setPcbVersion(char ver);
|
||||
unsigned assemblyVersion() const;
|
||||
void setAssemblyVersion(unsigned ver);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
unsigned serial_number;
|
||||
unsigned dsp_major_version;
|
||||
uint32_t hpi_version;
|
||||
unsigned dsp_minor_version;
|
||||
char pcb_version;
|
||||
unsigned assembly_version;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDHPIINFORMATION_H
|
||||
|
||||
798
rdhpi/rdhpiplaystream.cpp
Normal file
798
rdhpi/rdhpiplaystream.cpp
Normal file
@@ -0,0 +1,798 @@
|
||||
// rdhpiplaystream.cpp
|
||||
//
|
||||
// A class for playing Microsoft WAV files.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpiplaystream.cpp,v 1.8.6.1 2012/05/04 14:56:22 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 <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <syslog.h>
|
||||
#include <fcntl.h>
|
||||
#include <qobject.h>
|
||||
#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
|
||||
#include <rd.h>
|
||||
#include <rdhpiplaystream.h>
|
||||
#include <rdhpisoundcard.h>
|
||||
|
||||
#define RDHPIPLAYSTREAM_USE_LOCAL_MUTEX
|
||||
|
||||
#ifdef RDHPIPLAYSTREAM_USE_LOCAL_MUTEX
|
||||
volatile static int stream_mutex[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS]=
|
||||
{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
|
||||
#endif
|
||||
|
||||
|
||||
RDHPIPlayStream::RDHPIPlayStream(RDHPISoundCard *card,
|
||||
QWidget *parent,const char *name)
|
||||
:QObject(parent,name),RDWaveFile()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
int quan;
|
||||
uint16_t type[HPI_MAX_ADAPTERS];
|
||||
|
||||
sound_card=card;
|
||||
card_number=-1;
|
||||
stream_number=-1;
|
||||
is_open=false;
|
||||
playing=false;
|
||||
is_paused=false;
|
||||
repositioned=false;
|
||||
stopping=false;
|
||||
samples_skipped=0;
|
||||
play_length=0;
|
||||
play_speed=1000;
|
||||
pitch_can_vary=false;
|
||||
rate_can_vary=false;
|
||||
stream_state=RDHPIPlayStream::Stopped;
|
||||
pdata=NULL;
|
||||
restart_transport=false;
|
||||
samples_pending=0;
|
||||
current_position=0;
|
||||
|
||||
//
|
||||
// Get Adapter Indices
|
||||
//
|
||||
#if HPI_VER < 0x00030600
|
||||
for(unsigned i=0;i<HPI_MAX_ADAPTERS;i++) {
|
||||
card_index[i]=i;
|
||||
}
|
||||
#else
|
||||
hpi_err=HPI_SubSysGetNumAdapters(NULL,&quan);
|
||||
for(int i=0;i<quan;i++) {
|
||||
hpi_err=HPI_SubSysGetAdapter(NULL,i,card_index+i,type+i);
|
||||
}
|
||||
#endif // HPI_VER
|
||||
|
||||
clock=new QTimer(this,"clock");
|
||||
connect(clock,SIGNAL(timeout()),this,SLOT(tickClock()));
|
||||
|
||||
play_timer=new QTimer(this,"play_timer");
|
||||
connect(play_timer,SIGNAL(timeout()),this,SLOT(pause()));
|
||||
}
|
||||
|
||||
|
||||
RDHPIPlayStream::~RDHPIPlayStream()
|
||||
{
|
||||
if(is_open) {
|
||||
closeWave();
|
||||
}
|
||||
if(pdata!=NULL) {
|
||||
delete pdata;
|
||||
}
|
||||
delete clock;
|
||||
delete play_timer;
|
||||
}
|
||||
|
||||
|
||||
QString RDHPIPlayStream::errorString(RDHPIPlayStream::Error err)
|
||||
{
|
||||
QString str;
|
||||
|
||||
switch(err) {
|
||||
case RDHPIPlayStream::Ok:
|
||||
return QString(tr("Ok"));
|
||||
break;
|
||||
|
||||
case RDHPIPlayStream::NoFile:
|
||||
return QString(tr("No such file or directory"));
|
||||
break;
|
||||
|
||||
case RDHPIPlayStream::NoStream:
|
||||
return QString(tr("No output stream available"));
|
||||
break;
|
||||
|
||||
case RDHPIPlayStream::AlreadyOpen:
|
||||
return QString(tr("Stream is already open"));
|
||||
break;
|
||||
|
||||
default:
|
||||
str=QString(tr("Unknown Error:"));
|
||||
return QString().sprintf("%s %d\n",(const char *)str,err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
|
||||
{
|
||||
hpi_err_t hpi_error;
|
||||
#if HPI_VER < 0x30A00
|
||||
HPI_FORMAT hpi_format;
|
||||
#else
|
||||
struct hpi_format hpi_format;
|
||||
#endif
|
||||
hpi_handle_t hostream;
|
||||
bool found=false;
|
||||
|
||||
if(card_number<0) {
|
||||
return false;
|
||||
}
|
||||
if(format==RDWaveFile::Vorbis) {
|
||||
#ifdef HAVE_VORBIS
|
||||
return true;
|
||||
#endif // HAVE_VORBIS
|
||||
return false;
|
||||
}
|
||||
if(!is_open) {
|
||||
for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) {
|
||||
if((hpi_error=HPI_OutStreamOpen(NULL,card_index[card_number],i,
|
||||
&hostream))==0) {
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
hostream=hpi_stream;
|
||||
}
|
||||
switch(format) {
|
||||
case RDWaveFile::Pcm16:
|
||||
hpi_error=HPI_FormatCreate(&hpi_format,getChannels(),
|
||||
HPI_FORMAT_PCM16_SIGNED,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
|
||||
break;
|
||||
|
||||
case RDWaveFile::MpegL1:
|
||||
hpi_error=HPI_FormatCreate(&hpi_format,getChannels(),
|
||||
HPI_FORMAT_MPEG_L1,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
|
||||
break;
|
||||
|
||||
case RDWaveFile::MpegL2:
|
||||
hpi_error=HPI_FormatCreate(&hpi_format,getChannels(),
|
||||
HPI_FORMAT_MPEG_L2,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
|
||||
break;;
|
||||
|
||||
case RDWaveFile::MpegL3:
|
||||
hpi_error=HPI_FormatCreate(&hpi_format,getChannels(),
|
||||
HPI_FORMAT_MPEG_L3,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
state=HPI_OutStreamQueryFormat(NULL,hostream,&hpi_format);
|
||||
break;
|
||||
|
||||
default:
|
||||
state=1;
|
||||
break;
|
||||
}
|
||||
if(!is_open) {
|
||||
hpi_error=HPI_OutStreamClose(NULL,hostream);
|
||||
}
|
||||
if(state!=0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIPlayStream::formatSupported()
|
||||
{
|
||||
switch(getFormatTag()) {
|
||||
case WAVE_FORMAT_PCM:
|
||||
switch(getBitsPerSample()) {
|
||||
case 8:
|
||||
return formatSupported(RDWaveFile::Pcm8);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
return formatSupported(RDWaveFile::Pcm16);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case WAVE_FORMAT_MPEG:
|
||||
switch(getHeadLayer()) {
|
||||
case 1:
|
||||
return formatSupported(RDWaveFile::MpegL1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return formatSupported(RDWaveFile::MpegL2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
return formatSupported(RDWaveFile::MpegL3);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RDHPIPlayStream::Error RDHPIPlayStream::openWave()
|
||||
{
|
||||
if(is_open) {
|
||||
return RDHPIPlayStream::AlreadyOpen;
|
||||
}
|
||||
nameWave(wave_name);
|
||||
samples_skipped=0;
|
||||
samples_pending=0;
|
||||
if(!RDWaveFile::openWave()) {
|
||||
return RDHPIPlayStream::NoFile;
|
||||
}
|
||||
if(GetStream()<0) {
|
||||
RDWaveFile::closeWave();
|
||||
return RDHPIPlayStream::NoStream;
|
||||
}
|
||||
is_open=true;
|
||||
return RDHPIPlayStream::Ok;
|
||||
}
|
||||
|
||||
|
||||
RDHPIPlayStream::Error RDHPIPlayStream::openWave(QString file_name)
|
||||
{
|
||||
if(is_open) {
|
||||
return RDHPIPlayStream::AlreadyOpen;
|
||||
}
|
||||
wave_name=file_name;
|
||||
return openWave();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RDHPIPlayStream::closeWave()
|
||||
{
|
||||
if(!is_open) {
|
||||
return;
|
||||
}
|
||||
if(playing||is_paused) {
|
||||
stop();
|
||||
}
|
||||
FreeStream();
|
||||
RDWaveFile::closeWave();
|
||||
is_open=false;
|
||||
}
|
||||
|
||||
|
||||
int RDHPIPlayStream::getCard() const
|
||||
{
|
||||
return card_number;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIPlayStream::setCard(int card)
|
||||
{
|
||||
if(!playing) {
|
||||
card_number=card;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int RDHPIPlayStream::getStream() const
|
||||
{
|
||||
return stream_number;
|
||||
}
|
||||
|
||||
|
||||
int RDHPIPlayStream::getSpeed() const
|
||||
{
|
||||
return play_speed;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIPlayStream::setSpeed(int speed,bool pitch,bool rate)
|
||||
{
|
||||
if(speed!=RD_TIMESCALE_DIVISOR) {
|
||||
if(!pitch) {
|
||||
if(!sound_card->haveTimescaling(card_number)) {
|
||||
return false;
|
||||
}
|
||||
if((speed<TIMESCALE_LOW_LIMIT)||(speed>TIMESCALE_HIGH_LIMIT)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!rate) { // Variable speed with resampling not yet supported!
|
||||
return false;
|
||||
}
|
||||
if((speed<96000)||(speed>104000)) { // Max variation +/- 4%
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
play_speed=speed;
|
||||
pitch_can_vary=pitch;
|
||||
rate_can_vary=rate;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
RDHPIPlayStream::State RDHPIPlayStream::getState() const
|
||||
{
|
||||
return stream_state;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIPlayStream::play()
|
||||
{
|
||||
#ifdef RPLAYSTREAM_SHOW_SLOTS
|
||||
printf("play() -- Card: %d Stream: %d\n",card_number,stream_number);
|
||||
#endif // RPLAYSTREAM_SHOW_SLOTS
|
||||
hpi_err_t hpi_error;
|
||||
syslog(LOG_ERR,"Play - 1\n");
|
||||
if(!is_open) {
|
||||
return false;
|
||||
}
|
||||
if((!playing)&&(!is_paused)) {
|
||||
hpi_error=HPI_OutStreamSetTimeScale(NULL,hpi_stream,
|
||||
(uint16_t)((RD_TIMESCALE_DIVISOR/(double)play_speed)*
|
||||
HPI_OSTREAM_TIMESCALE_UNITS));
|
||||
if(HPI_OutStreamGetInfoEx(NULL,hpi_stream,
|
||||
&state,&buffer_size,&data_to_play,
|
||||
&samples_played,&reserved)!=0) {
|
||||
return false;
|
||||
}
|
||||
fragment_size=buffer_size/4;
|
||||
if(fragment_size>MAX_FRAGMENT_SIZE) {
|
||||
fragment_size=MAX_FRAGMENT_SIZE;
|
||||
}
|
||||
if(pdata!=NULL) {
|
||||
delete pdata;
|
||||
}
|
||||
pdata=(uint8_t *)malloc(fragment_size);
|
||||
if(pdata==NULL) {
|
||||
return false;
|
||||
}
|
||||
switch(getFormatTag()) {
|
||||
case WAVE_FORMAT_PCM:
|
||||
case WAVE_FORMAT_VORBIS:
|
||||
switch(getBitsPerSample()) {
|
||||
case 8:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_PCM8_UNSIGNED,getSamplesPerSec(),
|
||||
0,0);
|
||||
break;
|
||||
case 16:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_PCM16_SIGNED,getSamplesPerSec(),
|
||||
0,0);
|
||||
break;
|
||||
case 32:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_PCM32_SIGNED,getSamplesPerSec(),
|
||||
0,0);
|
||||
break;
|
||||
default:
|
||||
hpi_error=HPI_AdapterClose(NULL,card_index[card_number]);
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WAVE_FORMAT_MPEG:
|
||||
switch(getHeadLayer()) {
|
||||
case 1:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_MPEG_L1,getSamplesPerSec(),
|
||||
getHeadBitRate(),getHeadFlags());
|
||||
break;
|
||||
case 2:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_MPEG_L2,getSamplesPerSec(),
|
||||
getHeadBitRate(),getHeadFlags());
|
||||
break;
|
||||
case 3:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_MPEG_L3,getSamplesPerSec(),
|
||||
getHeadBitRate(),getHeadFlags());
|
||||
break;
|
||||
default:
|
||||
hpi_error=HPI_AdapterClose(NULL,card_index[card_number]);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#if HPI_VER < 0x00030500
|
||||
if(HPI_DataCreate(&hpi_data,&format,pdata,fragment_size)!=0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(!is_paused) {
|
||||
memset(pdata,0,fragment_size);
|
||||
left_to_write=getDataLength()-seekWave(0,SEEK_CUR);
|
||||
if(left_to_write<fragment_size) {
|
||||
read_bytes = left_to_write;
|
||||
left_to_write=0;
|
||||
stopping=true;
|
||||
}
|
||||
else {
|
||||
read_bytes=fragment_size;
|
||||
left_to_write-=fragment_size;
|
||||
}
|
||||
readWave(pdata,read_bytes);
|
||||
#if HPI_VER > 0x00030500
|
||||
hpi_error=
|
||||
HPI_OutStreamWriteBuf(NULL,hpi_stream,pdata,read_bytes,&format);
|
||||
#else
|
||||
hpi_error=HPI_DataCreate(&hpi_data,&format,pdata,read_bytes);
|
||||
hpi_error=HPI_OutStreamWrite(NULL,hpi_stream,&hpi_data);
|
||||
#endif
|
||||
if(HPI_OutStreamStart(NULL,hpi_stream)!=0) {
|
||||
return false;
|
||||
}
|
||||
clock->start(50);
|
||||
clock->start(FRAGMENT_TIME);
|
||||
playing=true;
|
||||
is_paused=false;
|
||||
stopping=false;
|
||||
if(play_length>0) {
|
||||
play_timer->start(play_length,true);
|
||||
start_time=QTime::currentTime();
|
||||
}
|
||||
stream_state=RDHPIPlayStream::Playing;
|
||||
if(!restart_transport) {
|
||||
emit isStopped(false);
|
||||
emit played();
|
||||
emit stateChanged(card_number,stream_number,(int)stream_state);
|
||||
}
|
||||
}
|
||||
if((!playing)&(is_paused|repositioned)) {
|
||||
hpi_error=HPI_OutStreamStart(NULL,hpi_stream);
|
||||
clock->start(FRAGMENT_TIME);
|
||||
playing=true;
|
||||
stopping=false;
|
||||
is_paused=false;
|
||||
stream_state=RDHPIPlayStream::Playing;
|
||||
if(!restart_transport) {
|
||||
emit isStopped(false);
|
||||
emit played();
|
||||
emit stateChanged(card_number,stream_number,(int)stream_state);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIPlayStream::pause()
|
||||
{
|
||||
#ifdef RPLAYSTREAM_SHOW_SLOTS
|
||||
printf("pause() -- Card: %d Stream: %d\n",card_number,stream_number);
|
||||
#endif // RPLAYSTREAM_SHOW_SLOTS
|
||||
hpi_err_t hpi_error;
|
||||
uint16_t state;
|
||||
uint32_t buffer_size;
|
||||
uint32_t data_to_play;
|
||||
uint32_t reserved;
|
||||
|
||||
if(!is_open) {
|
||||
return;
|
||||
}
|
||||
if(playing) {
|
||||
hpi_error=HPI_OutStreamStop(NULL,hpi_stream);
|
||||
clock->stop();
|
||||
hpi_error=HPI_OutStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size,
|
||||
&data_to_play,&samples_played,&reserved);
|
||||
switch(getFormatTag()) {
|
||||
case WAVE_FORMAT_PCM:
|
||||
samples_pending=data_to_play/(getChannels()*getBitsPerSample()/8);
|
||||
break;
|
||||
|
||||
case WAVE_FORMAT_MPEG:
|
||||
samples_pending=
|
||||
1152*data_to_play/(144*getHeadBitRate()/getSamplesPerSec());
|
||||
break;
|
||||
}
|
||||
playing=false;
|
||||
is_paused=true;
|
||||
stream_state=RDHPIPlayStream::Paused;
|
||||
if(!restart_transport) {
|
||||
emit paused();
|
||||
emit stateChanged(card_number,stream_number,(int)stream_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RDHPIPlayStream::stop()
|
||||
{
|
||||
#ifdef RPLAYSTREAM_SHOW_SLOTS
|
||||
|
||||
printf("stop() -- Card: %d Stream: %d\n",card_number,stream_number);
|
||||
#endif // RPLAYSTREAM_SHOW_SLOTS
|
||||
hpi_err_t hpi_error;
|
||||
|
||||
if(!is_open) {
|
||||
return;
|
||||
}
|
||||
if(playing|is_paused) {
|
||||
hpi_error=HPI_OutStreamStop(NULL,hpi_stream);
|
||||
clock->stop();
|
||||
playing=false;
|
||||
is_paused=false;
|
||||
seekWave(0,SEEK_SET);
|
||||
hpi_error=HPI_OutStreamReset(NULL,hpi_stream);
|
||||
samples_pending=0;
|
||||
samples_skipped=0;
|
||||
stream_state=RDHPIPlayStream::Stopped;
|
||||
current_position=0;
|
||||
if(pdata!=NULL) {
|
||||
delete pdata;
|
||||
pdata=NULL;
|
||||
}
|
||||
if(!restart_transport) {
|
||||
emit position(0);
|
||||
emit isStopped(true);
|
||||
emit stopped();
|
||||
emit stateChanged(card_number,stream_number,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int RDHPIPlayStream::currentPosition()
|
||||
{
|
||||
if(current_position!=samples_played+samples_skipped) {
|
||||
current_position=samples_played+samples_skipped;
|
||||
}
|
||||
return samples_played+samples_skipped;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIPlayStream::setPosition(unsigned samples)
|
||||
{
|
||||
hpi_err_t hpi_error;
|
||||
|
||||
#ifdef RPLAYSTREAM_SHOW_SLOTS
|
||||
printf("setPosition(%d) -- Card: %d Stream: %d\n",samples,
|
||||
card_number,stream_number);
|
||||
#endif // RPLAYSTREAM_SHOW_SLOTS
|
||||
if((samples<0)||(samples>getSampleLength())) {
|
||||
return false;
|
||||
}
|
||||
if(playing&&((unsigned)samples!=(samples_skipped+samples_played))) {
|
||||
restart_transport=true;
|
||||
pause();
|
||||
}
|
||||
|
||||
if(!playing) {
|
||||
if(is_paused) {
|
||||
is_paused=false;
|
||||
repositioned=true;
|
||||
}
|
||||
hpi_error=HPI_OutStreamReset(NULL,hpi_stream);
|
||||
samples_played=0;
|
||||
switch(getFormatTag()) {
|
||||
case WAVE_FORMAT_PCM:
|
||||
case WAVE_FORMAT_VORBIS:
|
||||
samples_skipped=
|
||||
(unsigned)((double)getBlockAlign()*
|
||||
((double)samples/(double)getBlockAlign()));
|
||||
seekWave((int)((double)samples_skipped*(double)getBlockAlign()),
|
||||
SEEK_SET);
|
||||
break;
|
||||
case WAVE_FORMAT_MPEG:
|
||||
samples_skipped=
|
||||
(unsigned)((double)getBlockAlign()*
|
||||
((double)samples/(double)getBlockAlign()));
|
||||
seekWave((int)((double)(getAvgBytesPerSec())*
|
||||
((double)(samples_skipped)/
|
||||
((double)getSamplesPerSec()))),
|
||||
SEEK_SET);
|
||||
break;
|
||||
}
|
||||
emit position(samples);
|
||||
}
|
||||
if(restart_transport) {
|
||||
play();
|
||||
restart_transport=false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIPlayStream::setPlayLength(int length)
|
||||
{
|
||||
int diff;
|
||||
|
||||
if(play_timer->isActive()) {
|
||||
QTime current_time=QTime::currentTime();
|
||||
if((diff=length-start_time.msecsTo(current_time))<=0) {
|
||||
diff=0;
|
||||
}
|
||||
play_timer->changeInterval(diff);
|
||||
start_time=current_time;
|
||||
}
|
||||
play_length=length;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIPlayStream::tickClock()
|
||||
{
|
||||
static int count=0;
|
||||
hpi_err_t hpi_err;
|
||||
char hpi_text[100];
|
||||
int n;
|
||||
|
||||
hpi_err=HPI_OutStreamGetInfoEx(NULL,hpi_stream,
|
||||
&state,&buffer_size,&data_to_play,
|
||||
&samples_played,&reserved);
|
||||
if(!stopping) {
|
||||
while((buffer_size-data_to_play)>=fragment_size) {
|
||||
n=readWave(pdata,fragment_size);
|
||||
if((n<=0)||(((uint32_t)n)<fragment_size)) {
|
||||
// End of file
|
||||
#if HPI_VER > 0x00030500
|
||||
if((hpi_err=HPI_OutStreamWriteBuf(NULL,hpi_stream,
|
||||
pdata,n,&format))!=0) {
|
||||
HPI_GetErrorText(hpi_err,hpi_text);
|
||||
fprintf(stderr,"*** HPI Error: %s ***\n",hpi_text);
|
||||
}
|
||||
#else
|
||||
HPI_DataCreate(&hpi_data,&format,pdata,n);
|
||||
if((hpi_err=HPI_OutStreamWrite(NULL,hpi_stream,
|
||||
&hpi_data))!=0) {
|
||||
HPI_GetErrorText(hpi_err,hpi_text);
|
||||
fprintf(stderr,"*** HPI Error: %s ***\n",hpi_text);
|
||||
}
|
||||
#endif
|
||||
left_to_write=0;
|
||||
stopping=true;
|
||||
return;
|
||||
}
|
||||
left_to_write-=n;
|
||||
#if HPI_VER > 0x00030500
|
||||
hpi_err=HPI_OutStreamWriteBuf(NULL,hpi_stream,
|
||||
pdata,n,&format);
|
||||
#else
|
||||
hpi_err=HPI_DataCreate(&hpi_data,&format,pdata,n);
|
||||
hpi_err=HPI_OutStreamWrite(NULL,hpi_stream,&hpi_data);
|
||||
#endif
|
||||
hpi_err=HPI_OutStreamGetInfoEx(NULL,hpi_stream,
|
||||
&state,&buffer_size,&data_to_play,
|
||||
&samples_played,&reserved);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(state==HPI_STATE_DRAINED) {
|
||||
hpi_err=HPI_OutStreamStop(NULL,hpi_stream);
|
||||
hpi_err=HPI_OutStreamClose(NULL,hpi_stream);
|
||||
hpi_err=HPI_AdapterClose(NULL,card_index[card_number]);
|
||||
clock->stop();
|
||||
playing=false;
|
||||
seekWave(0,SEEK_SET);
|
||||
hpi_err=HPI_OutStreamReset(NULL,hpi_stream);
|
||||
samples_pending=0;
|
||||
samples_skipped=0;
|
||||
stream_state=RDHPIPlayStream::Stopped;
|
||||
emit position(0);
|
||||
emit isStopped(true);
|
||||
emit stopped();
|
||||
emit stateChanged(card_number,stream_number,(int)stream_state);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(count++==2) {
|
||||
count=0;
|
||||
emit position(samples_played+samples_skipped);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDHPIPlayStream::Drained()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int RDHPIPlayStream::GetStream()
|
||||
{
|
||||
hpi_err_t hpi_error;
|
||||
|
||||
#ifdef RDHPIPLAYSTREAM_USE_LOCAL_MUTEX
|
||||
for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) {
|
||||
if(++stream_mutex[card_number][i]==1) {
|
||||
hpi_error=HPI_OutStreamOpen(NULL,card_index[card_number],i,&hpi_stream);
|
||||
stream_number=i;
|
||||
return stream_number;
|
||||
}
|
||||
else {
|
||||
stream_mutex[card_number][i]--;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
#else
|
||||
for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) {
|
||||
if(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hpi_stream)==0) {
|
||||
stream_number=i;
|
||||
// syslog(LOG_ERR,"HPI allocating ostream: %d",stream_number);
|
||||
return stream_number;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void RDHPIPlayStream::FreeStream()
|
||||
{
|
||||
hpi_err_t hpi_error;
|
||||
|
||||
#ifdef RDHPIPLAYSTREAM_USE_LOCAL_MUTEX
|
||||
stream_mutex[card_number][stream_number]--;
|
||||
hpi_error=HPI_OutStreamClose(NULL,hpi_stream);
|
||||
stream_number=-1;
|
||||
#else
|
||||
hpi_error=HPI_OutStreamClose(NULL,hpi_stream);
|
||||
// syslog(LOG_ERR,"HPI closing ostream: %d",stream_number);
|
||||
stream_number=-1;
|
||||
#endif
|
||||
}
|
||||
139
rdhpi/rdhpiplaystream.h
Normal file
139
rdhpi/rdhpiplaystream.h
Normal file
@@ -0,0 +1,139 @@
|
||||
// rdhpiplaystream.h
|
||||
//
|
||||
// A class for playing Microsoft WAV files.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpiplaystream.h,v 1.7.6.1 2012/05/04 14:56:22 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 RDHPIPLAYSTREAM_H
|
||||
#define RDHPIPLAYSTREAM_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <qobject.h>
|
||||
#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qtimer.h>
|
||||
#include <qdatetime.h>
|
||||
#include <rdwavefile.h>
|
||||
#include <rdhpisoundcard.h>
|
||||
|
||||
#include <asihpi/hpi.h>
|
||||
#ifndef HPI_VER
|
||||
#include <asihpi/hpi_version.h>
|
||||
#endif
|
||||
|
||||
#define MAX_FRAGMENT_SIZE 192000
|
||||
#define FRAGMENT_TIME 50
|
||||
#define TIMESCALE_LOW_LIMIT 83300
|
||||
#define TIMESCALE_HIGH_LIMIT 125000
|
||||
//#define RPLAYSTREAM_SHOW_SLOTS yes
|
||||
|
||||
|
||||
class RDHPIPlayStream : public QObject,public RDWaveFile
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum State {Stopped=0,Playing=1,Paused=2};
|
||||
enum Error {Ok=0,NoFile=1,NoStream=2,AlreadyOpen=3};
|
||||
RDHPIPlayStream(RDHPISoundCard *card,QWidget *parent=0,const char *name=0);
|
||||
~RDHPIPlayStream();
|
||||
QString errorString(RDHPIPlayStream::Error err);
|
||||
bool formatSupported(RDWaveFile::Format format);
|
||||
bool formatSupported();
|
||||
RDHPIPlayStream::Error openWave();
|
||||
RDHPIPlayStream::Error openWave(QString filename);
|
||||
void closeWave();
|
||||
int getCard() const;
|
||||
int getStream() const;
|
||||
int getSpeed() const;
|
||||
bool setSpeed(int speed,bool pitch=false,bool rate=false);
|
||||
RDHPIPlayStream::State getState() const;
|
||||
|
||||
signals:
|
||||
void isStopped(bool state);
|
||||
void played();
|
||||
void paused();
|
||||
void stopped();
|
||||
void position(int samples);
|
||||
void stateChanged(int card,int stream,int state);
|
||||
|
||||
public slots:
|
||||
void setCard(int card);
|
||||
bool play();
|
||||
void pause();
|
||||
void stop();
|
||||
int currentPosition();
|
||||
bool setPosition(unsigned samples);
|
||||
void setPlayLength(int length);
|
||||
void tickClock();
|
||||
|
||||
private:
|
||||
void Drained();
|
||||
int GetStream();
|
||||
void FreeStream();
|
||||
RDHPISoundCard *sound_card;
|
||||
RDHPIPlayStream::State stream_state;
|
||||
QString wave_name;
|
||||
QTimer *clock;
|
||||
uint32_t card_index[HPI_MAX_ADAPTERS];
|
||||
int card_number;
|
||||
int stream_number;
|
||||
bool is_open;
|
||||
bool playing;
|
||||
bool is_paused;
|
||||
bool repositioned;
|
||||
bool stopping;
|
||||
unsigned audio_ptr;
|
||||
unsigned left_to_write;
|
||||
unsigned read_bytes;
|
||||
unsigned samples_skipped;
|
||||
int play_length;
|
||||
QTimer *play_timer;
|
||||
QTime start_time;
|
||||
int play_speed;
|
||||
bool pitch_can_vary;
|
||||
bool rate_can_vary;
|
||||
hpi_handle_t hpi_stream;
|
||||
uint16_t state;
|
||||
uint32_t buffer_size;
|
||||
uint32_t data_to_play;
|
||||
uint32_t samples_played;
|
||||
uint32_t reserved;
|
||||
int fragment_time;
|
||||
uint8_t *pdata;
|
||||
#if HPI_VER < 0x030a00
|
||||
HPI_FORMAT format;
|
||||
#else
|
||||
struct hpi_format format;
|
||||
#endif
|
||||
#if HPI_VER < 0x00030500
|
||||
HPI_DATA hpi_data;
|
||||
#endif
|
||||
uint32_t fragment_size;
|
||||
bool restart_transport;
|
||||
int samples_pending;
|
||||
unsigned current_position;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDHPIPLAYSTREAM_H
|
||||
703
rdhpi/rdhpirecordstream.cpp
Normal file
703
rdhpi/rdhpirecordstream.cpp
Normal file
@@ -0,0 +1,703 @@
|
||||
// rdhpirecordstream.cpp
|
||||
//
|
||||
// A class for recording Microsoft WAV files.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpirecordstream.cpp,v 1.7 2011/05/19 22:16:54 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 <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <qobject.h>
|
||||
#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
|
||||
#include <rdhpirecordstream.h>
|
||||
|
||||
|
||||
RDHPIRecordStream::RDHPIRecordStream(RDHPISoundCard *card,
|
||||
QWidget *parent,const char *name)
|
||||
:QObject(parent,name),RDWaveFile()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
int quan;
|
||||
uint16_t type[HPI_MAX_ADAPTERS];
|
||||
|
||||
if(getenv(DEBUG_VAR)==NULL) {
|
||||
debug=false;
|
||||
}
|
||||
else {
|
||||
debug=true;
|
||||
printf("RDHPIRecordStream: debugging enabled\n");
|
||||
}
|
||||
if(getenv(XRUN_VAR)==NULL) {
|
||||
xrun=false;
|
||||
}
|
||||
else {
|
||||
xrun=true;
|
||||
printf("RDHPIRecordStream: xrun notification enabled\n");
|
||||
}
|
||||
|
||||
sound_card=card;
|
||||
|
||||
card_number=-1;
|
||||
stream_number=-1;
|
||||
is_ready=false;
|
||||
is_recording=false;
|
||||
is_paused=false;
|
||||
stopping=false;
|
||||
record_started=false;
|
||||
record_length=0;
|
||||
is_open=false;
|
||||
pdata=NULL;
|
||||
|
||||
//
|
||||
// Get Adapter Indices
|
||||
//
|
||||
#if HPI_VER < 0x00030600
|
||||
for(unsigned i=0;i<HPI_MAX_ADAPTERS;i++) {
|
||||
card_index[i]=i;
|
||||
}
|
||||
#else
|
||||
hpi_err=HPI_SubSysGetNumAdapters(NULL,&quan);
|
||||
for(int i=0;i<quan;i++) {
|
||||
hpi_err=HPI_SubSysGetAdapter(NULL,i,card_index+i,type+i);
|
||||
}
|
||||
#endif // HPI_VER
|
||||
|
||||
clock=new QTimer(this,"clock");
|
||||
connect(clock,SIGNAL(timeout()),this,SLOT(tickClock()));
|
||||
|
||||
length_timer=new QTimer(this,"length_timer");
|
||||
connect(length_timer,SIGNAL(timeout()),this,SLOT(pause()));
|
||||
}
|
||||
|
||||
|
||||
RDHPIRecordStream::~RDHPIRecordStream()
|
||||
{
|
||||
if(pdata!=NULL) {
|
||||
delete pdata;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString RDHPIRecordStream::errorString(RDHPIRecordStream::Error err)
|
||||
{
|
||||
QString str;
|
||||
|
||||
switch(err) {
|
||||
case RDHPIRecordStream::Ok:
|
||||
return QString(tr("Ok"));
|
||||
break;
|
||||
|
||||
case RDHPIRecordStream::NoFile:
|
||||
return QString(tr("Unable to create/open file"));
|
||||
break;
|
||||
|
||||
case RDHPIRecordStream::NoStream:
|
||||
return QString(tr("Input stream unavailable"));
|
||||
break;
|
||||
|
||||
case RDHPIRecordStream::AlreadyOpen:
|
||||
return QString(tr("Stream is already open"));
|
||||
break;
|
||||
|
||||
default:
|
||||
str=QString(tr("Unknown Error:"));
|
||||
return QString().sprintf("%s %d\n",(const char *)str,err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RDHPIRecordStream::Error RDHPIRecordStream::createWave()
|
||||
{
|
||||
if(is_open) {
|
||||
return RDHPIRecordStream::AlreadyOpen;
|
||||
}
|
||||
if(!RDWaveFile::createWave()) {
|
||||
return RDHPIRecordStream::NoFile;
|
||||
}
|
||||
if(!GetStream()) {
|
||||
closeWave();
|
||||
return RDHPIRecordStream::NoStream;
|
||||
}
|
||||
is_open=true;
|
||||
return RDHPIRecordStream::Ok;
|
||||
}
|
||||
|
||||
|
||||
RDHPIRecordStream::Error RDHPIRecordStream::createWave(QString filename)
|
||||
{
|
||||
if(is_open) {
|
||||
return RDHPIRecordStream::AlreadyOpen;
|
||||
}
|
||||
setName(filename);
|
||||
return createWave();
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::closeWave()
|
||||
{
|
||||
if(!is_open) {
|
||||
return;
|
||||
}
|
||||
if(getState()!=RDHPIRecordStream::Stopped) {
|
||||
stop();
|
||||
}
|
||||
RDWaveFile::closeWave(samples_recorded);
|
||||
FreeStream();
|
||||
is_open=false;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIRecordStream::formatSupported(RDWaveFile::Format format)
|
||||
{
|
||||
#if HPI_VER < HPI_VERSION_CONSTRUCTOR(3L,10,0)
|
||||
HPI_FORMAT hformat;
|
||||
#else
|
||||
struct hpi_format hformat;
|
||||
#endif
|
||||
hpi_handle_t histream;
|
||||
hpi_err_t hpi_err;
|
||||
bool found=false;
|
||||
|
||||
if(card_number<0) {
|
||||
return false;
|
||||
}
|
||||
if(format==RDWaveFile::Vorbis) {
|
||||
#ifdef HAVE_VORBIS
|
||||
return true;
|
||||
#endif // HAVE_VORBIS
|
||||
return false;
|
||||
}
|
||||
if(!is_open) {
|
||||
for(int i=0;i<sound_card->getCardInputStreams(card_number);i++) {
|
||||
if(HPI_InStreamOpen(NULL,card_index[card_number],i,&histream)==0) {
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
histream=hpi_stream;
|
||||
}
|
||||
switch(format) {
|
||||
case RDWaveFile::Pcm8:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),
|
||||
HPI_FORMAT_PCM8_UNSIGNED,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
case RDWaveFile::Pcm16:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),
|
||||
HPI_FORMAT_PCM16_SIGNED,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
case RDWaveFile::MpegL1:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L1,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
case RDWaveFile::MpegL2:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L2,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
case RDWaveFile::MpegL3:
|
||||
hpi_err=HPI_FormatCreate(&hformat,getChannels(),HPI_FORMAT_MPEG_L3,
|
||||
getSamplesPerSec(),getHeadBitRate(),0);
|
||||
state=HPI_InStreamQueryFormat(NULL,histream,&hformat);
|
||||
break;
|
||||
|
||||
default:
|
||||
state=1;
|
||||
break;
|
||||
}
|
||||
if(!is_open) {
|
||||
hpi_err=HPI_InStreamClose(NULL,histream);
|
||||
}
|
||||
if(state!=0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIRecordStream::formatSupported()
|
||||
{
|
||||
switch(getFormatTag()) {
|
||||
case WAVE_FORMAT_PCM:
|
||||
switch(getBitsPerSample()) {
|
||||
case 8:
|
||||
return formatSupported(RDWaveFile::Pcm8);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
return formatSupported(RDWaveFile::Pcm16);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case WAVE_FORMAT_MPEG:
|
||||
switch(getHeadLayer()) {
|
||||
case 1:
|
||||
return formatSupported(RDWaveFile::MpegL1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return formatSupported(RDWaveFile::MpegL2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
return formatSupported(RDWaveFile::MpegL3);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int RDHPIRecordStream::getCard() const
|
||||
{
|
||||
return card_number;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::setCard(int card)
|
||||
{
|
||||
if(!is_recording) {
|
||||
card_number=card;
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: using card %d\n",card_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int RDHPIRecordStream::getStream() const
|
||||
{
|
||||
return stream_number;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::setStream(int stream)
|
||||
{
|
||||
stream_number=stream;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIRecordStream::haveInputVOX() const
|
||||
{
|
||||
return sound_card->haveInputStreamVOX(card_number,stream_number);
|
||||
}
|
||||
|
||||
|
||||
RDHPIRecordStream::RecordState RDHPIRecordStream::getState()
|
||||
{
|
||||
if(is_recording) {
|
||||
if(record_started) {
|
||||
return RDHPIRecordStream::RecordStarted;
|
||||
}
|
||||
return RDHPIRecordStream::Recording;
|
||||
}
|
||||
if(is_paused) {
|
||||
return RDHPIRecordStream::Paused;
|
||||
}
|
||||
if(is_ready) {
|
||||
return RDHPIRecordStream::RecordReady;
|
||||
}
|
||||
return RDHPIRecordStream::Stopped;
|
||||
}
|
||||
|
||||
|
||||
int RDHPIRecordStream::getPosition() const
|
||||
{
|
||||
if((!is_recording)&&(!is_ready)&&(!is_paused)) {
|
||||
return 0;
|
||||
}
|
||||
return samples_recorded;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDHPIRecordStream::samplesRecorded() const
|
||||
{
|
||||
return samples_recorded;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIRecordStream::recordReady()
|
||||
{
|
||||
hpi_err_t hpi_error=0;
|
||||
char hpi_text[200];
|
||||
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: received recordReady()\n");
|
||||
}
|
||||
if(!is_open) {
|
||||
return false;
|
||||
}
|
||||
if((!is_recording)&&(!is_paused)) {
|
||||
resetWave();
|
||||
if(HPI_InStreamGetInfoEx(NULL,hpi_stream,
|
||||
&state,&buffer_size,&data_recorded,
|
||||
&samples_recorded,&reserved)!=0) {
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: HPI_InStreamGetInfoEx() failed\n");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
fragment_size=buffer_size/4;
|
||||
if(fragment_size>192000) { // ALSA Compatibility Limitation
|
||||
fragment_size=192000;
|
||||
}
|
||||
fragment_time=(1000*fragment_size)/(getAvgBytesPerSec());
|
||||
if(pdata!=NULL) {
|
||||
delete pdata;
|
||||
}
|
||||
pdata=(uint8_t *)malloc(fragment_size);
|
||||
if(pdata==NULL) {
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: couldn't allocate buffer\n");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
switch(getFormatTag()) {
|
||||
case WAVE_FORMAT_PCM:
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: using PCM%d format\n",
|
||||
getBitsPerSample());
|
||||
}
|
||||
switch(getBitsPerSample()) {
|
||||
case 8:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_PCM8_UNSIGNED,getSamplesPerSec(),
|
||||
0,0);
|
||||
break;
|
||||
case 16:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_PCM16_SIGNED,getSamplesPerSec(),
|
||||
0,0);
|
||||
break;
|
||||
case 32:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_PCM32_SIGNED,getSamplesPerSec(),
|
||||
0,0);
|
||||
break;
|
||||
default:
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: unsupported sample size\n");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case WAVE_FORMAT_MPEG:
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: using MPEG-1 Layer %d\n",getHeadLayer());
|
||||
}
|
||||
switch(getHeadLayer()) {
|
||||
case 1:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_MPEG_L1,getSamplesPerSec(),
|
||||
getHeadBitRate(),getHeadFlags());
|
||||
break;
|
||||
case 2:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_MPEG_L2,getSamplesPerSec(),
|
||||
getHeadBitRate(),getHeadFlags());
|
||||
break;
|
||||
case 3:
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_MPEG_L3,getSamplesPerSec(),
|
||||
getHeadBitRate(),getHeadFlags());
|
||||
break;
|
||||
default:
|
||||
hpi_error=HPI_AdapterClose(NULL,card_index[card_number]);
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: invalid MPEG-1 layer\n");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if(getMextChunk()) {
|
||||
setMextHomogenous(true);
|
||||
setMextPaddingUsed(false);
|
||||
setMextHackedBitRate(true);
|
||||
setMextFreeFormat(false);
|
||||
setMextFrameSize(144*getHeadBitRate()/getSamplesPerSec());
|
||||
setMextAncillaryLength(5);
|
||||
setMextLeftEnergyPresent(true);
|
||||
if(getChannels()>1) {
|
||||
setMextRightEnergyPresent(true);
|
||||
}
|
||||
else {
|
||||
setMextRightEnergyPresent(false);
|
||||
}
|
||||
setMextPrivateDataPresent(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case WAVE_FORMAT_VORBIS:
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: using OggVorbis\n");
|
||||
}
|
||||
hpi_error=HPI_FormatCreate(&format,getChannels(),
|
||||
HPI_FORMAT_PCM16_SIGNED,getSamplesPerSec(),
|
||||
0,0);
|
||||
break;
|
||||
|
||||
default:
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: invalid format tag\n");
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
if((hpi_error=HPI_InStreamQueryFormat(NULL,hpi_stream,
|
||||
&format))!=0) {
|
||||
if(debug) {
|
||||
HPI_GetErrorText(hpi_error,hpi_text);
|
||||
printf("Num: %d\n",hpi_error);
|
||||
printf("RDHPIRecordStream: %s\n",hpi_text);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#if HPI_VER < 0x00030500
|
||||
HPI_DataCreate(&hpi_data,&format,pdata,fragment_size);
|
||||
#endif
|
||||
hpi_error=HPI_InStreamSetFormat(NULL,hpi_stream,&format);
|
||||
hpi_error=HPI_InStreamStart(NULL,hpi_stream);
|
||||
// clock->start(2*fragment_time/3);
|
||||
clock->start(100);
|
||||
is_ready=true;
|
||||
is_recording=false;
|
||||
is_paused=false;
|
||||
stopping=false;
|
||||
emit isStopped(false);
|
||||
emit ready();
|
||||
emit stateChanged(card_number,stream_number,1); // RecordReady
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: emitted isStopped(false)\n");
|
||||
printf("RDHPIRecordStream: emitted ready()\n");
|
||||
printf("RDHPIRecordStream: emitted stateChanged(%d,%d,RDHPIRecordStream::RecordReady)\n",card_number,stream_number);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::record()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: received record()\n");
|
||||
}
|
||||
if(!is_open) {
|
||||
return;
|
||||
}
|
||||
if(!is_ready) {
|
||||
recordReady();
|
||||
}
|
||||
record_started=false;
|
||||
hpi_err=HPI_InStreamReset(NULL,hpi_stream);
|
||||
hpi_err=HPI_InStreamStart(NULL,hpi_stream);
|
||||
is_recording=true;
|
||||
is_paused=false;
|
||||
emit isStopped(false);
|
||||
emit recording();
|
||||
emit stateChanged(card_number,stream_number,0); // Recording
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: emitted isStopped(false)\n");
|
||||
printf("RDHPIRecordStream: emitted recording()\n");
|
||||
printf("RDHPIRecordStream: emitted stateChanged(%d,%d,RDHPIRecordStream::Recording)\n",card_number,stream_number);
|
||||
}
|
||||
tickClock();
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::pause()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: received pause()\n");
|
||||
}
|
||||
if(!is_recording) {
|
||||
return;
|
||||
}
|
||||
hpi_err=HPI_InStreamStop(NULL,hpi_stream);
|
||||
tickClock();
|
||||
hpi_err=HPI_InStreamGetInfoEx(NULL,hpi_stream,&state,&buffer_size,
|
||||
&data_recorded,&samples_recorded,&reserved);
|
||||
is_recording=false;
|
||||
is_paused=true;
|
||||
hpi_err=HPI_InStreamStart(NULL,hpi_stream);
|
||||
emit paused();
|
||||
emit stateChanged(card_number,stream_number,2); // Paused
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: emitted paused()\n");
|
||||
printf("RDHPIRecordStream: emitted stateChanged(%d,%d,RDHPIRecordStream::Paused)\n",card_number,stream_number);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::stop()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: received stop()\n");
|
||||
}
|
||||
if(is_ready|is_recording|is_paused) {
|
||||
hpi_err=HPI_InStreamStop(NULL,hpi_stream);
|
||||
tickClock();
|
||||
clock->stop();
|
||||
is_recording=false;
|
||||
is_paused=false;
|
||||
is_ready=false;
|
||||
if(pdata!=NULL) {
|
||||
delete pdata;
|
||||
pdata=NULL;
|
||||
}
|
||||
emit isStopped(true);
|
||||
emit stopped();
|
||||
emit stateChanged(card_number,stream_number,RDHPIRecordStream::Stopped);
|
||||
emit position(0);
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: emitted isStopped(true)\n");
|
||||
printf("RDHPIRecordStream: emitted stopped()\n");
|
||||
printf("RDHPIRecordStream: emitted stateChanged(%d,%d,RDHPIRecordStream::Stopped)\n",card_number,stream_number);
|
||||
printf("RDHPIRecordStream: emitted position(0)\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::setInputVOX(int gain)
|
||||
{
|
||||
sound_card->setInputStreamVOX(card_number,stream_number,gain);
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::setRecordLength(int length)
|
||||
{
|
||||
record_length=length;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::tickClock()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_InStreamGetInfoEx(NULL,hpi_stream,
|
||||
&state,&buffer_size,&data_recorded,
|
||||
&samples_recorded,&reserved);
|
||||
if((!record_started)&&(is_recording)) {
|
||||
if(samples_recorded>0) {
|
||||
if(record_length>0) {
|
||||
length_timer->start(record_length,true);
|
||||
}
|
||||
emit recordStart();
|
||||
emit stateChanged(card_number,stream_number,4); // RecordStarted
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: emitted recordStart()\n");
|
||||
printf("RDHPIRecordStream: emitted stateChanged(%d,%d,RDHPIRecordStream::RecordStarted)\n",card_number,stream_number);
|
||||
}
|
||||
record_started=true;
|
||||
}
|
||||
}
|
||||
while(data_recorded>fragment_size) {
|
||||
#if HPI_VER > 0x00030500
|
||||
hpi_err=HPI_InStreamReadBuf(NULL,hpi_stream,pdata,fragment_size);
|
||||
#else
|
||||
hpi_err=HPI_InStreamRead(NULL,hpi_stream,&hpi_data);
|
||||
#endif
|
||||
if(is_recording) {
|
||||
writeWave(pdata,fragment_size);
|
||||
}
|
||||
hpi_err=HPI_InStreamGetInfoEx(NULL,hpi_stream,
|
||||
&state,&buffer_size,&data_recorded,
|
||||
&samples_recorded,&reserved);
|
||||
}
|
||||
if(state==HPI_STATE_STOPPED) {
|
||||
#if HPI_VER > 0x00030500
|
||||
hpi_err=HPI_InStreamReadBuf(NULL,hpi_stream,pdata,data_recorded);
|
||||
#else
|
||||
hpi_err=HPI_DataCreate(&hpi_data,&format,pdata,data_recorded);
|
||||
hpi_err=HPI_InStreamRead(NULL,hpi_stream,&hpi_data);
|
||||
#endif
|
||||
if(is_recording) {
|
||||
writeWave(pdata,data_recorded);
|
||||
}
|
||||
}
|
||||
emit position(samples_recorded);
|
||||
if(debug) {
|
||||
printf("RDHPIRecordStream: emitted position(%u)\n",
|
||||
(unsigned)samples_recorded);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RDHPIRecordStream::GetStream()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
char hpi_text[100];
|
||||
|
||||
if((hpi_err=
|
||||
HPI_InStreamOpen(NULL,card_index[card_number],stream_number,&hpi_stream))!=0) {
|
||||
if(debug) {
|
||||
HPI_GetErrorText(hpi_err,hpi_text);
|
||||
fprintf(stderr,"*** HPI Error: %s ***\n",hpi_text);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RDHPIRecordStream::FreeStream()
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_InStreamClose(NULL,hpi_stream);
|
||||
}
|
||||
|
||||
137
rdhpi/rdhpirecordstream.h
Normal file
137
rdhpi/rdhpirecordstream.h
Normal file
@@ -0,0 +1,137 @@
|
||||
// rdhpirecordstream.h
|
||||
//
|
||||
// A class for recording Microsoft WAV files.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpirecordstream.h,v 1.6.6.1 2012/05/04 14:56:22 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 RDHPIRECORDSTREAM_H
|
||||
#define RDHPIRECORDSTREAM_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <qobject.h>
|
||||
#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <rdwavefile.h>
|
||||
#include <rdhpisoundcard.h>
|
||||
|
||||
#define DEBUG_VAR "_RDHPIRECORDSTREAM"
|
||||
#define XRUN_VAR "_RSOUND_XRUN"
|
||||
|
||||
#include <asihpi/hpi.h>
|
||||
#ifndef HPI_VER
|
||||
#include <asihpi/hpi_version.h>
|
||||
#endif
|
||||
#define AUDIO_SIZE 32768
|
||||
#define RDHPIRECORDSTREAM_CLOCK_INTERVAL 100
|
||||
|
||||
|
||||
class RDHPIRecordStream : public QObject,public RDWaveFile
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum RecordState {Recording=0,RecordReady=1,Paused=2,Stopped=3,
|
||||
RecordStarted=4};
|
||||
enum Error {Ok=0,NoFile=1,NoStream=2,AlreadyOpen=3};
|
||||
RDHPIRecordStream(RDHPISoundCard *card,QWidget *parent=0,const char *name=0);
|
||||
~RDHPIRecordStream();
|
||||
QString errorString(RDHPIRecordStream::Error err);
|
||||
RDHPIRecordStream::Error createWave();
|
||||
void closeWave();
|
||||
RDHPIRecordStream::Error createWave(QString filename);
|
||||
bool formatSupported(RDWaveFile::Format format);
|
||||
bool formatSupported();
|
||||
int getCard() const;
|
||||
int getStream() const;
|
||||
bool haveInputVOX() const;
|
||||
RDHPIRecordStream::RecordState getState();
|
||||
int getPosition() const;
|
||||
unsigned samplesRecorded() const;
|
||||
|
||||
signals:
|
||||
void isStopped(bool state);
|
||||
void ready();
|
||||
void recording();
|
||||
void recordStart();
|
||||
void paused();
|
||||
void stopped();
|
||||
void position(int samples);
|
||||
void stateChanged(int card,int stream,int state);
|
||||
|
||||
public slots:
|
||||
void setCard(int card);
|
||||
void setStream(int stream);
|
||||
bool recordReady();
|
||||
void record();
|
||||
void pause();
|
||||
void stop();
|
||||
void setInputVOX(int gain);
|
||||
void setRecordLength(int length);
|
||||
|
||||
private slots:
|
||||
void tickClock();
|
||||
|
||||
private:
|
||||
bool GetStream();
|
||||
void FreeStream();
|
||||
RDHPISoundCard *sound_card;
|
||||
bool debug;
|
||||
bool xrun;
|
||||
QTimer *clock;
|
||||
uint32_t card_index[HPI_MAX_ADAPTERS];
|
||||
int card_number;
|
||||
int stream_number;
|
||||
bool is_recording;
|
||||
bool is_ready;
|
||||
bool is_paused;
|
||||
bool stopping;
|
||||
bool record_started;
|
||||
QTimer *length_timer;
|
||||
int record_length;
|
||||
unsigned audio_ptr;
|
||||
unsigned char abuf[AUDIO_SIZE];
|
||||
unsigned left_to_write;
|
||||
hpi_handle_t hpi_stream;
|
||||
uint16_t state;
|
||||
uint32_t buffer_size;
|
||||
uint32_t data_recorded;
|
||||
uint32_t samples_recorded;
|
||||
uint32_t reserved;
|
||||
uint32_t fragment_size;
|
||||
int fragment_time;
|
||||
uint8_t *pdata;
|
||||
#if HPI_VER < 0x030a00
|
||||
HPI_FORMAT format;
|
||||
#else
|
||||
struct hpi_format format;
|
||||
#endif
|
||||
#if HPI_VER < 0x00030500
|
||||
HPI_DATA hpi_data;
|
||||
#endif
|
||||
bool is_open;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDHPIRECORDSTREAM_H
|
||||
996
rdhpi/rdhpisoundcard.cpp
Normal file
996
rdhpi/rdhpisoundcard.cpp
Normal file
@@ -0,0 +1,996 @@
|
||||
// rdhpisoundcard.cpp
|
||||
//
|
||||
// The audio card subsystem for the HPI Library.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpisoundcard.cpp,v 1.10.6.3 2012/08/07 15:48:04 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 <qtimer.h>
|
||||
#include <rdhpisoundcard.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
RDHPISoundCard::RDHPISoundCard(QObject *parent,const char *name)
|
||||
: QObject(parent,name)
|
||||
{
|
||||
card_quantity=0;
|
||||
fade_type=RDHPISoundCard::Log;
|
||||
for(int i=0;i<HPI_MAX_ADAPTERS;i++) {
|
||||
card_index[i]=0;
|
||||
card_input_streams[i]=0;
|
||||
card_output_streams[i]=0;
|
||||
card_input_ports[i]=0;
|
||||
card_output_ports[i]=0;
|
||||
input_mux_type[i]=false;
|
||||
timescale_support[i]=false;
|
||||
for(int j=0;j<HPI_MAX_NODES;j++) {
|
||||
input_port_level[i][j]=false;
|
||||
output_port_level[i][j]=false;
|
||||
input_port_meter[i][j]=false;
|
||||
output_port_meter[i][j]=false;
|
||||
input_port_mux[i][j]=false;
|
||||
input_port_mux_type[i][j][0]=false;
|
||||
input_port_mux_type[i][j][1]=false;
|
||||
input_mux_index[i][j][0]=0;
|
||||
input_mux_index[i][j][1]=0;
|
||||
input_port_aesebu[i][j]=false;
|
||||
input_port_aesebu_error[i][j]=false;
|
||||
for(int k=0;k<HPI_MAX_STREAMS;k++) {
|
||||
input_stream_volume[i][k][j]=false;
|
||||
output_stream_volume[i][k][j]=false;
|
||||
}
|
||||
for(int k=0;k<HPI_MAX_NODES;k++) {
|
||||
passthrough_port_volume[i][j][k]=false;
|
||||
}
|
||||
}
|
||||
for(int j=0;j<HPI_MAX_STREAMS;j++) {
|
||||
input_stream_meter[i][j]=false;
|
||||
output_stream_meter[i][j]=false;
|
||||
input_port_mode[i][j]=false;
|
||||
output_stream_mode[i][j]=false;
|
||||
input_stream_vox[i][j]=false;
|
||||
input_stream_mux[i][j]=false;
|
||||
}
|
||||
}
|
||||
if(HPI_SubSysCreate()==NULL) {
|
||||
return;
|
||||
}
|
||||
HPIProbe();
|
||||
}
|
||||
|
||||
|
||||
RDHPISoundCard::~RDHPISoundCard()
|
||||
{
|
||||
HPI_SubSysFree(NULL);
|
||||
}
|
||||
|
||||
|
||||
RDHPISoundCard::Driver RDHPISoundCard::driver() const
|
||||
{
|
||||
return RDHPISoundCard::Hpi;
|
||||
}
|
||||
|
||||
|
||||
RDHPIInformation *RDHPISoundCard::hpiInformation(int card)
|
||||
{
|
||||
return &(hpi_info[card]);
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::getCardQuantity() const
|
||||
{
|
||||
return card_quantity;
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::getCardInputStreams(int card) const
|
||||
{
|
||||
return card_input_streams[card];
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::getCardOutputStreams(int card) const
|
||||
{
|
||||
return card_output_streams[card];
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::getCardInputPorts(int card) const
|
||||
{
|
||||
return card_input_ports[card];
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::getCardOutputPorts(int card) const
|
||||
{
|
||||
return card_output_ports[card];
|
||||
}
|
||||
|
||||
|
||||
const void *RDHPISoundCard::getCardInfo(int card) const
|
||||
{
|
||||
return &hpi_info[card];
|
||||
}
|
||||
|
||||
|
||||
QString RDHPISoundCard::getCardDescription(int card) const
|
||||
{
|
||||
return card_description[card];
|
||||
}
|
||||
|
||||
|
||||
QString RDHPISoundCard::getInputStreamDescription(int card,int stream) const
|
||||
{
|
||||
return input_stream_description[card][stream];
|
||||
}
|
||||
|
||||
|
||||
QString RDHPISoundCard::getOutputStreamDescription(int card,int stream) const
|
||||
{
|
||||
return output_stream_description[card][stream];
|
||||
}
|
||||
|
||||
|
||||
QString RDHPISoundCard::getInputPortDescription(int card,int port) const
|
||||
{
|
||||
return input_port_description[card][port];
|
||||
}
|
||||
|
||||
|
||||
QString RDHPISoundCard::getOutputPortDescription(int card,int port) const
|
||||
{
|
||||
return output_port_description[card][port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::setClockSource(int card,RDHPISoundCard::ClockSource src)
|
||||
{
|
||||
hpi_err_t hpi_err=0;
|
||||
|
||||
switch(src) {
|
||||
case RDHPISoundCard::Internal:
|
||||
hpi_err=HPI_SampleClock_SetSource(NULL,
|
||||
clock_source_control[card],
|
||||
HPI_SAMPLECLOCK_SOURCE_LOCAL);
|
||||
break;
|
||||
case RDHPISoundCard::AesEbu:
|
||||
case RDHPISoundCard::SpDiff:
|
||||
hpi_err=HPI_SampleClock_SetSource(NULL,
|
||||
clock_source_control[card],
|
||||
HPI_SAMPLECLOCK_SOURCE_AESEBU_SYNC);
|
||||
break;
|
||||
case RDHPISoundCard::WordClock:
|
||||
hpi_err=HPI_SampleClock_SetSource(NULL,
|
||||
clock_source_control[card],
|
||||
HPI_SAMPLECLOCK_SOURCE_WORD);
|
||||
break;
|
||||
}
|
||||
return hpi_err==0;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveTimescaling(int card) const
|
||||
{
|
||||
return timescale_support[card];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveInputVolume(int card,int stream,int port) const
|
||||
{
|
||||
return input_stream_volume[card][stream][port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveOutputVolume(int card,int stream,int port) const
|
||||
{
|
||||
return output_stream_volume[card][stream][port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveInputLevel(int card,int port) const
|
||||
{
|
||||
return input_port_level[card][port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveOutputLevel(int card,int port) const
|
||||
{
|
||||
return output_port_level[card][port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveInputStreamVOX(int card,int stream) const
|
||||
{
|
||||
return input_stream_vox[card][stream];
|
||||
}
|
||||
|
||||
|
||||
RDHPISoundCard::SourceNode RDHPISoundCard::getInputPortMux(int card,int port)
|
||||
{
|
||||
uint16_t type;
|
||||
uint16_t index;
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_Multiplexer_GetSource(NULL,input_mux_control[card][port],
|
||||
&type,&index);
|
||||
return (RDHPISoundCard::SourceNode)type;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::setInputPortMux(int card,int port,RDHPISoundCard::SourceNode node)
|
||||
{
|
||||
hpi_err_t hpi_error;
|
||||
|
||||
switch(node) {
|
||||
case RDHPISoundCard::LineIn:
|
||||
if(HPI_Multiplexer_SetSource(NULL,
|
||||
input_mux_control[card][port],
|
||||
node,0)!=0) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case RDHPISoundCard::AesEbuIn:
|
||||
if((hpi_error=
|
||||
HPI_Multiplexer_SetSource(NULL,
|
||||
input_mux_control[card][port],node,
|
||||
input_mux_index[card][port][1]))!=0) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
unsigned short RDHPISoundCard::getInputPortError(int card,int port)
|
||||
{
|
||||
uint16_t error_word=0;
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(input_port_aesebu[card][port]) {
|
||||
hpi_err=HPI_AESEBU_Receiver_GetErrorStatus(NULL,
|
||||
input_port_aesebu_control[card][port],
|
||||
&error_word);
|
||||
}
|
||||
return error_word;
|
||||
}
|
||||
|
||||
|
||||
RDHPISoundCard::FadeProfile RDHPISoundCard::getFadeProfile() const
|
||||
{
|
||||
return fade_type;
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setFadeProfile(RDHPISoundCard::FadeProfile profile)
|
||||
{
|
||||
fade_type=profile;
|
||||
switch(fade_type) {
|
||||
case RDHPISoundCard::Linear:
|
||||
hpi_fade_type=HPI_VOLUME_AUTOFADE_LINEAR;
|
||||
break;
|
||||
case RDHPISoundCard::Log:
|
||||
hpi_fade_type=HPI_VOLUME_AUTOFADE_LOG;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveInputStreamMeter(int card,int stream) const
|
||||
{
|
||||
return input_stream_meter[card][stream];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveInputPortMeter(int card,int port) const
|
||||
{
|
||||
return input_stream_meter[card][port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveOutputStreamMeter(int card,int stream) const
|
||||
{
|
||||
return output_stream_meter[card][stream];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveOutputPortMeter(int card,int port) const
|
||||
{
|
||||
return output_port_meter[card][port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveTuner(int card,int port) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setTunerBand(int card,int port,
|
||||
RDHPISoundCard::TunerBand band)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::tunerFrequency(int card,int port)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setTunerFrequency(int card,int port,int freq)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::tunerSubcarrier(int card,int port,
|
||||
RDHPISoundCard::Subcarrier sub)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::tunerLowFrequency(int card,int port,
|
||||
RDHPISoundCard::TunerBand band)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::tunerHighFrequency(int card,int port,
|
||||
RDHPISoundCard::TunerBand band)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::inputStreamMeter(int card,int stream,short *level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(card>=card_quantity) {
|
||||
return false;
|
||||
}
|
||||
if(stream>=card_input_streams[card]) {
|
||||
return false;
|
||||
}
|
||||
hpi_err=HPI_MeterGetPeak(NULL,
|
||||
input_stream_meter_control[card][stream],level);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::outputStreamMeter(int card,int stream,short *level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(card>=card_quantity) {
|
||||
return false;
|
||||
}
|
||||
if(stream>=card_output_streams[card]) {
|
||||
return false;
|
||||
}
|
||||
hpi_err=HPI_MeterGetPeak(NULL,
|
||||
output_stream_meter_control[card][stream],level);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::inputPortMeter(int card,int port,short *level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(card>=card_quantity) {
|
||||
return false;
|
||||
}
|
||||
if(port>=card_input_ports[card]) {
|
||||
return false;
|
||||
}
|
||||
hpi_err=HPI_MeterGetPeak(NULL,
|
||||
input_port_meter_control[card][port],level);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::outputPortMeter(int card,int port,short *level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(card>=card_quantity) {
|
||||
return false;
|
||||
}
|
||||
if(port>=card_output_ports[card]) {
|
||||
return false;
|
||||
}
|
||||
hpi_err=HPI_MeterGetPeak(NULL,
|
||||
output_port_meter_control[card][port],level);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveInputMode(int card,int port) const
|
||||
{
|
||||
return input_port_mode[card][port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveOutputMode(int card,int stream) const
|
||||
{
|
||||
return output_stream_mode[card][stream];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveInputPortMux(int card,int port) const
|
||||
{
|
||||
return input_port_mux[card][port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::queryInputPortMux(int card,int port,SourceNode node) const
|
||||
{
|
||||
switch(node) {
|
||||
case RDHPISoundCard::LineIn:
|
||||
return input_port_mux_type[card][port][0];
|
||||
break;
|
||||
case RDHPISoundCard::AesEbuIn:
|
||||
return input_port_mux_type[card][port][1];
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::haveInputStreamMux(int card,int stream) const
|
||||
{
|
||||
return input_stream_mux[card][stream];
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::getInputVolume(int card,int stream,int port)
|
||||
{
|
||||
short gain[2];
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VolumeGetGain(NULL,
|
||||
input_stream_volume_control[card][stream][port],gain);
|
||||
return gain[0];
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::getOutputVolume(int card,int stream,int port)
|
||||
{
|
||||
short gain[2];
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VolumeGetGain(NULL,
|
||||
output_stream_volume_control[card][stream][port],gain);
|
||||
return gain[0];
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::getInputLevel(int card,int port)
|
||||
{
|
||||
short gain[2];
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VolumeGetGain(NULL,
|
||||
input_port_level_control[card][port],gain);
|
||||
return gain[0];
|
||||
}
|
||||
|
||||
|
||||
int RDHPISoundCard::getOutputLevel(int card,int port)
|
||||
{
|
||||
short gain[2];
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VolumeGetGain(NULL,
|
||||
output_port_level_control[card][port],gain);
|
||||
return gain[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RDHPISoundCard::setInputVolume(int card,int stream,int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(!haveInputVolume(card,stream,0)) {
|
||||
return;
|
||||
}
|
||||
short gain[2];
|
||||
gain[0]=level;
|
||||
gain[1]=level;
|
||||
hpi_err=HPI_VolumeSetGain(NULL,
|
||||
input_stream_volume_control[card][stream][0],gain);
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setOutputVolume(int card,int stream,int port,int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(!haveOutputVolume(card,stream,port)) {
|
||||
return;
|
||||
}
|
||||
short gain[2];
|
||||
gain[0]=level;
|
||||
gain[1]=level;
|
||||
hpi_err=HPI_VolumeSetGain(NULL,
|
||||
output_stream_volume_control[card][stream][port],gain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RDHPISoundCard::fadeOutputVolume(int card,int stream,int port,
|
||||
int level,int length)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(!haveOutputVolume(card,stream,port)) {
|
||||
return;
|
||||
}
|
||||
short gain[2];
|
||||
|
||||
gain[0]=level;
|
||||
gain[1]=level;
|
||||
hpi_err=HPI_VolumeAutoFadeProfile(NULL,
|
||||
output_stream_volume_control[card][stream][port],
|
||||
gain,length,hpi_fade_type);
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setInputLevel(int card,int port,int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
short gain[HPI_MAX_CHANNELS];
|
||||
|
||||
if(!haveInputLevel(card,port)) {
|
||||
return;
|
||||
}
|
||||
for(unsigned i=0;i<HPI_MAX_CHANNELS;i++) {
|
||||
gain[i]=level;
|
||||
}
|
||||
hpi_err=HPI_LevelSetGain(NULL,input_port_level_control[card][port],gain);
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setOutputLevel(int card,int port,int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
short gain[HPI_MAX_CHANNELS];
|
||||
|
||||
if(!haveOutputLevel(card,port)) {
|
||||
return;
|
||||
}
|
||||
for(unsigned i=0;i<HPI_MAX_CHANNELS;i++) {
|
||||
gain[i]=level;
|
||||
}
|
||||
hpi_err=HPI_LevelSetGain(NULL,output_port_level_control[card][port],gain);
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setInputMode(int card,int port,
|
||||
RDHPISoundCard::ChannelMode mode)
|
||||
{
|
||||
uint16_t hpi_err;
|
||||
|
||||
if(!haveInputMode(card,port)) {
|
||||
return;
|
||||
}
|
||||
hpi_err=HPI_ChannelModeSet(NULL,input_port_mode_control[card][port],mode+1);
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setOutputMode(int card,int stream,
|
||||
RDHPISoundCard::ChannelMode mode)
|
||||
{
|
||||
uint16_t hpi_err;
|
||||
|
||||
if(!haveOutputMode(card,stream)) {
|
||||
return;
|
||||
}
|
||||
hpi_err=
|
||||
HPI_ChannelModeSet(NULL,output_stream_mode_control[card][stream],mode+1);
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::setInputStreamVOX(int card,int stream,short gain)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
hpi_err=HPI_VoxSetThreshold(NULL,
|
||||
input_stream_vox_control[card][stream],gain);
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::havePassthroughVolume(int card,int in_port,int out_port)
|
||||
{
|
||||
return passthrough_port_volume[card][in_port][out_port];
|
||||
}
|
||||
|
||||
|
||||
bool RDHPISoundCard::setPassthroughVolume(int card,int in_port,int out_port,
|
||||
int level)
|
||||
{
|
||||
hpi_err_t hpi_err;
|
||||
|
||||
if(!passthrough_port_volume[card][in_port][out_port]) {
|
||||
return false;
|
||||
}
|
||||
short gain[2];
|
||||
gain[0]=level;
|
||||
gain[1]=level;
|
||||
hpi_err=HPI_VolumeSetGain(NULL,
|
||||
passthrough_port_volume_control[card][in_port][out_port],
|
||||
gain);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::clock()
|
||||
{
|
||||
uint16_t error_word;
|
||||
|
||||
for(int i=0;i<card_quantity;i++) {
|
||||
for(int j=0;j<HPI_MAX_NODES;j++) {
|
||||
if(input_port_aesebu[i][j]) {
|
||||
error_word=getInputPortError(i,j);
|
||||
if(error_word!=input_port_aesebu_error[i][j]) {
|
||||
input_port_aesebu_error[i][j]=error_word;
|
||||
emit inputPortError(i,j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundCard::HPIProbe()
|
||||
{
|
||||
uint16_t hpi_adapter_list[HPI_MAX_ADAPTERS];
|
||||
uint32_t dummy_serial;
|
||||
uint32_t dummy_hpi;
|
||||
uint16_t dummy_version;
|
||||
uint16_t dummy_type;
|
||||
uint16_t l;
|
||||
uint16_t type;
|
||||
uint16_t index;
|
||||
hpi_err_t hpi_err;
|
||||
QString str;
|
||||
|
||||
hpi_fade_type=HPI_VOLUME_AUTOFADE_LOG;
|
||||
#if HPI_VER < 0x00030600
|
||||
hpi_err=HPI_SubSysGetVersion(NULL,&dummy_hpi);
|
||||
HPI_SubSysFindAdapters(NULL,(uint16_t *)&card_quantity,
|
||||
hpi_adapter_list,HPI_MAX_ADAPTERS);
|
||||
#else
|
||||
hpi_err=HPI_SubSysGetVersionEx(NULL,&dummy_hpi);
|
||||
hpi_err=HPI_SubSysGetNumAdapters(NULL,&card_quantity);
|
||||
#endif // HPI_VER
|
||||
for(int i=0;i<card_quantity;i++) {
|
||||
#if HPI_VER < 0x00030600
|
||||
card_index[i]=i;
|
||||
#else
|
||||
hpi_err=HPI_SubSysGetAdapter(NULL,i,card_index+i,hpi_adapter_list+i);
|
||||
#endif // HPI_VER
|
||||
if((hpi_adapter_list[i]&0xF000)==0x6000) {
|
||||
timescale_support[i]=true;
|
||||
}
|
||||
else {
|
||||
timescale_support[i]=false;
|
||||
}
|
||||
switch(hpi_adapter_list[i]) {
|
||||
case 0x5111:
|
||||
input_mux_type[i]=true;
|
||||
break;
|
||||
|
||||
default:
|
||||
input_mux_type[i]=false;
|
||||
break;
|
||||
}
|
||||
card_input_ports[i]=0;
|
||||
card_output_ports[i]=0;
|
||||
card_description[i]=QString().sprintf("AudioScience %04X [%d]",
|
||||
hpi_adapter_list[i],i+1);
|
||||
hpi_err=HPI_AdapterOpen(NULL,card_index[i]);
|
||||
hpi_err=HPI_AdapterGetInfo(NULL,card_index[i],
|
||||
&card_output_streams[i],
|
||||
&card_input_streams[i],
|
||||
&dummy_version,(uint32_t *)&dummy_serial,
|
||||
&dummy_type);
|
||||
hpi_info[i].setSerialNumber(dummy_serial);
|
||||
hpi_info[i].setHpiVersion(dummy_hpi);
|
||||
/*
|
||||
hpi_info[i].setHpiMajorVersion(dummy_hpi>>8);
|
||||
hpi_info[i].setHpiMinorVersion(dummy_hpi&255);
|
||||
*/
|
||||
hpi_info[i].setDspMajorVersion((dummy_version>>13)&7);
|
||||
hpi_info[i].setDspMinorVersion((dummy_version>>7)&63);
|
||||
hpi_info[i].setPcbVersion((char)(((dummy_version>>3)&7)+'A'));
|
||||
hpi_info[i].setAssemblyVersion(dummy_version&7);
|
||||
hpi_err=HPI_AdapterClose(NULL,card_index[i]);
|
||||
str=QString(tr("Input Stream"));
|
||||
for(int j=0;j<card_input_streams[i];j++) {
|
||||
input_stream_description[i][j]=
|
||||
QString().sprintf("%s - %s %d",(const char *)card_description[i],
|
||||
(const char *)str,j+1);
|
||||
}
|
||||
str=QString(tr("Output Stream"));
|
||||
for(int j=0;j<card_output_streams[i];j++) {
|
||||
output_stream_description[i][j]=
|
||||
QString().sprintf("%s - %s %d",(const char *)card_description[i],
|
||||
(const char *)str,j+1);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Mixer Initialization
|
||||
//
|
||||
for(int i=0;i<card_quantity;i++) {
|
||||
hpi_err=HPI_MixerOpen(NULL,card_index[i],&hpi_mixer[i]);
|
||||
|
||||
//
|
||||
// Get Input Ports
|
||||
//
|
||||
str=QString(tr("Input Port"));
|
||||
for(int k=0;k<HPI_MAX_NODES;k++) {
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
0,0,
|
||||
HPI_DESTNODE_ISTREAM,k,
|
||||
HPI_CONTROL_MULTIPLEXER,
|
||||
&input_stream_volume_control[i][0][k])==0) {
|
||||
card_input_ports[i]++;
|
||||
input_port_description[i][k]=
|
||||
QString().sprintf("%s - %s %d",(const char *)card_description[i],
|
||||
(const char *)str,
|
||||
card_input_ports[i]);
|
||||
}
|
||||
|
||||
//
|
||||
// Get Input Mode Controls
|
||||
//
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i],0,0,
|
||||
HPI_DESTNODE_ISTREAM,k,
|
||||
HPI_CONTROL_CHANNEL_MODE,
|
||||
&input_port_mode_control[i][k])==0) {
|
||||
input_port_mode[i][k]=true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get Output Ports
|
||||
//
|
||||
str=QString(tr("Output Port"));
|
||||
for(int k=0;k<HPI_MAX_NODES;k++) {
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
HPI_SOURCENODE_OSTREAM,0,
|
||||
HPI_DESTNODE_LINEOUT,k,
|
||||
HPI_CONTROL_VOLUME,
|
||||
&output_stream_volume_control[i][0][k])==0) {
|
||||
output_stream_volume[i][0][k]=true;
|
||||
card_output_ports[i]++;
|
||||
output_port_description[i][k]=
|
||||
QString().sprintf("%s - %s %d",(const char *)card_description[i],
|
||||
(const char *)str,
|
||||
card_output_ports[i]);
|
||||
}
|
||||
}
|
||||
hpi_err=HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
HPI_SOURCENODE_CLOCK_SOURCE,0,
|
||||
0,0,
|
||||
HPI_CONTROL_SAMPLECLOCK,
|
||||
&clock_source_control[i]);
|
||||
for(int j=0;j<card_input_streams[i];j++) {
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // VOX Controls
|
||||
0,0,
|
||||
HPI_DESTNODE_ISTREAM,j,
|
||||
HPI_CONTROL_VOX,
|
||||
&input_stream_vox_control[i][j])==0) {
|
||||
input_stream_vox[i][j]=true;
|
||||
}
|
||||
else {
|
||||
input_stream_vox[i][j]=false;
|
||||
}
|
||||
|
||||
|
||||
if(input_mux_type[i]) {
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // MUX Controls
|
||||
0,0,
|
||||
HPI_DESTNODE_ISTREAM,j,
|
||||
HPI_CONTROL_MULTIPLEXER,
|
||||
&input_mux_control[i][j])==0) {
|
||||
input_stream_mux[i][j]=true;
|
||||
l=0;
|
||||
input_port_mux_type[i][j][0]=false;
|
||||
input_port_mux_type[i][j][1]=false;
|
||||
while(HPI_Multiplexer_QuerySource(NULL,
|
||||
input_mux_control[i][j],
|
||||
l++,&type,&index)==0) {
|
||||
switch(type) {
|
||||
case HPI_SOURCENODE_LINEIN:
|
||||
input_port_mux_type[i][j][0]=true;
|
||||
input_mux_index[i][j][0]=index;
|
||||
break;
|
||||
case HPI_SOURCENODE_AESEBU_IN:
|
||||
input_port_mux_type[i][j][1]=true;
|
||||
input_mux_index[i][j][1]=index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
input_stream_mux[i][j]=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int j=0;j<card_output_streams[i];j++) {
|
||||
for(int k=0;k<HPI_MAX_NODES;k++) {
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
HPI_SOURCENODE_LINEIN,j,
|
||||
HPI_DESTNODE_ISTREAM,k,
|
||||
HPI_CONTROL_VOLUME,
|
||||
&input_stream_volume_control[i][j][k])==0) {
|
||||
input_stream_volume[i][j][k]=true;
|
||||
}
|
||||
else {
|
||||
input_stream_volume[i][j][k]=false;
|
||||
}
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
HPI_SOURCENODE_OSTREAM,j,
|
||||
HPI_DESTNODE_LINEOUT,k,
|
||||
HPI_CONTROL_VOLUME,
|
||||
&output_stream_volume_control[i][j][k])==0) {
|
||||
output_stream_volume[i][j][k]=true;
|
||||
}
|
||||
else {
|
||||
output_stream_volume[i][j][k]=false;
|
||||
}
|
||||
}
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
0,0,
|
||||
HPI_DESTNODE_ISTREAM,j,
|
||||
HPI_CONTROL_METER,
|
||||
&input_stream_meter_control[i][j])==0) {
|
||||
input_stream_meter[i][j]=true;
|
||||
}
|
||||
else {
|
||||
input_stream_meter[i][j]=false;
|
||||
}
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
HPI_SOURCENODE_OSTREAM,j,
|
||||
0,0,
|
||||
HPI_CONTROL_METER,
|
||||
&output_stream_meter_control[i][j])==0) {
|
||||
output_stream_meter[i][j]=true;
|
||||
}
|
||||
else {
|
||||
output_stream_meter[i][j]=false;
|
||||
}
|
||||
}
|
||||
for(int j=0;j<HPI_MAX_NODES;j++) {
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // Input Level Controls
|
||||
HPI_SOURCENODE_LINEIN,j,
|
||||
0,0,
|
||||
HPI_CONTROL_LEVEL,
|
||||
&input_port_level_control[i][j])==0) {
|
||||
input_port_level[i][j]=true;
|
||||
}
|
||||
else {
|
||||
input_port_level[i][j]=false;
|
||||
}
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // Output Level Controls
|
||||
0,0,
|
||||
HPI_DESTNODE_LINEOUT,j,
|
||||
HPI_CONTROL_LEVEL,
|
||||
&output_port_level_control[i][j])==0) {
|
||||
output_port_level[i][j]=true;
|
||||
}
|
||||
else {
|
||||
output_port_level[i][j]=false;
|
||||
}
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // Input Port Meter
|
||||
HPI_SOURCENODE_LINEIN,j,
|
||||
0,0,
|
||||
HPI_CONTROL_METER,
|
||||
&input_port_meter_control[i][j])==0) {
|
||||
input_port_meter[i][j]=true;
|
||||
}
|
||||
else {
|
||||
input_port_meter[i][j]=false;
|
||||
}
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // Output Port Meter
|
||||
0,0,
|
||||
HPI_DESTNODE_LINEOUT,j,
|
||||
HPI_CONTROL_METER,
|
||||
&output_port_meter_control[i][j])==0) {
|
||||
output_port_meter[i][j]=true;
|
||||
}
|
||||
else {
|
||||
output_port_meter[i][j]=false;
|
||||
}
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // Input Port AES/EBU
|
||||
HPI_SOURCENODE_AESEBU_IN,j,
|
||||
0,0,
|
||||
HPI_CONTROL_AESEBU_RECEIVER,
|
||||
&input_port_aesebu_control[i][j])==0) {
|
||||
input_port_aesebu[i][j]=true;
|
||||
}
|
||||
else {
|
||||
input_port_aesebu[i][j]=false;
|
||||
}
|
||||
if(!input_mux_type[i]) {
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i], // Input Port Mux
|
||||
HPI_SOURCENODE_LINEIN,j,
|
||||
0,0,
|
||||
HPI_CONTROL_MULTIPLEXER,
|
||||
&input_mux_control[i][j])==0) {
|
||||
input_port_mux[i][j]=true;
|
||||
l=0;
|
||||
input_port_mux_type[i][j][0]=false;
|
||||
input_port_mux_type[i][j][1]=false;
|
||||
while(HPI_Multiplexer_QuerySource(NULL,
|
||||
input_mux_control[i][j],
|
||||
l++,&type,&index)==0) {
|
||||
switch(type) {
|
||||
case HPI_SOURCENODE_LINEIN:
|
||||
input_port_mux_type[i][j][0]=true;
|
||||
input_mux_index[i][j][0]=index;
|
||||
break;
|
||||
case HPI_SOURCENODE_AESEBU_IN:
|
||||
input_port_mux_type[i][j][1]=true;
|
||||
input_mux_index[i][j][1]=index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
input_port_mux[i][j]=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Get The Passthroughs
|
||||
//
|
||||
for(int j=0;j<HPI_MAX_NODES;j++) {
|
||||
for(int k=0;k<HPI_MAX_NODES;k++) {
|
||||
if(HPI_MixerGetControl(NULL,hpi_mixer[i],
|
||||
HPI_SOURCENODE_LINEIN,j,
|
||||
HPI_DESTNODE_LINEOUT,k,
|
||||
HPI_CONTROL_VOLUME,
|
||||
&passthrough_port_volume_control[i][j][k])==0) {
|
||||
passthrough_port_volume[i][j][k]=true;
|
||||
}
|
||||
else {
|
||||
passthrough_port_volume[i][j][k]=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clock_timer=new QTimer(this,"clock_timer");
|
||||
connect(clock_timer,SIGNAL(timeout()),this,SLOT(clock()));
|
||||
clock_timer->start(METER_INTERVAL);
|
||||
}
|
||||
238
rdhpi/rdhpisoundcard.h
Normal file
238
rdhpi/rdhpisoundcard.h
Normal file
@@ -0,0 +1,238 @@
|
||||
// rdhpisoundcard.h
|
||||
//
|
||||
// Sound card subsystem for the HPI Library.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpisoundcard.h,v 1.5.6.3 2012/08/07 15:48:04 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 RDHPISOUNDCARD_H
|
||||
#define RDHPISOUNDCARD_H
|
||||
|
||||
#define METER_INTERVAL 20
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qstring.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <rdhpiinformation.h>
|
||||
|
||||
#include <asihpi/hpi.h>
|
||||
#ifndef HPI_VER
|
||||
#include <asihpi/hpi_version.h>
|
||||
#endif
|
||||
|
||||
#if HPI_VER < 0x40411
|
||||
typedef uint16_t hpi_err_t;
|
||||
typedef uint32_t hpi_handle_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definitions
|
||||
*/
|
||||
#define RDHPISOUNDCARD_HPI_MAX_LEVEL 2400
|
||||
#define RDHPISOUNDCARD_HPI_MIN_LEVEL 0
|
||||
|
||||
|
||||
class RDHPISoundCard : public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
enum FadeProfile {Linear=0,Log=1};
|
||||
enum Channel {Left=0,Right=1};
|
||||
enum ChannelMode {Normal=0, // HPI_CHANNEL_MODE_NORMAL-1
|
||||
Swap=1, // HPI_CHANNEL_MODE_SWAP-1
|
||||
LeftOnly=2, // HPI_CHANNEL_MODE_LEFT_TO_STEREO-1
|
||||
RightOnly=3}; // HPI_CHANNEL_MODE_RIGHT_TO_STEREO-1
|
||||
enum DeviceClass {RecordDevice=0,PlayDevice=1};
|
||||
enum Driver {Alsa=0,Hpi=1,Jack=2};
|
||||
enum ClockSource {Internal=0,AesEbu=1,SpDiff=2,WordClock=4};
|
||||
enum SourceNode {SourceBase=100, // HPI_SOURCENODE_BASE
|
||||
OStream=101, // HPI_SOURCENODE_OSTREAM
|
||||
LineIn=102, // HPI_SOURCENODE_LINEIN
|
||||
AesEbuIn=103, // HPI_SOURCENODE_AESEBU_IN
|
||||
Tuner=104, // HPI_SOURCENODE_TUNER
|
||||
RfIn=105, // HPI_SOURCENODE_RF
|
||||
Clock=106, // HPI_SOURCENODE_CLOCK_SOURCE
|
||||
Raw=107, // HPI_SOURCENODE_RAW_BITSTREAM
|
||||
Mic=108 // HPI_SOURCENODE_MICROPHONE
|
||||
};
|
||||
|
||||
/**
|
||||
* Mixer Destination Nodes
|
||||
**/
|
||||
enum DestNode {DestBase=200, // HPI_DESTNODE_BASE
|
||||
IStream=201, // HPI_DESTNODE_ISTREAM
|
||||
LineOut=202, // HPI_DESTNODE_LINEOUT
|
||||
AesEbuOut=203, // HPI_DESTNODE_AESEBU_OUT
|
||||
RfOut=204, // HPI_DESTNODE_RF
|
||||
Speaker=205 // HPI_DESTNODE_SPEAKER
|
||||
};
|
||||
|
||||
enum TunerBand {Fm=0,FmStereo=1,Am=2,Tv=3};
|
||||
|
||||
enum Subcarrier {Mpx=0,Rds=1};
|
||||
RDHPISoundCard(QObject *parent=0,const char *name=0);
|
||||
~RDHPISoundCard();
|
||||
Driver driver() const;
|
||||
RDHPIInformation *hpiInformation(int card);
|
||||
int getCardQuantity() const;
|
||||
int getCardInputStreams(int card) const;
|
||||
int getCardOutputStreams(int card) const;
|
||||
int getCardInputPorts(int card) const;
|
||||
int getCardOutputPorts(int card) const;
|
||||
const void *getCardInfo(int card) const;
|
||||
QString getCardDescription(int card) const;
|
||||
QString getInputStreamDescription(int card,int stream) const;
|
||||
QString getOutputStreamDescription(int card,int stream) const;
|
||||
QString getInputPortDescription(int card,int port) const;
|
||||
QString getOutputPortDescription(int card,int port) const;
|
||||
bool setClockSource(int card,RDHPISoundCard::ClockSource src);
|
||||
bool haveTimescaling(int card) const;
|
||||
bool haveInputVolume(int card,int stream,int port) const;
|
||||
bool haveOutputVolume(int card,int stream,int port) const;
|
||||
bool haveInputLevel(int card,int port) const;
|
||||
bool haveOutputLevel(int card,int port) const;
|
||||
bool haveInputStreamMeter(int card,int stream) const;
|
||||
bool haveOutputStreamMeter(int card,int stream) const;
|
||||
bool haveInputPortMeter(int card,int port) const;
|
||||
bool haveOutputPortMeter(int card,int port) const;
|
||||
bool haveTuner(int card,int port) const;
|
||||
RDHPISoundCard::TunerBand tunerBand(int card,int port);
|
||||
void setTunerBand(int card,int port,RDHPISoundCard::TunerBand band);
|
||||
int tunerFrequency(int card,int port);
|
||||
void setTunerFrequency(int card,int port,int freq);
|
||||
bool tunerSubcarrier(int card,int port,RDHPISoundCard::Subcarrier sub);
|
||||
int tunerLowFrequency(int card,int port,RDHPISoundCard::TunerBand band);
|
||||
int tunerHighFrequency(int card,int port,RDHPISoundCard::TunerBand band);
|
||||
bool inputStreamMeter(int card,int stream,short *level);
|
||||
bool outputStreamMeter(int card,int stream,short *level);
|
||||
bool inputPortMeter(int card,int port,short *level);
|
||||
bool outputPortMeter(int card,int port,short *level);
|
||||
bool haveInputMode(int card,int port) const;
|
||||
bool haveOutputMode(int card,int stream) const;
|
||||
bool haveInputStreamVOX(int card,int stream) const;
|
||||
bool haveInputPortMux(int card,int port) const;
|
||||
bool queryInputPortMux(int card,int port,SourceNode node) const;
|
||||
bool haveInputStreamMux(int card,int stream) const;
|
||||
int getInputVolume(int card,int stream,int port);
|
||||
int getOutputVolume(int card,int stream,int port);
|
||||
int getInputLevel(int card,int port);
|
||||
int getOutputLevel(int card,int port);
|
||||
RDHPISoundCard::SourceNode getInputPortMux(int card,int port);
|
||||
bool setInputPortMux(int card,int port,RDHPISoundCard::SourceNode node);
|
||||
RDHPISoundCard::FadeProfile getFadeProfile() const;
|
||||
unsigned short getInputPortError(int card,int port);
|
||||
void setFadeProfile(RDHPISoundCard::FadeProfile profile);
|
||||
|
||||
signals:
|
||||
void inputPortError(int card,int port);
|
||||
void leftInputStreamMeter(int card,int stream,int level);
|
||||
void leftOutputStreamMeter(int card,int stream,int level);
|
||||
void rightInputStreamMeter(int card,int stream,int level);
|
||||
void rightOutputStreamMeter(int card,int stream,int level);
|
||||
void leftInputPortMeter(int card,int port,int level);
|
||||
void leftOutputPortMeter(int card,int port,int level);
|
||||
void rightInputPortMeter(int card,int port,int level);
|
||||
void rightOutputPortMeter(int card,int port,int level);
|
||||
void inputMode(int card,int port,RDHPISoundCard::ChannelMode mode);
|
||||
void outputMode(int card,int stream,RDHPISoundCard::ChannelMode mode);
|
||||
void tunerSubcarrierChanged(RDHPISoundCard::Subcarrier car,bool state);
|
||||
|
||||
public slots:
|
||||
void setInputVolume(int card,int stream,int level);
|
||||
void setOutputVolume(int card,int stream,int port,int level);
|
||||
void fadeOutputVolume(int card,int stream,int port,int level,int length);
|
||||
void setInputLevel(int card,int port,int level);
|
||||
void setOutputLevel(int card,int port,int level);
|
||||
void setInputMode(int card,int port,RDHPISoundCard::ChannelMode mode);
|
||||
void setOutputMode(int card,int stream,RDHPISoundCard::ChannelMode mode);
|
||||
void setInputStreamVOX(int card,int stream,short gain);
|
||||
bool havePassthroughVolume(int card,int in_port,int out_port);
|
||||
bool setPassthroughVolume(int card,int in_port,int out_port,int level);
|
||||
|
||||
private slots:
|
||||
void clock();
|
||||
|
||||
private:
|
||||
void HPIProbe();
|
||||
uint16_t card_input_streams[HPI_MAX_ADAPTERS];
|
||||
uint16_t card_output_streams[HPI_MAX_ADAPTERS];
|
||||
uint16_t card_input_ports[HPI_MAX_ADAPTERS];
|
||||
uint16_t card_output_ports[HPI_MAX_ADAPTERS];
|
||||
QString card_description[HPI_MAX_ADAPTERS];
|
||||
QString input_stream_description[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
QString output_stream_description[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
QString input_port_description[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
QString output_port_description[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
bool input_stream_volume[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS][HPI_MAX_NODES];
|
||||
bool output_stream_volume[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS][HPI_MAX_NODES];
|
||||
bool input_port_level[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
bool output_port_level[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
bool input_stream_meter[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
bool output_stream_meter[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
bool input_port_meter[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
bool output_port_meter[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
bool input_port_mode[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
bool output_stream_mode[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
bool input_stream_vox[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
bool input_port_mux[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
bool input_port_mux_type[HPI_MAX_ADAPTERS][HPI_MAX_NODES][2];
|
||||
bool passthrough_port_volume[HPI_MAX_ADAPTERS][HPI_MAX_NODES][HPI_MAX_NODES];
|
||||
uint16_t input_mux_index[HPI_MAX_ADAPTERS][HPI_MAX_NODES][2];
|
||||
bool input_stream_mux[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
bool input_port_aesebu[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
uint16_t input_port_aesebu_error[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
bool timescale_support[HPI_MAX_ADAPTERS];
|
||||
int card_quantity;
|
||||
QTimer *clock_timer;
|
||||
RDHPISoundCard::FadeProfile fade_type;
|
||||
uint32_t card_index[HPI_MAX_ADAPTERS];
|
||||
hpi_handle_t hpi_mixer[HPI_MAX_ADAPTERS];
|
||||
hpi_handle_t clock_source_control[HPI_MAX_ADAPTERS];
|
||||
hpi_handle_t input_stream_volume_control[HPI_MAX_ADAPTERS]
|
||||
[HPI_MAX_STREAMS][HPI_MAX_NODES];
|
||||
hpi_handle_t output_stream_volume_control[HPI_MAX_ADAPTERS]
|
||||
[HPI_MAX_STREAMS][HPI_MAX_NODES];
|
||||
hpi_handle_t input_port_level_control[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
hpi_handle_t output_port_level_control[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
hpi_handle_t input_stream_meter_control[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
hpi_handle_t output_stream_meter_control[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
hpi_handle_t input_port_meter_control[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
hpi_handle_t output_port_meter_control[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
hpi_handle_t input_port_mode_control[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
hpi_handle_t output_stream_mode_control[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
hpi_handle_t input_stream_vox_control[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
bool input_mux_type[HPI_MAX_ADAPTERS];
|
||||
hpi_handle_t input_mux_control[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS];
|
||||
hpi_handle_t passthrough_port_volume_control[HPI_MAX_ADAPTERS]
|
||||
[HPI_MAX_NODES][HPI_MAX_NODES];
|
||||
hpi_handle_t input_port_aesebu_control[HPI_MAX_ADAPTERS][HPI_MAX_NODES];
|
||||
uint16_t hpi_fade_type;
|
||||
short
|
||||
input_stream_meter_peak[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS][HPI_MAX_CHANNELS];
|
||||
short
|
||||
output_stream_meter_peak[HPI_MAX_ADAPTERS][HPI_MAX_STREAMS][HPI_MAX_CHANNELS];
|
||||
short input_port_meter_peak[HPI_MAX_ADAPTERS][HPI_MAX_NODES][HPI_MAX_CHANNELS];
|
||||
short output_port_meter_peak[HPI_MAX_ADAPTERS][HPI_MAX_NODES][HPI_MAX_CHANNELS];
|
||||
RDHPIInformation hpi_info[HPI_MAX_ADAPTERS];
|
||||
};
|
||||
|
||||
|
||||
#endif // RDHPISOUNDCARD_H
|
||||
71
rdhpi/rdhpisoundselector.cpp
Normal file
71
rdhpi/rdhpisoundselector.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
// rdhpisoundselector.cpp
|
||||
//
|
||||
// A selection widget for audio devices.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpisoundselector.cpp,v 1.3 2010/07/29 19:32:36 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 <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <qobject.h>
|
||||
#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
|
||||
#include <rdhpisoundselector.h>
|
||||
|
||||
|
||||
|
||||
RDHPISoundSelector::RDHPISoundSelector(RDHPISoundCard::DeviceClass dev_class,
|
||||
QWidget *parent,
|
||||
const char *name) :QListBox(parent,name)
|
||||
{
|
||||
sound_card=new RDHPISoundCard(this,"sound_card");
|
||||
|
||||
if(dev_class==RDHPISoundCard::PlayDevice) {
|
||||
for(int i=0;i<sound_card->getCardQuantity();i++) {
|
||||
for(int j=0;j<sound_card->getCardOutputPorts(i);j++) {
|
||||
insertItem(sound_card->getOutputPortDescription(i,j),
|
||||
i*HPI_MAX_NODES+j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dev_class==RDHPISoundCard::RecordDevice) {
|
||||
for(int i=0;i<sound_card->getCardQuantity();i++) {
|
||||
for(int j=0;j<sound_card->getCardInputPorts(i);j++) {
|
||||
insertItem(sound_card->getInputPortDescription(i,j),
|
||||
i*HPI_MAX_NODES+j);
|
||||
}
|
||||
}
|
||||
}
|
||||
connect(this,SIGNAL(highlighted(int)),this,SLOT(selection(int)));
|
||||
}
|
||||
|
||||
|
||||
void RDHPISoundSelector::selection(int selection)
|
||||
{
|
||||
emit changed(selection/HPI_MAX_ADAPTERS,
|
||||
selection-HPI_MAX_ADAPTERS*(selection/HPI_MAX_ADAPTERS));
|
||||
emit cardChanged(selection/HPI_MAX_ADAPTERS);
|
||||
emit portChanged(selection-HPI_MAX_ADAPTERS*(selection/HPI_MAX_ADAPTERS));
|
||||
}
|
||||
68
rdhpi/rdhpisoundselector.h
Normal file
68
rdhpi/rdhpisoundselector.h
Normal file
@@ -0,0 +1,68 @@
|
||||
// rdhpisoundselector.h
|
||||
//
|
||||
// A selection widget for audio devices.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdhpisoundselector.h,v 1.4 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.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef RDHPISOUNDSELECTOR_H
|
||||
#define RDHPISOUNDSELECTOR_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <qobject.h>
|
||||
#include <qwidget.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qtimer.h>
|
||||
#include <qlistbox.h>
|
||||
|
||||
#include <rdhpisoundcard.h>
|
||||
|
||||
#ifdef ALSA
|
||||
#include <alsa/asoundlib.h>
|
||||
#endif // HPI
|
||||
|
||||
#ifdef JACK
|
||||
#include <jack/jack.h>
|
||||
#endif // JACK
|
||||
|
||||
class RDHPISoundSelector : public QListBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RDHPISoundSelector(RDHPISoundCard::DeviceClass dev_class,
|
||||
QWidget *parent=0,const char *name=0);
|
||||
|
||||
signals:
|
||||
void changed(int card,int port);
|
||||
void cardChanged(int card);
|
||||
void portChanged(int port);
|
||||
|
||||
private slots:
|
||||
void selection(int selection);
|
||||
|
||||
private:
|
||||
RDHPISoundCard *sound_card;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDHPISOUNDSELECTOR_H
|
||||
Reference in New Issue
Block a user