diff --git a/audiohandler.cpp b/audiohandler.cpp index 31c2b27..cd728d6 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -827,6 +827,15 @@ bool audioHandler::init(const quint8 bits, const quint8 channels, const quint16 return isInitialized; } +void audioHandler::setVolume(quint8 volume) +{ + if (audioOutput != Q_NULLPTR) { + audioOutput->setVolume((qreal)(volume / 255.0)); + } + else if (audioInput != Q_NULLPTR) { + audioInput->setVolume((qreal)(volume / 255.0)); + } +} bool audioHandler::setDevice(QAudioDeviceInfo deviceInfo) { diff --git a/audiohandler.h b/audiohandler.h index 0231ab8..5d1b6db 100644 --- a/audiohandler.h +++ b/audiohandler.h @@ -46,7 +46,7 @@ public: bool setDevice(QAudioDeviceInfo deviceInfo); void start(); - void setVolume(float volume); + void setVolume(quint8 volume); void flush(); void stop();