diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-17 20:02:14 +0100 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-19 19:46:54 +0100 |
commit | 4e1bebf0f5e06ecdd99c41771e7b4ee19c0cdcf3 (patch) | |
tree | d0e98cee9eef416282049092ea93b0b2b6eb417d /src/soundio | |
parent | 133ea1e3d6547964f014144eee15590ea449c7af (diff) |
Pass non-trivial/large function args by reference
Fixes a bunch of `-Wclazy-function-args-by-ref` warnings. See
https://github.com/KDE/clazy/blob/master/docs/checks/README-function-args-by-ref.md
for details.
Most of these changes are automated, using the clazy fixit by setting
the `CLAZY_EXPORT_FIXES` before compilation and then running:
$ mkdir /tmp/patch
$ find ../src -iname "*.yaml" -exec mv {} /tmp/patch \;
$ clang-apply-replacements /tmp/patch
Diffstat (limited to 'src/soundio')
-rw-r--r-- | src/soundio/sounddevicenotfound.h | 2 | ||||
-rw-r--r-- | src/soundio/soundmanager.cpp | 10 | ||||
-rw-r--r-- | src/soundio/soundmanager.h | 14 | ||||
-rw-r--r-- | src/soundio/soundmanagerutil.h | 35 |
4 files changed, 35 insertions, 26 deletions
diff --git a/src/soundio/sounddevicenotfound.h b/src/soundio/sounddevicenotfound.h index 00677a4c2c..2e33dbf7f9 100644 --- a/src/soundio/sounddevicenotfound.h +++ b/src/soundio/sounddevicenotfound.h @@ -15,7 +15,7 @@ class EngineNetworkStream; class SoundDeviceNotFound : public SoundDevice { public: - SoundDeviceNotFound(QString name) + SoundDeviceNotFound(const QString& name) : SoundDevice(UserSettingsPointer(), nullptr) { m_deviceId.name = name; m_strDisplayName = name; diff --git a/src/soundio/soundmanager.cpp b/src/soundio/soundmanager.cpp index 93a21ee1b6..e5c69268d9 100644 --- a/src/soundio/soundmanager.cpp +++ b/src/soundio/soundmanager.cpp @@ -118,7 +118,7 @@ SoundManager::~SoundManager() { } QList<SoundDevicePointer> SoundManager::getDeviceList( - QString filterAPI, bool bOutputDevices, bool bInputDevices) const { + const QString& filterAPI, bool bOutputDevices, bool bInputDevices) const { //qDebug() << "SoundManager::getDeviceList"; if (filterAPI == "None") { @@ -232,7 +232,7 @@ void SoundManager::clearDeviceList(bool sleepAfterClosing) { } } -QList<unsigned int> SoundManager::getSampleRates(QString api) const { +QList<unsigned int> SoundManager::getSampleRates(const QString& api) const { if (api == MIXXX_PORTAUDIO_JACK_STRING) { // queryDevices must have been called for this to work, but the // ctor calls it -bkgood @@ -558,7 +558,7 @@ SoundManagerConfig SoundManager::getConfig() const { return m_config; } -SoundDeviceError SoundManager::setConfig(SoundManagerConfig config) { +SoundDeviceError SoundManager::setConfig(const SoundManagerConfig& config) { SoundDeviceError err = SOUNDDEVICE_ERROR_OK; m_config = config; checkConfig(); @@ -633,7 +633,7 @@ void SoundManager::readProcess() const { } } -void SoundManager::registerOutput(AudioOutput output, AudioSource *src) { +void SoundManager::registerOutput(const AudioOutput& output, AudioSource* src) { if (m_registeredSources.contains(output)) { qDebug() << "WARNING: AudioOutput already registered!"; } @@ -641,7 +641,7 @@ void SoundManager::registerOutput(AudioOutput output, AudioSource *src) { emit outputRegistered(output, src); } -void SoundManager::registerInput(AudioInput input, AudioDestination *dest) { +void SoundManager::registerInput(const AudioInput& input, AudioDestination* dest) { if (m_registeredDestinations.contains(input)) { // note that this can be totally ok if we just want a certain // AudioInput to be going to a different AudioDest -bkgood diff --git a/src/soundio/soundmanager.h b/src/soundio/soundmanager.h index 2009bfc817..1487984773 100644 --- a/src/soundio/soundmanager.h +++ b/src/soundio/soundmanager.h @@ -46,7 +46,7 @@ class SoundManager : public QObject { // filterApi, and have at least one output or input channel if the // bOutputDevices or bInputDevices are set, respectively. QList<SoundDevicePointer> getDeviceList( - QString filterAPI, bool bOutputDevices, bool bInputDevices) const; + const QString& filterAPI, bool bOutputDevices, bool bInputDevices) const; // Creates a list of sound devices void clearAndQueryDevices(); @@ -67,7 +67,7 @@ class SoundManager : public QObject { QString getLastErrorMessage(SoundDeviceError err) const; // Returns a list of samplerates we will attempt to support for a given API. - QList<unsigned int> getSampleRates(QString api) const; + QList<unsigned int> getSampleRates(const QString& api) const; // Convenience overload for SoundManager::getSampleRates(QString) QList<unsigned int> getSampleRates() const; @@ -75,7 +75,7 @@ class SoundManager : public QObject { // Get a list of host APIs supported by PortAudio. QList<QString> getHostAPIList() const; SoundManagerConfig getConfig() const; - SoundDeviceError setConfig(SoundManagerConfig config); + SoundDeviceError setConfig(const SoundManagerConfig& config); void checkConfig(); void onDeviceOutputCallback(const SINT iFramesPerBuffer); @@ -89,8 +89,8 @@ class SoundManager : public QObject { void writeProcess() const; void readProcess() const; - void registerOutput(AudioOutput output, AudioSource *src); - void registerInput(AudioInput input, AudioDestination *dest); + void registerOutput(const AudioOutput& output, AudioSource* src); + void registerInput(const AudioInput& input, AudioDestination* dest); QList<AudioOutput> registeredOutputs() const; QList<AudioInput> registeredInputs() const; @@ -112,8 +112,8 @@ class SoundManager : public QObject { signals: void devicesUpdated(); // emitted when pointers to SoundDevices go stale void devicesSetup(); // emitted when the sound devices have been set up - void outputRegistered(AudioOutput output, AudioSource *src); - void inputRegistered(AudioInput input, AudioDestination *dest); + void outputRegistered(const AudioOutput& output, AudioSource* src); + void inputRegistered(const AudioInput& input, AudioDestination* dest); private: // Closes all the devices and empties the list of devices we have. diff --git a/src/soundio/soundmanagerutil.h b/src/soundio/soundmanagerutil.h index 9a7f1a1e2a..ccc3412025 100644 --- a/src/soundio/soundmanagerutil.h +++ b/src/soundio/soundmanagerutil.h @@ -164,17 +164,21 @@ class AudioInputBuffer : public AudioInput { class AudioSource { public: - virtual const CSAMPLE* buffer(AudioOutput output) const = 0; + virtual const CSAMPLE* buffer(const AudioOutput& output) const = 0; - // This is called by SoundManager whenever an output is connected for this - // source. When this is called it is guaranteed that no callback is - // active. - virtual void onOutputConnected(AudioOutput output) { Q_UNUSED(output); }; + // This is called by SoundManager whenever an output is connected for this + // source. When this is called it is guaranteed that no callback is + // active. + virtual void onOutputConnected(const AudioOutput& output) { + Q_UNUSED(output); + }; // This is called by SoundManager whenever an output is disconnected for // this source. When this is called it is guaranteed that no callback is // active. - virtual void onOutputDisconnected(AudioOutput output) { Q_UNUSED(output); }; + virtual void onOutputDisconnected(const AudioOutput& output) { + Q_UNUSED(output); + }; }; class AudioDestination { @@ -182,18 +186,23 @@ public: // This is called by SoundManager whenever there are new samples from the // configured input to be processed. This is run in the clock reference // callback thread - virtual void receiveBuffer(AudioInput input, const CSAMPLE* pBuffer, - unsigned int iNumFrames) = 0; + virtual void receiveBuffer(const AudioInput& input, + const CSAMPLE* pBuffer, + unsigned int iNumFrames) = 0; - // This is called by SoundManager whenever an input is configured for this - // destination. When this is called it is guaranteed that no callback is - // active. - virtual void onInputConfigured(AudioInput input) { Q_UNUSED(input); }; + // This is called by SoundManager whenever an input is configured for this + // destination. When this is called it is guaranteed that no callback is + // active. + virtual void onInputConfigured(const AudioInput& input) { + Q_UNUSED(input); + }; // This is called by SoundManager whenever an input is unconfigured for this // destination. When this is called it is guaranteed that no callback is // active. - virtual void onInputUnconfigured(AudioInput input) { Q_UNUSED(input); }; + virtual void onInputUnconfigured(const AudioInput& input) { + Q_UNUSED(input); + }; }; typedef AudioPath::AudioPathType AudioPathType; |