kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Make OSS optional
Split cMixer into base class and OSS implementation. Add configure.ac macros to detect OSS and disable cMixerOSS and cSoundOSS. Hide volume sliders if OSS is disabled, or if we are not managing the mixer.pull/2/head
rodzic
cffd639e0b
commit
fc9477a0f7
|
@ -3,7 +3,9 @@ Change Log:
|
|||
2.10 1) Added history (ctrl-Left-click in waterfall). Available after tracking
|
||||
has started. This does not start a new signal acquisition.
|
||||
2) Psk and ViewPsk use shared signal detection class
|
||||
|
||||
3) Made OSS optional and added autoconf macro to detect its presence
|
||||
4) The volume sliders will now be hidden if the mixer is disabled
|
||||
|
||||
2.09 1) Modified src/Makefile.am for FreeBSD name space clash
|
||||
2) Added psk multi-channel viewer with regex search capability
|
||||
3) Rewrote audio capture/playback/generate routines to use the
|
||||
|
|
35
configure.ac
35
configure.ac
|
@ -254,6 +254,37 @@ fi
|
|||
AC_SUBST([SNDFILE_CFLAGS])
|
||||
AC_SUBST([SNDFILE_LIBS])
|
||||
|
||||
###########################
|
||||
# OSS
|
||||
###########################
|
||||
AC_ARG_ENABLE([oss],
|
||||
AC_HELP_STRING([--disable-oss], [disable support for OSS @<:@autodetect@:>@]),
|
||||
[case "${enableval}" in
|
||||
yes|no) ac_cv_want_oss="${enableval}" ;;
|
||||
*) AC_MSG_ERROR([bad value "${enableval}" for --disable-oss]) ;;
|
||||
esac],
|
||||
[ac_cv_want_oss=check])
|
||||
ac_cv_oss=no
|
||||
if test "x$ac_cv_want_oss" = "xno"; then
|
||||
AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS])
|
||||
else
|
||||
AC_CHECK_HEADER( [sys/soundcard.h], [ac_cv_oss=yes],
|
||||
[AC_CHECK_HEADER([machine/soundcard.h], [ac_cv_oss=yes], [])] )
|
||||
if test "x$ac_cv_want_oss" = "xcheck"; then
|
||||
if test "x$ac_cv_oss" = "xyes"; then
|
||||
AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS])
|
||||
else
|
||||
AC_MSG_NOTICE([disabling OSS driver])
|
||||
AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS])
|
||||
fi
|
||||
else # $ac_cv_want_oss is yes
|
||||
if test "x$ac_cv_oss" = "xno"; then
|
||||
AC_MSG_FAILURE([--enable-oss was given, but test for OSS failed])
|
||||
else
|
||||
AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
###########################
|
||||
# portaudio
|
||||
|
@ -281,6 +312,9 @@ fi
|
|||
AC_SUBST([PORTAUDIO_CFLAGS])
|
||||
AC_SUBST([PORTAUDIO_LIBS])
|
||||
|
||||
if test "$ac_cv_oss" = "no" && test "$ac_cv_portaudio" = "no"; then
|
||||
AC_MSG_FAILURE([$PACKAGE requires OSS or PortAudio])
|
||||
fi
|
||||
|
||||
###########################
|
||||
# hamlib
|
||||
|
@ -345,6 +379,7 @@ Configuration summary:
|
|||
TLS ................................. $ac_cv_have_tls
|
||||
|
||||
sndfile ............................. $ac_cv_sndfile
|
||||
OSS ................................. $ac_cv_oss
|
||||
PortAudio ........................... $ac_cv_portaudio
|
||||
hamlib .............................. $ac_cv_hamlib
|
||||
])
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
Fl_Double_Window *fl_digi_main=(Fl_Double_Window *)0;
|
||||
Fl_Help_Dialog *help_dialog = (Fl_Help_Dialog *)0;
|
||||
|
||||
cMixer mixer;
|
||||
cMixer* mixer = 0;
|
||||
|
||||
bool useCheckButtons = false;
|
||||
|
||||
|
@ -144,7 +144,6 @@ Fl_RGB_Image *feld_image = 0;
|
|||
|
||||
Pixmap fldigi_icon_pixmap;
|
||||
|
||||
|
||||
int IMAGE_WIDTH = DEFAULT_IMAGE_WIDTH;
|
||||
int Hwfall = DEFAULT_HWFALL;
|
||||
int HNOM = DEFAULT_HNOM;
|
||||
|
@ -266,7 +265,8 @@ void clean_exit() {
|
|||
rigCAT_close();
|
||||
rigMEM_close();
|
||||
|
||||
mixer.closeMixer();
|
||||
if (mixer)
|
||||
mixer->closeMixer();
|
||||
active_modem->set_stopflag(true);
|
||||
while (trx_state != STATE_RX)
|
||||
MilliSleep(100);
|
||||
|
@ -842,13 +842,13 @@ void cbMacroTimerButton(Fl_Widget *w, void *d)
|
|||
void cb_RcvMixer(Fl_Widget *w, void *d)
|
||||
{
|
||||
progdefaults.RcvMixer = valRcvMixer->value();
|
||||
mixer.setRcvGain(progdefaults.RcvMixer);
|
||||
mixer->setRcvGain(progdefaults.RcvMixer);
|
||||
}
|
||||
|
||||
void cb_XmtMixer(Fl_Widget *w, void *d)
|
||||
{
|
||||
progdefaults.XmtMixer = valXmtMixer->value();
|
||||
mixer.setXmtLevel(progdefaults.XmtMixer);
|
||||
mixer->setXmtLevel(progdefaults.XmtMixer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1210,8 +1210,6 @@ void create_fl_digi_main() {
|
|||
valXmtMixer->range(1.0,0.0);
|
||||
valXmtMixer->value(1.0);
|
||||
valXmtMixer->callback( (Fl_Callback *)cb_XmtMixer);
|
||||
valRcvMixer->deactivate();
|
||||
valXmtMixer->deactivate();
|
||||
MixerFrame->end();
|
||||
|
||||
TiledGroup = new Fl_Tile_check(sw, Y, WNOM-sw, Htext);
|
||||
|
@ -1683,14 +1681,23 @@ void resetDOMEX() {
|
|||
|
||||
void enableMixer(bool on)
|
||||
{
|
||||
#if !USE_OSS
|
||||
on = false;
|
||||
#endif
|
||||
|
||||
FL_LOCK_D();
|
||||
if (on) {
|
||||
progdefaults.EnableMixer = true;
|
||||
mixer.openMixer(progdefaults.MXdevice.c_str());
|
||||
#if USE_OSS
|
||||
mixer = new cMixerOSS;
|
||||
#else
|
||||
mixer = new cMixer;
|
||||
#endif
|
||||
mixer->openMixer(progdefaults.MXdevice.c_str());
|
||||
|
||||
mixer.PCMVolume(progdefaults.PCMvolume);
|
||||
mixer.setXmtLevel(valXmtMixer->value());
|
||||
mixer.setRcvGain(valRcvMixer->value());
|
||||
mixer->PCMVolume(progdefaults.PCMvolume);
|
||||
mixer->setXmtLevel(valXmtMixer->value());
|
||||
mixer->setRcvGain(valRcvMixer->value());
|
||||
if (progdefaults.LineIn == true)
|
||||
setMixerInput(1);
|
||||
else if (progdefaults.MicIn == true)
|
||||
|
@ -1699,17 +1706,42 @@ void enableMixer(bool on)
|
|||
setMixerInput(0);
|
||||
}else{
|
||||
progdefaults.EnableMixer = false;
|
||||
mixer.closeMixer();
|
||||
if (mixer)
|
||||
mixer->closeMixer();
|
||||
delete mixer;
|
||||
mixer = 0;
|
||||
}
|
||||
resetMixerControls();
|
||||
FL_UNLOCK_D();
|
||||
}
|
||||
|
||||
void enable_vol_sliders(bool val)
|
||||
{
|
||||
if (valRcvMixer->visible() || valXmtMixer->visible()) {
|
||||
if (val)
|
||||
return;
|
||||
valRcvMixer->hide();
|
||||
valXmtMixer->hide();
|
||||
ReceiveText->resize(ReceiveText->x() - valRcvMixer->w(), ReceiveText->y(),
|
||||
ReceiveText->w() + valRcvMixer->w(), ReceiveText->h());
|
||||
TransmitText->resize(ReceiveText->x(), TransmitText->y(),
|
||||
ReceiveText->w(), TransmitText->h());
|
||||
}
|
||||
else {
|
||||
if (!val)
|
||||
return;
|
||||
ReceiveText->resize(ReceiveText->x() + valRcvMixer->w(), ReceiveText->y(),
|
||||
ReceiveText->w() - valRcvMixer->w(), ReceiveText->h());
|
||||
TransmitText->resize(ReceiveText->x(), TransmitText->y(),
|
||||
ReceiveText->w(), TransmitText->h());
|
||||
valRcvMixer->show();
|
||||
valXmtMixer->show();
|
||||
}
|
||||
}
|
||||
|
||||
void resetMixerControls()
|
||||
{
|
||||
if (progdefaults.EnableMixer) {
|
||||
valRcvMixer->activate();
|
||||
valXmtMixer->activate();
|
||||
menuMix->activate();
|
||||
btnLineIn->activate();
|
||||
btnMicIn->activate();
|
||||
|
@ -1717,19 +1749,18 @@ void resetMixerControls()
|
|||
valPCMvolume->activate();
|
||||
}
|
||||
else {
|
||||
valRcvMixer->deactivate();
|
||||
valXmtMixer->deactivate();
|
||||
menuMix->deactivate();
|
||||
btnLineIn->deactivate();
|
||||
btnMicIn->deactivate();
|
||||
btnMixer->value(0);
|
||||
valPCMvolume->deactivate();
|
||||
}
|
||||
enable_vol_sliders(progdefaults.EnableMixer);
|
||||
}
|
||||
|
||||
void setPCMvolume(double vol)
|
||||
{
|
||||
mixer.PCMVolume(vol);
|
||||
mixer->PCMVolume(vol);
|
||||
progdefaults.PCMvolume = vol;
|
||||
}
|
||||
|
||||
|
@ -1737,16 +1768,16 @@ void setMixerInput(int dev)
|
|||
{
|
||||
int n= -1;
|
||||
switch (dev) {
|
||||
case 0: n = mixer.InputSourceNbr("Vol");
|
||||
case 0: n = mixer->InputSourceNbr("Vol");
|
||||
break;
|
||||
case 1: n = mixer.InputSourceNbr("Line");
|
||||
case 1: n = mixer->InputSourceNbr("Line");
|
||||
break;
|
||||
case 2: n = mixer.InputSourceNbr("Mic");
|
||||
case 2: n = mixer->InputSourceNbr("Mic");
|
||||
break;
|
||||
default: n = mixer.InputSourceNbr("Vol");
|
||||
default: n = mixer->InputSourceNbr("Vol");
|
||||
}
|
||||
if (n != -1)
|
||||
mixer.SetCurrentInputSource(n);
|
||||
mixer->SetCurrentInputSource(n);
|
||||
}
|
||||
|
||||
void resetSoundCard()
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "mixer.h"
|
||||
|
||||
extern Fl_Double_Window *fl_digi_main;
|
||||
extern cMixer mixer;
|
||||
|
||||
extern ReceiveWidget *ReceiveText;
|
||||
extern TransmitWidget *TransmitText;
|
||||
|
|
|
@ -1,23 +1,40 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// mixer.h
|
||||
//
|
||||
// Copyright (C) 2006-2007
|
||||
// Dave Freese, W1HKJ
|
||||
//
|
||||
// Copyright (C) 2007-2008
|
||||
// Stelios Bounanos, M0GLD
|
||||
//
|
||||
// This file is part of fldigi.
|
||||
//
|
||||
// fldigi is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// fldigi 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 fldigi; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MIXER_H
|
||||
#define MIXER_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <sys/soundcard.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#if USE_OSS
|
||||
# include <sys/soundcard.h>
|
||||
#endif
|
||||
|
||||
class MixerException {
|
||||
public:
|
||||
|
@ -34,9 +51,32 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class cMixer {
|
||||
class cMixer
|
||||
{
|
||||
public:
|
||||
// cMixer() { }
|
||||
// virtual ~cMixer() { }
|
||||
|
||||
virtual void openMixer(const char* dev = "/dev/mixer") { };
|
||||
virtual void closeMixer(void) { };
|
||||
|
||||
virtual void setXmtLevel(double v) { };
|
||||
virtual void setRcvGain(double v) { };
|
||||
|
||||
virtual double PCMVolume(void) { return 0; };
|
||||
virtual void PCMVolume(double volume) { };
|
||||
|
||||
virtual int InputSourceNbr(const char *source) { return 0; };
|
||||
|
||||
virtual void SetCurrentInputSource(int i) { };
|
||||
};
|
||||
|
||||
#if USE_OSS
|
||||
|
||||
class cMixerOSS : public cMixer
|
||||
{
|
||||
private:
|
||||
std::string mixer;
|
||||
std::string mixer;
|
||||
int mixer_fd;
|
||||
int recmask;
|
||||
int devmask;
|
||||
|
@ -73,36 +113,41 @@ private:
|
|||
void restoreValues();
|
||||
|
||||
public:
|
||||
cMixer();
|
||||
~cMixer();
|
||||
void openMixer(const char *dev = "/dev/mixer");
|
||||
void closeMixer();
|
||||
cMixerOSS();
|
||||
~cMixerOSS();
|
||||
void openMixer(const char *dev = "/dev/mixer");
|
||||
void closeMixer();
|
||||
|
||||
void setXmtLevel(double v);
|
||||
void setRcvGain(double v);
|
||||
void setXmtLevel(double v);
|
||||
void setRcvGain(double v);
|
||||
|
||||
int numMixers() { return NumMixers;}
|
||||
int MixerNum(int i) { return Devices[i];}
|
||||
double PCMVolume();
|
||||
void PCMVolume(double volume );
|
||||
int InputSourceNbr(const char *source);
|
||||
void SetCurrentInputSource( int i );
|
||||
// double GetPlaythrough();
|
||||
// void SetPlaythrough( double volume );
|
||||
// void SetMuteInput(bool);
|
||||
|
||||
protected:
|
||||
int numMixers() { return NumMixers;}
|
||||
int MixerNum(int i) { return Devices[i];}
|
||||
const char * MixerName( int index );
|
||||
double OutVolume();
|
||||
void OutVolume(double vol);
|
||||
double PCMVolume();
|
||||
void PCMVolume(double volume );
|
||||
int NumOutputVolumes();
|
||||
double OutputVolume( int i );
|
||||
void OutputVolume( int i, double volume );
|
||||
double OutVolume();
|
||||
void OutVolume(double vol);
|
||||
|
||||
int NumOutputVolumes();
|
||||
double OutputVolume( int i );
|
||||
void OutputVolume( int i, double volume );
|
||||
const char * OutputVolumeName( int i );
|
||||
int GetNumInputSources();
|
||||
const char * GetInputSourceName( int i);
|
||||
int InputSourceNbr(const char *source);
|
||||
double InputVolume();
|
||||
void InputVolume( double volume );
|
||||
int GetCurrentInputSource();
|
||||
void SetCurrentInputSource( int i );
|
||||
// double GetPlaythrough();
|
||||
// void SetPlaythrough( double volume );
|
||||
// void SetMuteInput(bool);
|
||||
|
||||
|
||||
double InputVolume();
|
||||
void InputVolume( double volume );
|
||||
int GetCurrentInputSource();
|
||||
};
|
||||
|
||||
#endif // USE_OSS
|
||||
|
||||
#endif
|
||||
|
|
|
@ -116,6 +116,9 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
|
||||
#if USE_OSS
|
||||
|
||||
class cSoundOSS : public cSound {
|
||||
private:
|
||||
std::string device;
|
||||
|
@ -162,6 +165,9 @@ private:
|
|||
bool FormatOK() { return formatok;};
|
||||
};
|
||||
|
||||
#endif // USE_OSS
|
||||
|
||||
|
||||
#if USE_PORTAUDIO
|
||||
|
||||
class cSoundPA : public cSound
|
||||
|
|
11
src/main.cxx
11
src/main.cxx
|
@ -249,6 +249,7 @@ void sound_init(void)
|
|||
btnAudioIO[1]->activate();
|
||||
#endif
|
||||
|
||||
#if USE_OSS
|
||||
glob("/dev/mixer*", 0, NULL, &gbuf);
|
||||
for (size_t i = 0; i < gbuf.gl_pathc; i++)
|
||||
menuMix->add(gbuf.gl_pathv[i]);
|
||||
|
@ -256,11 +257,19 @@ void sound_init(void)
|
|||
progdefaults.MXdevice = gbuf.gl_pathv[0];
|
||||
globfree(&gbuf);
|
||||
menuMix->value(progdefaults.MXdevice.c_str());
|
||||
|
||||
#else
|
||||
progdefaults.EnableMixer = false;
|
||||
tabMixer->deactivate();
|
||||
#endif
|
||||
|
||||
// set the Sound Card configuration tab to the correct initial values
|
||||
#if !USE_PORTAUDIO
|
||||
progdefaults.btnAudioIOis = 0;
|
||||
btnAudioIO[1]->deactivate();
|
||||
#endif
|
||||
#if !USE_OSS
|
||||
progdefaults.btnAudioIOis = 1;
|
||||
btnAudioIO[0]->deactivate();
|
||||
#endif
|
||||
if (progdefaults.btnAudioIOis == 0) {
|
||||
scDevice = progdefaults.OSSdevice;
|
||||
|
|
|
@ -1,16 +1,65 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// mixer.cxx
|
||||
//
|
||||
// Copyright (C) 2006-2007
|
||||
// Dave Freese, W1HKJ
|
||||
//
|
||||
// Copyright (C) 2007-2008
|
||||
// Stelios Bounanos, M0GLD
|
||||
//
|
||||
// This file is part of fldigi.
|
||||
//
|
||||
// fldigi is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// fldigi 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 fldigi; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#if USE_OSS
|
||||
# include <sys/soundcard.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
#include "mixer.h"
|
||||
#include "configuration.h"
|
||||
|
||||
cMixer::cMixer() {
|
||||
|
||||
#if USE_OSS
|
||||
|
||||
cMixerOSS::cMixerOSS() {
|
||||
strcpy (szDevice, "/dev/mixerX");
|
||||
mixer = "/dev/mixer";
|
||||
mixer_fd = -1;
|
||||
findNumMixers();
|
||||
}
|
||||
|
||||
cMixer::~cMixer()
|
||||
cMixerOSS::~cMixerOSS()
|
||||
{
|
||||
closeMixer();
|
||||
}
|
||||
|
@ -18,7 +67,7 @@ cMixer::~cMixer()
|
|||
//=======================================
|
||||
// mixer methods
|
||||
//=======================================
|
||||
void cMixer::openMixer(const char *dev)
|
||||
void cMixerOSS::openMixer(const char *dev)
|
||||
{
|
||||
int err;
|
||||
if (mixer_fd != -1) closeMixer();
|
||||
|
@ -36,7 +85,7 @@ void cMixer::openMixer(const char *dev)
|
|||
initValues();
|
||||
}
|
||||
|
||||
void cMixer::closeMixer()
|
||||
void cMixerOSS::closeMixer()
|
||||
{
|
||||
if (mixer_fd == -1) return;
|
||||
restoreValues();
|
||||
|
@ -44,7 +93,7 @@ void cMixer::closeMixer()
|
|||
mixer_fd = -1;
|
||||
}
|
||||
|
||||
void cMixer::initValues()
|
||||
void cMixerOSS::initValues()
|
||||
{
|
||||
int devnbr;
|
||||
|
||||
|
@ -73,7 +122,7 @@ void cMixer::initValues()
|
|||
*/
|
||||
}
|
||||
|
||||
void cMixer::restoreValues()
|
||||
void cMixerOSS::restoreValues()
|
||||
{
|
||||
int devnbr;
|
||||
devnbr = InputSourceNbr("Line");
|
||||
|
@ -91,7 +140,7 @@ void cMixer::restoreValues()
|
|||
ioctl(mixer_fd, MIXER_WRITE(SOUND_MIXER_READ_RECSRC), &recsrc0);
|
||||
}
|
||||
|
||||
void cMixer::findNumMixers()
|
||||
void cMixerOSS::findNumMixers()
|
||||
{
|
||||
int fd;
|
||||
NumMixers = 0;
|
||||
|
@ -109,7 +158,7 @@ void cMixer::findNumMixers()
|
|||
}
|
||||
}
|
||||
|
||||
const char * cMixer::MixerName( int index )
|
||||
const char * cMixerOSS::MixerName( int index )
|
||||
{
|
||||
if (NumMixers <= 0)
|
||||
findNumMixers();
|
||||
|
@ -124,19 +173,19 @@ const char * cMixer::MixerName( int index )
|
|||
return szDevice;
|
||||
}
|
||||
|
||||
void cMixer::setXmtLevel(double v)
|
||||
void cMixerOSS::setXmtLevel(double v)
|
||||
{
|
||||
if (mixer_fd == -1) return;
|
||||
OutVolume(v);
|
||||
}
|
||||
|
||||
void cMixer::setRcvGain(double v)
|
||||
void cMixerOSS::setRcvGain(double v)
|
||||
{
|
||||
if (mixer_fd == -1) return;
|
||||
InputVolume(v);
|
||||
}
|
||||
|
||||
int cMixer::initMask()
|
||||
int cMixerOSS::initMask()
|
||||
{
|
||||
if (mixer_fd == -1) return -1;
|
||||
|
||||
|
@ -169,7 +218,7 @@ int cMixer::initMask()
|
|||
}
|
||||
|
||||
// returns value between 0.0 and 1.0
|
||||
double cMixer::ChannelVolume(int channel)
|
||||
double cMixerOSS::ChannelVolume(int channel)
|
||||
{
|
||||
int vol;
|
||||
int stereo;
|
||||
|
@ -191,14 +240,14 @@ double cMixer::ChannelVolume(int channel)
|
|||
Master (output) volume
|
||||
*/
|
||||
|
||||
double cMixer::OutVolume()
|
||||
double cMixerOSS::OutVolume()
|
||||
{
|
||||
if (mixer_fd == -1) return 0.0;
|
||||
|
||||
return ChannelVolume(SOUND_MIXER_VOLUME);
|
||||
}
|
||||
|
||||
void cMixer::OutVolume(double volume)
|
||||
void cMixerOSS::OutVolume(double volume)
|
||||
{
|
||||
if (mixer_fd == -1) return;
|
||||
int vol = (int)((volume * 100.0) + 0.5);
|
||||
|
@ -206,13 +255,13 @@ void cMixer::OutVolume(double volume)
|
|||
ioctl(mixer_fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &vol);
|
||||
}
|
||||
|
||||
double cMixer::PCMVolume()
|
||||
double cMixerOSS::PCMVolume()
|
||||
{
|
||||
if (mixer_fd == -1) return 0.0;
|
||||
return ChannelVolume(SOUND_MIXER_PCM);
|
||||
}
|
||||
|
||||
void cMixer::PCMVolume(double volume )
|
||||
void cMixerOSS::PCMVolume(double volume )
|
||||
{
|
||||
if (mixer_fd == -1) return;
|
||||
|
||||
|
@ -221,41 +270,41 @@ void cMixer::PCMVolume(double volume )
|
|||
ioctl(mixer_fd, MIXER_WRITE(SOUND_MIXER_PCM), &vol);
|
||||
}
|
||||
|
||||
int cMixer::NumOutputVolumes()
|
||||
int cMixerOSS::NumOutputVolumes()
|
||||
{
|
||||
return num_out;
|
||||
}
|
||||
|
||||
const char *cMixer::OutputVolumeName( int i )
|
||||
const char *cMixerOSS::OutputVolumeName( int i )
|
||||
{
|
||||
const char *labels[] = SOUND_DEVICE_LABELS;
|
||||
return labels[outs[i]];
|
||||
}
|
||||
|
||||
double cMixer::OutputVolume( int i )
|
||||
double cMixerOSS::OutputVolume( int i )
|
||||
{
|
||||
return ChannelVolume(outs[i]);
|
||||
}
|
||||
|
||||
void cMixer::OutputVolume( int i, double volume )
|
||||
void cMixerOSS::OutputVolume( int i, double volume )
|
||||
{
|
||||
int vol = (int)((volume * 100.0) + 0.5);
|
||||
vol = (vol | (vol<<8));
|
||||
ioctl(mixer_fd, MIXER_WRITE(outs[i]), &vol);
|
||||
}
|
||||
|
||||
int cMixer::GetNumInputSources()
|
||||
int cMixerOSS::GetNumInputSources()
|
||||
{
|
||||
return num_rec;
|
||||
}
|
||||
|
||||
const char *cMixer::GetInputSourceName( int i)
|
||||
const char *cMixerOSS::GetInputSourceName( int i)
|
||||
{
|
||||
const char *labels[] = SOUND_DEVICE_LABELS;
|
||||
return labels[recs[i]];
|
||||
}
|
||||
|
||||
int cMixer::InputSourceNbr(const char *source)
|
||||
int cMixerOSS::InputSourceNbr(const char *source)
|
||||
{
|
||||
const char *labels[] = SOUND_DEVICE_LABELS;
|
||||
char lbl[80];
|
||||
|
@ -273,7 +322,7 @@ int cMixer::InputSourceNbr(const char *source)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int cMixer::GetCurrentInputSource()
|
||||
int cMixerOSS::GetCurrentInputSource()
|
||||
{
|
||||
if (mixer_fd == -1) return -1;
|
||||
for(int i = 0; i < num_rec; i++)
|
||||
|
@ -282,7 +331,7 @@ int cMixer::GetCurrentInputSource()
|
|||
return -1; /* none */
|
||||
}
|
||||
|
||||
void cMixer::SetCurrentInputSource( int i )
|
||||
void cMixerOSS::SetCurrentInputSource( int i )
|
||||
{
|
||||
if (mixer_fd == -1) return;
|
||||
int newrecsrcmask = (1 << (recs[i]));
|
||||
|
@ -293,7 +342,7 @@ void cMixer::SetCurrentInputSource( int i )
|
|||
Input volume
|
||||
*/
|
||||
|
||||
double cMixer::InputVolume()
|
||||
double cMixerOSS::InputVolume()
|
||||
{
|
||||
if (mixer_fd == -1) return 0.0;
|
||||
// int i = GetCurrentInputSource();
|
||||
|
@ -302,7 +351,7 @@ double cMixer::InputVolume()
|
|||
return ChannelVolume(SOUND_MIXER_IGAIN);
|
||||
}
|
||||
|
||||
void cMixer::InputVolume( double volume )
|
||||
void cMixerOSS::InputVolume( double volume )
|
||||
{
|
||||
int vol;
|
||||
vol = (int)((volume * 100.0) + 0.5);
|
||||
|
@ -311,7 +360,7 @@ void cMixer::InputVolume( double volume )
|
|||
}
|
||||
|
||||
/*
|
||||
double cMixer::GetPlaythrough()
|
||||
double cMixerOSS::GetPlaythrough()
|
||||
{
|
||||
int i = GetCurrentInputSource();
|
||||
if (i < 0)
|
||||
|
@ -319,7 +368,7 @@ double cMixer::GetPlaythrough()
|
|||
return ChannelVolume(recs[i]);
|
||||
}
|
||||
|
||||
void cMixer::SetPlaythrough( double volume )
|
||||
void cMixerOSS::SetPlaythrough( double volume )
|
||||
{
|
||||
if (mixer_fd == -1) return;
|
||||
|
||||
|
@ -333,7 +382,7 @@ void cMixer::SetPlaythrough( double volume )
|
|||
ioctl(mixer_fd, MIXER_WRITE(recs[i]), &vol);
|
||||
}
|
||||
|
||||
void cMixer::SetMuteInput(bool b)
|
||||
void cMixerOSS::SetMuteInput(bool b)
|
||||
{
|
||||
return;
|
||||
if (b == 1)
|
||||
|
@ -343,3 +392,5 @@ void cMixer::SetMuteInput(bool b)
|
|||
}
|
||||
|
||||
*/
|
||||
|
||||
#endif // USE_OSS
|
||||
|
|
|
@ -39,7 +39,9 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <sys/soundcard.h>
|
||||
#if USE_OSS
|
||||
# include <sys/soundcard.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
#include "sound.h"
|
||||
|
@ -254,7 +256,7 @@ void cSound::tag_file(SNDFILE *sndfile, const char *title)
|
|||
}
|
||||
#endif // USE_SNDFILE
|
||||
|
||||
|
||||
#if USE_OSS
|
||||
cSoundOSS::cSoundOSS(const char *dev ) {
|
||||
device = dev;
|
||||
cbuff = 0;
|
||||
|
@ -656,6 +658,7 @@ int cSoundOSS::write_stereo(double *bufleft, double *bufright, int count)
|
|||
|
||||
return retval;
|
||||
}
|
||||
#endif // USE_OSS
|
||||
|
||||
|
||||
#if USE_PORTAUDIO
|
||||
|
|
|
@ -297,13 +297,18 @@ void trx_reset_loop()
|
|||
delete scard;
|
||||
scard = 0;
|
||||
}
|
||||
#if USE_PORTAUDIO
|
||||
#if USE_PORTAUDIO && USE_OSS
|
||||
if (progdefaults.btnAudioIOis == 1)
|
||||
scard = new cSoundPA(trx_scdev.c_str());
|
||||
else
|
||||
scard = new cSoundOSS(trx_scdev.c_str());
|
||||
#else
|
||||
# if USE_PORTAUDIO
|
||||
scard = new cSoundPA(trx_scdev.c_str());
|
||||
# endif
|
||||
# if USE_OSS
|
||||
scard = new cSoundOSS(trx_scdev.c_str());
|
||||
# endif
|
||||
#endif
|
||||
trx_state = STATE_RX;
|
||||
}
|
||||
|
@ -355,13 +360,18 @@ void trx_start(const char *scdev)
|
|||
}
|
||||
|
||||
if (scard) delete scard;
|
||||
#if USE_PORTAUDIO
|
||||
#if USE_PORTAUDIO && USE_OSS
|
||||
if (progdefaults.btnAudioIOis == 1)
|
||||
scard = new cSoundPA(scdev);
|
||||
else
|
||||
scard = new cSoundOSS(scdev);
|
||||
#else
|
||||
# if USE_PORTAUDIO
|
||||
scard = new cSoundPA(scdev);
|
||||
# endif
|
||||
# if USE_OSS
|
||||
scard = new cSoundOSS(scdev);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
trx_state = STATE_RX;
|
||||
|
|
Ładowanie…
Reference in New Issue