diff --git a/Source/Core/AudioCommon/AOSoundStream.h b/Source/Core/AudioCommon/AOSoundStream.h index 16dfcc1c59..fe9747599e 100644 --- a/Source/Core/AudioCommon/AOSoundStream.h +++ b/Source/Core/AudioCommon/AOSoundStream.h @@ -40,7 +40,8 @@ public: virtual void Stop() override; - static bool isValid() { + static bool isValid() + { return true; } diff --git a/Source/Core/AudioCommon/AlsaSoundStream.h b/Source/Core/AudioCommon/AlsaSoundStream.h index e57d11270e..b2a3fc4927 100644 --- a/Source/Core/AudioCommon/AlsaSoundStream.h +++ b/Source/Core/AudioCommon/AlsaSoundStream.h @@ -23,7 +23,8 @@ public: virtual void SoundLoop() override; virtual void Stop() override; - static bool isValid() { + static bool isValid() + { return true; } diff --git a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp index e311adc230..cfe6bc6e16 100644 --- a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp +++ b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp @@ -41,13 +41,15 @@ bool CoreAudioSound::Start() desc.componentFlagsMask = 0; desc.componentManufacturer = kAudioUnitManufacturer_Apple; component = FindNextComponent(nullptr, &desc); - if (component == nullptr) { + if (component == nullptr) + { ERROR_LOG(AUDIO, "error finding audio component"); return false; } err = OpenAComponent(component, &audioUnit); - if (err != noErr) { + if (err != noErr) + { ERROR_LOG(AUDIO, "error opening audio component"); return false; } @@ -58,7 +60,8 @@ bool CoreAudioSound::Start() kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &format, sizeof(AudioStreamBasicDescription)); - if (err != noErr) { + if (err != noErr) + { ERROR_LOG(AUDIO, "error setting audio format"); return false; } @@ -69,12 +72,13 @@ bool CoreAudioSound::Start() kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &callback_struct, sizeof callback_struct); - if (err != noErr) { + if (err != noErr) + { ERROR_LOG(AUDIO, "error setting audio callback"); return false; } - err = AudioUnitSetParameter(audioUnit, + err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, kAudioUnitParameterFlag_Output, 0, m_volume / 100., 0); @@ -82,13 +86,15 @@ bool CoreAudioSound::Start() ERROR_LOG(AUDIO, "error setting volume"); err = AudioUnitInitialize(audioUnit); - if (err != noErr) { + if (err != noErr) + { ERROR_LOG(AUDIO, "error initializing audiounit"); return false; } err = AudioOutputUnitStart(audioUnit); - if (err != noErr) { + if (err != noErr) + { ERROR_LOG(AUDIO, "error starting audiounit"); return false; } @@ -99,7 +105,7 @@ bool CoreAudioSound::Start() void CoreAudioSound::SetVolume(int volume) { OSStatus err; - m_volume = volume; + m_volume = volume; err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, diff --git a/Source/Core/AudioCommon/CoreAudioSoundStream.h b/Source/Core/AudioCommon/CoreAudioSoundStream.h index c4d8ab7c14..1bd1e8b608 100644 --- a/Source/Core/AudioCommon/CoreAudioSoundStream.h +++ b/Source/Core/AudioCommon/CoreAudioSoundStream.h @@ -22,7 +22,8 @@ public: virtual void SoundLoop(); virtual void Stop(); - static bool isValid() { + static bool isValid() + { return true; } diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 080dc40005..70accf240f 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -57,7 +57,8 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo s32 rvolume = m_RVolume; // TODO: consider a higher-quality resampling algorithm. - for (; currentSample < numSamples*2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample+=2) { + for (; currentSample < numSamples*2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample+=2) + { u32 indexR2 = indexR + 2; //next sample s16 l1 = Common::swap16(m_buffer[indexR & INDEX_MASK]); //current diff --git a/Source/Core/AudioCommon/OpenSLESStream.cpp b/Source/Core/AudioCommon/OpenSLESStream.cpp index a3fefebb4c..996b7ae21a 100644 --- a/Source/Core/AudioCommon/OpenSLESStream.cpp +++ b/Source/Core/AudioCommon/OpenSLESStream.cpp @@ -30,7 +30,8 @@ static CMixer *g_mixer; static short buffer[2][BUFFER_SIZE]; static int curBuffer = 0; -static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) { +static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) +{ assert(bq == bqPlayerBufferQueue); assert(nullptr == context); @@ -49,6 +50,7 @@ static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) { // Render to the fresh buffer g_mixer->Mix(reinterpret_cast(buffer[curBuffer]), BUFFER_SIZE_IN_SAMPLES); } + bool OpenSLESStream::Start() { SLresult result; @@ -103,9 +105,11 @@ bool OpenSLESStream::Start() curBuffer = 0; result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[curBuffer])); - if (SL_RESULT_SUCCESS != result) { + if (SL_RESULT_SUCCESS != result) + { return false; } + curBuffer ^= 1; g_mixer = m_mixer; return true; @@ -113,7 +117,8 @@ bool OpenSLESStream::Start() void OpenSLESStream::Stop() { - if (bqPlayerObject != nullptr) { + if (bqPlayerObject != nullptr) + { (*bqPlayerObject)->Destroy(bqPlayerObject); bqPlayerObject = nullptr; bqPlayerPlay = nullptr; @@ -121,11 +126,15 @@ void OpenSLESStream::Stop() bqPlayerMuteSolo = nullptr; bqPlayerVolume = nullptr; } - if (outputMixObject != nullptr) { + + if (outputMixObject != nullptr) + { (*outputMixObject)->Destroy(outputMixObject); outputMixObject = nullptr; } - if (engineObject != nullptr) { + + if (engineObject != nullptr) + { (*engineObject)->Destroy(engineObject); engineObject = nullptr; engineEngine = nullptr; diff --git a/Source/Core/AudioCommon/PulseAudioStream.cpp b/Source/Core/AudioCommon/PulseAudioStream.cpp index 53bb36a58c..03aefe30f0 100644 --- a/Source/Core/AudioCommon/PulseAudioStream.cpp +++ b/Source/Core/AudioCommon/PulseAudioStream.cpp @@ -19,7 +19,8 @@ PulseAudio::PulseAudio(CMixer *mixer) : SoundStream(mixer) , m_thread() , m_run_thread() -{} +{ +} bool PulseAudio::Start() { diff --git a/Source/Core/AudioCommon/SoundStream.h b/Source/Core/AudioCommon/SoundStream.h index 0e4736de4f..fcf360f678 100644 --- a/Source/Core/AudioCommon/SoundStream.h +++ b/Source/Core/AudioCommon/SoundStream.h @@ -33,23 +33,32 @@ public: virtual void Update() {} virtual void Clear(bool mute) { m_muted = mute; } bool IsMuted() const { return m_muted; } - virtual void StartLogAudio(const char *filename) { - if (! m_logAudio) { + + virtual void StartLogAudio(const char *filename) + { + if (! m_logAudio) + { m_logAudio = true; g_wave_writer.Start(filename, m_mixer->GetSampleRate()); g_wave_writer.SetSkipSilence(false); NOTICE_LOG(DSPHLE, "Starting Audio logging"); - } else { + } + else + { WARN_LOG(DSPHLE, "Audio logging already started"); } } - virtual void StopLogAudio() { - if (m_logAudio) { + virtual void StopLogAudio() + { + if (m_logAudio) + { m_logAudio = false; g_wave_writer.Stop(); NOTICE_LOG(DSPHLE, "Stopping Audio logging"); - } else { + } + else + { WARN_LOG(DSPHLE, "Audio logging already stopped"); } } diff --git a/Source/Core/AudioCommon/aldlist.cpp b/Source/Core/AudioCommon/aldlist.cpp index a849aeba68..0b75f8f5cd 100644 --- a/Source/Core/AudioCommon/aldlist.cpp +++ b/Source/Core/AudioCommon/aldlist.cpp @@ -137,8 +137,10 @@ ALDeviceList::ALDeviceList() */ ALDeviceList::~ALDeviceList() { - for (auto& di : vDeviceInfo) { - if (di.pvstrExtensions) { + for (auto& di : vDeviceInfo) + { + if (di.pvstrExtensions) + { di.pvstrExtensions->clear(); delete di.pvstrExtensions; } @@ -171,13 +173,13 @@ char * ALDeviceList::GetDeviceName(s32 index) */ void ALDeviceList::GetDeviceVersion(s32 index, s32 *major, s32 *minor) { - if (index < GetNumDevices()) { + if (index < GetNumDevices()) + { if (major) *major = vDeviceInfo[index].iMajorVersion; if (minor) *minor = vDeviceInfo[index].iMinorVersion; } - return; } /* @@ -198,9 +200,12 @@ bool ALDeviceList::IsExtensionSupported(s32 index, char *szExtName) { bool bReturn = false; - if (index < GetNumDevices()) { - for (auto& ext : *vDeviceInfo[index].pvstrExtensions) { - if (!strcasecmp(ext.c_str(), szExtName)) { + if (index < GetNumDevices()) + { + for (auto& ext : *vDeviceInfo[index].pvstrExtensions) + { + if (!strcasecmp(ext.c_str(), szExtName)) + { bReturn = true; break; } @@ -224,9 +229,11 @@ s32 ALDeviceList::GetDefaultDevice() void ALDeviceList::FilterDevicesMinVer(s32 major, s32 minor) { s32 dMajor = 0, dMinor = 0; - for (u32 i = 0; i < vDeviceInfo.size(); i++) { + for (u32 i = 0; i < vDeviceInfo.size(); i++) + { GetDeviceVersion(i, &dMajor, &dMinor); - if ((dMajor < major) || ((dMajor == major) && (dMinor < minor))) { + if ((dMajor < major) || ((dMajor == major) && (dMinor < minor))) + { vDeviceInfo[i].bSelected = false; } } @@ -238,9 +245,11 @@ void ALDeviceList::FilterDevicesMinVer(s32 major, s32 minor) void ALDeviceList::FilterDevicesMaxVer(s32 major, s32 minor) { s32 dMajor = 0, dMinor = 0; - for (u32 i = 0; i < vDeviceInfo.size(); i++) { + for (u32 i = 0; i < vDeviceInfo.size(); i++) + { GetDeviceVersion(i, &dMajor, &dMinor); - if ((dMajor > major) || ((dMajor == major) && (dMinor > minor))) { + if ((dMajor > major) || ((dMajor == major) && (dMinor > minor))) + { vDeviceInfo[i].bSelected = false; } } @@ -253,14 +262,18 @@ void ALDeviceList::FilterDevicesExtension(char *szExtName) { bool bFound; - for (auto& di : vDeviceInfo) { + for (auto& di : vDeviceInfo) + { bFound = false; - for (auto& ext : *di.pvstrExtensions) { - if (!strcasecmp(ext.c_str(), szExtName)) { + for (auto& ext : *di.pvstrExtensions) + { + if (!strcasecmp(ext.c_str(), szExtName)) + { bFound = true; break; } } + if (!bFound) di.bSelected = false; } @@ -271,9 +284,11 @@ void ALDeviceList::FilterDevicesExtension(char *szExtName) */ void ALDeviceList::ResetFilters() { - for (s32 i = 0; i < GetNumDevices(); i++) { + for (s32 i = 0; i < GetNumDevices(); i++) + { vDeviceInfo[i].bSelected = true; } + filterIndex = 0; } @@ -284,11 +299,14 @@ s32 ALDeviceList::GetFirstFilteredDevice() { s32 i; - for (i = 0; i < GetNumDevices(); i++) { - if (vDeviceInfo[i].bSelected == true) { + for (i = 0; i < GetNumDevices(); i++) + { + if (vDeviceInfo[i].bSelected == true) + { break; } } + filterIndex = i + 1; return i; } @@ -300,11 +318,14 @@ s32 ALDeviceList::GetNextFilteredDevice() { s32 i; - for (i = filterIndex; i < GetNumDevices(); i++) { - if (vDeviceInfo[i].bSelected == true) { + for (i = filterIndex; i < GetNumDevices(); i++) + { + if (vDeviceInfo[i].bSelected == true) + { break; } } + filterIndex = i + 1; return i; }