2019-06-21 Fred Gleason <fredg@paravelsystems.com>

* Added 'RDApplication::syslog()' methods.
This commit is contained in:
Fred Gleason
2019-06-24 16:40:18 -04:00
parent 52dc14a3b3
commit f50447eb8b
71 changed files with 1064 additions and 887 deletions

View File

@@ -1,8 +1,8 @@
// rdhpiplaystream.cpp
//
// A class for playing Microsoft WAV files.
// A class for playing Microsoft WAV file on AudioScience HPI devices.
//
// (C) Copyright 2002-2007,2016-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@@ -31,8 +31,9 @@
#include <qdatetime.h>
#include <rd.h>
#include <rdhpiplaystream.h>
#include <rdhpisoundcard.h>
#include <rdapplication.h>
#include "rdhpiplaystream.h"
#include "rdhpisoundcard.h"
#define RDHPIPLAYSTREAM_USE_LOCAL_MUTEX
@@ -188,7 +189,7 @@ bool RDHPIPlayStream::formatSupported(RDWaveFile::Format format)
for(int i=0;i<sound_card->getCardOutputStreams(card_number);i++) {
if(LogHpi(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hostream),
__LINE__)==0) {
syslog(LOG_NOTICE,"buffer_size: %u\n",dma_buffer_size);
RDApplication::syslog(sound_card->config(),LOG_DEBUG,"buffer_size: %u\n",dma_buffer_size);
found=true;
break;
}
@@ -805,7 +806,7 @@ int RDHPIPlayStream::GetStream()
if(LogHpi(HPI_OutStreamOpen(NULL,card_index[card_number],i,&hpi_stream),
__LINE__)==0) {
stream_number=i;
// syslog(LOG_ERR,"HPI allocating ostream: %d",stream_number);
// RDApplication::syslog(sound_card->config(),LOG_ERR,"HPI allocating ostream: %d",stream_number);
return stream_number;
}
}
@@ -835,7 +836,8 @@ hpi_err_t RDHPIPlayStream::LogHpi(hpi_err_t err,int lineno)
if(err!=0) {
HPI_GetErrorText(err,err_txt);
syslog(LOG_NOTICE,"HPI Error: %s, %s line %d",err_txt,__FILE__,lineno);
RDApplication::syslog(sound_card->config(),LOG_NOTICE,
"HPI Error: %s, %s line %d",err_txt,__FILE__,lineno);
}
return err;
}

View File

@@ -2,7 +2,7 @@
//
// A class for recording Microsoft WAV files.
//
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@@ -30,7 +30,9 @@
#include <qstring.h>
#include <qdatetime.h>
#include <rdhpirecordstream.h>
#include <rdapplication.h>
#include "rdhpirecordstream.h"
RDHPIRecordStream::RDHPIRecordStream(RDHPISoundCard *card,QWidget *parent)
:QObject(parent),RDWaveFile()
@@ -738,7 +740,8 @@ hpi_err_t RDHPIRecordStream::LogHpi(hpi_err_t err,int lineno)
if(err!=0) {
HPI_GetErrorText(err,err_txt);
syslog(LOG_NOTICE,"HPI Error: %s, %s line %d",err_txt,__FILE__,lineno);
RDApplication::syslog(sound_card->config(),LOG_NOTICE,
"HPI Error: %s, %s line %d",err_txt,__FILE__,lineno);
}
return err;
}

View File

@@ -2,7 +2,7 @@
//
// The audio card subsystem for the HPI Library.
//
// (C) Copyright 2002-2007,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@@ -19,15 +19,20 @@
//
#include <syslog.h>
#include <qtimer.h>
#include <rdhpisoundcard.h>
#include <unistd.h>
RDHPISoundCard::RDHPISoundCard(QObject *parent)
#include <qtimer.h>
#include <unistd.h>
#include <rdapplication.h>
#include "rdhpisoundcard.h"
RDHPISoundCard::RDHPISoundCard(RDConfig *config,QObject *parent)
: QObject(parent)
{
card_config=config;
card_quantity=0;
fade_type=RDHPISoundCard::Log;
for(int i=0;i<HPI_MAX_ADAPTERS;i++) {
@@ -325,6 +330,12 @@ void RDHPISoundCard::setFadeProfile(RDHPISoundCard::FadeProfile profile)
}
RDConfig *RDHPISoundCard::config() const
{
return card_config;
}
bool RDHPISoundCard::haveInputStreamMeter(int card,int stream) const
{
return input_stream_meter[card][stream];
@@ -1034,7 +1045,8 @@ hpi_err_t RDHPISoundCard::LogHpi(hpi_err_t err,int lineno)
if(err!=0) {
HPI_GetErrorText(err,err_txt);
syslog(LOG_NOTICE,"HPI Error: %s, %s line %d",err_txt,__FILE__,lineno);
RDApplication::syslog(card_config,LOG_NOTICE,
"HPI Error: %s, %s line %d",err_txt,__FILE__,lineno);
}
return err;
}

View File

@@ -2,7 +2,7 @@
//
// Sound card subsystem for the HPI Library.
//
// (C) Copyright 2002-2007,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@@ -27,7 +27,9 @@
#include <qstring.h>
#include <qtimer.h>
#include <rdhpiinformation.h>
#include <rdconfig.h>
#include "rdhpiinformation.h"
#include <asihpi/hpi.h>
#ifndef HPI_VER
@@ -85,7 +87,7 @@ class RDHPISoundCard : public QObject
enum TunerBand {Fm=0,FmStereo=1,Am=2,Tv=3};
enum Subcarrier {Mpx=0,Rds=1};
RDHPISoundCard(QObject *parent=0);
RDHPISoundCard(RDConfig *config,QObject *parent=0);
~RDHPISoundCard();
Driver driver() const;
RDHPIInformation *hpiInformation(int card);
@@ -137,6 +139,7 @@ class RDHPISoundCard : public QObject
RDHPISoundCard::FadeProfile getFadeProfile() const;
unsigned short getInputPortError(int card,int port);
void setFadeProfile(RDHPISoundCard::FadeProfile profile);
RDConfig *config() const;
signals:
void inputPortError(int card,int port);
@@ -230,6 +233,7 @@ class RDHPISoundCard : public QObject
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];
RDConfig *card_config;
};

View File

@@ -35,10 +35,10 @@
RDHPISoundSelector::RDHPISoundSelector(RDHPISoundCard::DeviceClass dev_class,
QWidget *parent)
RDConfig *config,QWidget *parent)
:Q3ListBox(parent)
{
sound_card=new RDHPISoundCard(this);
sound_card=new RDHPISoundCard(config,this);
if(dev_class==RDHPISoundCard::PlayDevice) {
for(int i=0;i<sound_card->getCardQuantity();i++) {

View File

@@ -2,7 +2,7 @@
//
// A selection widget for audio devices.
//
// (C) Copyright 2002-2007,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 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
@@ -31,7 +31,7 @@
#include <qtimer.h>
#include <q3listbox.h>
#include <rdhpisoundcard.h>
#include "rdhpisoundcard.h"
#ifdef ALSA
#include <alsa/asoundlib.h>
@@ -46,7 +46,8 @@ class RDHPISoundSelector : public Q3ListBox
Q_OBJECT
public:
RDHPISoundSelector(RDHPISoundCard::DeviceClass dev_class,QWidget *parent=0);
RDHPISoundSelector(RDHPISoundCard::DeviceClass dev_class,RDConfig *config,
QWidget *parent=0);
signals:
void changed(int card,int port);