2015-09-05 Fred Gleason <fredg@paravelsystems.com>

* Refactored caed(8) to use virtual inheritance for audio
	subsystem drivers.
	* Reimplemented the HPI driver in 'cae/driver_hpi.cpp' and
	'cae/driver_hpi.h'.
This commit is contained in:
Fred Gleason
2015-09-05 18:12:29 -04:00
parent 4de09b9eaf
commit c1f86bbde1
13 changed files with 1217 additions and 1389 deletions

86
cae/driver_hpi.h Normal file
View File

@@ -0,0 +1,86 @@
// driver_hpi.h
//
// CAE driver for AudioScience HPI devices
//
// (C) Copyright 2002-2015 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef DRIVER_HPI_H
#define DRIVER_HPI_H
#include <rd.h>
#ifdef HPI
#include <rdhpiplaystream.h>
#include <rdhpirecordstream.h>
#include <rdhpisoundcard.h>
#endif // HPI
#include "driver.h"
class HpiDriver : public Driver
{
Q_OBJECT
public:
HpiDriver(RDStation *station,RDConfig *config,QObject *parent=0);
~HpiDriver();
QString version();
QString cardName(int card);
int inputs(int card);
int outputs(int card);
int start(int next_card);
bool loadPlayback(int card,QString wavename,int *stream);
bool unloadPlayback(int card,int stream);
bool playbackPosition(int card,int stream,unsigned pos);
bool play(int card,int stream,int length,int speed,bool pitch,bool rates);
bool stopPlayback(int card,int stream);
bool timescaleSupported(int card);
bool loadRecord(int card,int stream,int coding,int chans,int samprate,
int bitrate,QString wavename);
bool record(int card,int stream,int length,int thres);
bool stopRecord(int card,int stream);
bool unloadRecord(int card,int stream,unsigned *len);
bool setClockSource(int card,int src);
bool setInputVolume(int card,int stream,int level);
bool setOutputVolume(int card,int stream,int port,int level);
bool fadeOutputVolume(int card,int stream,int port,int level,int length);
bool setInputLevel(int card,int port,int level);
bool setOutputLevel(int card,int port,int level);
bool setInputMode(int card,int stream,int mode);
bool setOutputMode(int card,int stream,int mode);
bool setInputVoxLevel(int card,int stream,int level);
bool setInputType(int card,int port,int type);
bool getInputStatus(int card,int port);
bool getInputMeters(int card,int port,short levels[2]);
bool getOutputMeters(int card,int port,short levels[2]);
bool getStreamOutputMeters(int card,int stream,short levels[2]);
bool setPassthroughLevel(int card,int in_port,int out_port,int level);
void getOutputPosition(int card,unsigned *pos);
private slots:
void playStateChangedData(int card,int stream,int state);
void recordStateChangedData(int card,int stream,int state);
private:
#ifdef HPI
RDHPISoundCard *hpi_sound_card;
RDHPIRecordStream *hpi_record[RD_MAX_CARDS][RD_MAX_STREAMS];
RDHPIPlayStream *hpi_play[RD_MAX_CARDS][RD_MAX_STREAMS];
#endif // HPI
};
#endif // DRIVER_HPI_H