Browse Source

refactor(audio): Add audio settings interface

reviewable/pr4757/r2
Diadlo 8 years ago
parent
commit
44258b01f5
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 1
      CMakeLists.txt
  2. 50
      src/audio/iaudiosettings.h
  3. 62
      src/persistence/settings.h

1
CMakeLists.txt

@ -195,6 +195,7 @@ set(${PROJECT_NAME}_SOURCES @@ -195,6 +195,7 @@ set(${PROJECT_NAME}_SOURCES
src/audio/audio.h
src/audio/backend/openal.cpp
src/audio/backend/openal.h
src/audio/iaudiosettings.h
src/chatlog/chatlinecontent.cpp
src/chatlog/chatlinecontent.h
src/chatlog/chatlinecontentproxy.cpp

50
src/audio/iaudiosettings.h

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
#ifndef I_AUDIO_SETTINGS_H
#define I_AUDIO_SETTINGS_H
#include "src/model/interface.h"
#include <QString>
class IAudioSettings {
public:
virtual QString getInDev() const = 0;
virtual void setInDev(const QString& deviceSpecifier) = 0;
virtual bool getAudioInDevEnabled() const = 0;
virtual void setAudioInDevEnabled(bool enabled) = 0;
virtual QString getOutDev() const = 0;
virtual void setOutDev(const QString& deviceSpecifier) = 0;
virtual bool getAudioOutDevEnabled() const = 0;
virtual void setAudioOutDevEnabled(bool enabled) = 0;
virtual qreal getAudioInGainDecibel() const = 0;
virtual void setAudioInGainDecibel(qreal dB) = 0;
virtual int getOutVolume() const = 0;
virtual void setOutVolume(int volume) = 0;
virtual int getAudioBitrate() const = 0;
virtual void setAudioBitrate(int bitrate) = 0;
virtual bool getEnableTestSound() const = 0;
virtual void setEnableTestSound(bool newValue) = 0;
virtual bool getEnableBackend2() const = 0;
virtual void setEnableBackend2(bool enabled) = 0;
DECLARE_SIGNAL(inDevChanged, const QString& device);
DECLARE_SIGNAL(audioInDevEnabledChanged, bool enabled);
DECLARE_SIGNAL(outDevChanged, const QString& device);
DECLARE_SIGNAL(audioOutDevEnabledChanged, bool enabled);
DECLARE_SIGNAL(audioInGainDecibelChanged, qreal dB);
DECLARE_SIGNAL(outVolumeChanged, int volume);
DECLARE_SIGNAL(audioBitrateChanged, int bitrate);
DECLARE_SIGNAL(enableTestSoundChanged, bool newValue);
DECLARE_SIGNAL(enableBackend2Changed, bool enabled);
};
#endif // I_AUDIO_SETTINGS_H

62
src/persistence/settings.h

@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
#ifndef SETTINGS_HPP
#define SETTINGS_HPP
#include "src/audio/iaudiosettings.h"
#include "src/core/icoresettings.h"
#include "src/core/toxencrypt.h"
#include "src/core/toxfile.h"
@ -41,7 +42,7 @@ namespace Db { @@ -41,7 +42,7 @@ namespace Db {
enum class syncType;
}
class Settings : public QObject, public ICoreSettings
class Settings : public QObject, public ICoreSettings, public IAudioSettings
{
Q_OBJECT
@ -224,17 +225,6 @@ signals: @@ -224,17 +225,6 @@ signals:
void dbSyncTypeChanged(Db::syncType type);
void blackListChanged(QStringList& blist);
// Audio
void inDevChanged(const QString& name);
void audioInDevEnabledChanged(bool enabled);
void audioInGainDecibelChanged(qreal gain);
void outDevChanged(const QString& name);
void audioOutDevEnabledChanged(bool enabled);
void outVolumeChanged(int volume);
void audioBitrateChanged(int bitrate);
void enableTestSoundChanged(bool enabled);
void enableBackend2Changed(bool enabled);
// Video
void videoDevChanged(const QString& name);
void camVideoResChanged(const QRect& resolution);
@ -350,32 +340,44 @@ public: @@ -350,32 +340,44 @@ public:
bool getGroupAlwaysNotify() const;
void setGroupAlwaysNotify(bool newValue);
QString getInDev() const;
void setInDev(const QString& deviceSpecifier);
QString getInDev() const override;
void setInDev(const QString& deviceSpecifier) override;
bool getAudioInDevEnabled() const override;
void setAudioInDevEnabled(bool enabled) override;
QString getOutDev() const override;
void setOutDev(const QString& deviceSpecifier) override;
bool getAudioOutDevEnabled() const override;
void setAudioOutDevEnabled(bool enabled) override;
bool getAudioInDevEnabled() const;
void setAudioInDevEnabled(bool enabled);
qreal getAudioInGainDecibel() const override;
void setAudioInGainDecibel(qreal dB) override;
QString getOutDev() const;
void setOutDev(const QString& deviceSpecifier);
int getOutVolume() const override;
void setOutVolume(int volume) override;
bool getAudioOutDevEnabled() const;
void setAudioOutDevEnabled(bool enabled);
int getAudioBitrate() const override;
void setAudioBitrate(int bitrate) override;
qreal getAudioInGainDecibel() const;
void setAudioInGainDecibel(qreal dB);
bool getEnableTestSound() const override;
void setEnableTestSound(bool newValue) override;
int getOutVolume() const;
void setOutVolume(int volume);
bool getEnableBackend2() const override;
void setEnableBackend2(bool enabled) override;
int getAudioBitrate() const;
void setAudioBitrate(int bitrate);
SIGNAL_IMPL(Settings, inDevChanged, const QString& device)
SIGNAL_IMPL(Settings, audioInDevEnabledChanged, bool enabled)
bool getEnableTestSound() const;
void setEnableTestSound(bool newValue);
SIGNAL_IMPL(Settings, outDevChanged, const QString& device)
SIGNAL_IMPL(Settings, audioOutDevEnabledChanged, bool enabled)
bool getEnableBackend2() const;
void setEnableBackend2(bool enabled);
SIGNAL_IMPL(Settings, audioInGainDecibelChanged, qreal dB)
SIGNAL_IMPL(Settings, outVolumeChanged, int volume)
SIGNAL_IMPL(Settings, audioBitrateChanged, int bitrate)
SIGNAL_IMPL(Settings, enableTestSoundChanged, bool newValue)
SIGNAL_IMPL(Settings, enableBackend2Changed, bool enabled)
QString getVideoDev() const;
void setVideoDev(const QString& deviceSpecifier);

Loading…
Cancel
Save