Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions include/AudioAlsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,33 @@
#include "AudioDevice.h"


class LcdSpinBox;
class QLineEdit;


class AudioAlsa : public AudioDevice, public QThread
{
// Public classes and enums
public:
/**
* @brief Contains the relevant information about available ALSA devices
*/
class DeviceInfo
{
public:
DeviceInfo(QString const & deviceName, QString const & deviceDescription) :
m_deviceName(deviceName),
m_deviceDescription(deviceDescription)
{}
~DeviceInfo() {}

QString const & getDeviceName() const { return m_deviceName; }
QString const & getDeviceDescription() const { return m_deviceDescription; }

private:
QString m_deviceName;
QString m_deviceDescription;

};

typedef std::vector<DeviceInfo> DeviceInfoCollection;

public:
AudioAlsa( bool & _success_ful, Mixer* mixer );
virtual ~AudioAlsa();
Expand All @@ -55,21 +76,7 @@ class AudioAlsa : public AudioDevice, public QThread

static QString probeDevice();


class setupWidget : public AudioDevice::setupWidget
{
public:
setupWidget( QWidget * _parent );
virtual ~setupWidget();

virtual void saveSettings();

private:
QLineEdit * m_device;
LcdSpinBox * m_channels;

} ;

static DeviceInfoCollection getAvailableDevices();

private:
virtual void startProcessing();
Expand Down
64 changes: 64 additions & 0 deletions include/AudioAlsaSetupWidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* AudioAlsaSetupWidget.h - Implements a setup widget for ALSA-PCM-output
*
* Copyright (c) 2004-2015 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program 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.
*
* 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

#ifndef AUDIO_ALSA_SETUP_WIDGET_H
#define AUDIO_ALSA_SETUP_WIDGET_H

#include "lmmsconfig.h"

#ifdef LMMS_HAVE_ALSA

#include "AudioDeviceSetupWidget.h"

#include "AudioAlsa.h"


class QComboBox;
class LcdSpinBox;


class AudioAlsaSetupWidget : public AudioDeviceSetupWidget
{
Q_OBJECT

public:
AudioAlsaSetupWidget( QWidget * _parent );
virtual ~AudioAlsaSetupWidget();

virtual void saveSettings();

public slots:
void onCurrentIndexChanged(int index);

private:
QComboBox * m_deviceComboBox;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_deviceComboBox is only accessed within the context in which it was created (AudioAlsaSetupWidget's constructor), so could be made a local variable within the constructor instead of a member variable.

I don't know if this was intentional or not, as some people consider it a stylistic choice. Personally, I find extraneous member variables to be a bad thing. The more confined the scope of a variable, the fewer places you have to search through when debugging.

LcdSpinBox * m_channels;

int m_selectedDevice;
AudioAlsa::DeviceInfoCollection m_deviceInfos;
};

#endif

#endif
26 changes: 0 additions & 26 deletions include/AudioDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,6 @@ class AudioDevice



class setupWidget : public TabWidget
{
public:
setupWidget( const QString & _caption, QWidget * _parent ) :
TabWidget( TabWidget::tr( "Settings for %1" ).arg(
TabWidget::tr( _caption.toLatin1() ) ).
toUpper(), _parent )
{
}

virtual ~setupWidget()
{
}

virtual void saveSettings() = 0;

virtual void show()
{
parentWidget()->show();
QWidget::show();
}

} ;



protected:
// subclasses can re-implement this for being used in conjunction with
// processNextBuffer()
Expand Down
44 changes: 44 additions & 0 deletions include/AudioDeviceSetupWidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* AudioDeviceSetupWidget.h - Base class for audio device setup widgets
*
* Copyright (c) 2004-2015 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - http://lmms.io
*
* This program 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.
*
* 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 (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

#ifndef AUDIO_DEVICE_SETUP_WIDGET_H
#define AUDIO_DEVICE_SETUP_WIDGET_H

#include "TabWidget.h"


class AudioDeviceSetupWidget : public TabWidget
{
public:
AudioDeviceSetupWidget( const QString & _caption, QWidget * _parent );

virtual ~AudioDeviceSetupWidget();

virtual void saveSettings() = 0;

virtual void show();
};


#endif
5 changes: 3 additions & 2 deletions include/AudioDummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define AUDIO_DUMMY_H

#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"
#include "MicroTimer.h"


Expand All @@ -49,11 +50,11 @@ class AudioDummy : public AudioDevice, public QThread
}


class setupWidget : public AudioDevice::setupWidget
class setupWidget : public AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent ) :
AudioDevice::setupWidget( AudioDummy::name(), _parent )
AudioDeviceSetupWidget( AudioDummy::name(), _parent )
{
}

Expand Down
3 changes: 2 additions & 1 deletion include/AudioJack.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <QtCore/QMap>

#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"


class QLineEdit;
Expand All @@ -55,7 +56,7 @@ class AudioJack : public QObject, public AudioDevice
}


class setupWidget : public AudioDevice::setupWidget
class setupWidget : public AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
Expand Down
3 changes: 2 additions & 1 deletion include/AudioOss.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#ifdef LMMS_HAVE_OSS

#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"


class LcdSpinBox;
Expand All @@ -50,7 +51,7 @@ class AudioOss : public AudioDevice, public QThread
static QString probeDevice();


class setupWidget : public AudioDevice::setupWidget
class setupWidget : public AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
Expand Down
3 changes: 2 additions & 1 deletion include/AudioPortAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public slots:
#endif

#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"

#if defined paNeverDropInput || defined paNonInterleaved
# define PORTAUDIO_V19
Expand Down Expand Up @@ -81,7 +82,7 @@ class AudioPortAudio : public AudioDevice
unsigned long _framesPerBuffer );


class setupWidget : public AudioDevice::setupWidget
class setupWidget : public AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
Expand Down
3 changes: 2 additions & 1 deletion include/AudioPulseAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <pulse/pulseaudio.h>

#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"


class LcdSpinBox;
Expand All @@ -52,7 +53,7 @@ class AudioPulseAudio : public AudioDevice, public QThread
static QString probeDevice();


class setupWidget : public AudioDevice::setupWidget
class setupWidget : public AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
Expand Down
3 changes: 2 additions & 1 deletion include/AudioSdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <SDL/SDL_audio.h>

#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"

class QLineEdit;

Expand All @@ -50,7 +51,7 @@ class AudioSdl : public AudioDevice
}


class setupWidget : public AudioDevice::setupWidget
class setupWidget : public AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
Expand Down
4 changes: 3 additions & 1 deletion include/SetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "AudioDevice.h"
#include "MidiClient.h"

#include "AudioDeviceSetupWidget.h"


class QComboBox;
class QLabel;
Expand Down Expand Up @@ -178,7 +180,7 @@ private slots:
bool m_displayWaveform;
bool m_disableAutoQuit;

typedef QMap<QString, AudioDevice::setupWidget *> AswMap;
typedef QMap<QString, AudioDeviceSetupWidget *> AswMap;
typedef QMap<QString, MidiClient::setupWidget *> MswMap;
typedef QMap<QString, QString> trMap;

Expand Down
Loading