From 46e58da27c880970230838048c29bf25290dc504 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 3 Mar 2020 12:49:36 -0800 Subject: [PATCH] Minor code review --- Audio/DynamicSoundEffectInstance.cpp | 18 +++++++------- Audio/SoundEffect.cpp | 18 +++++++------- Audio/SoundEffectInstance.cpp | 18 +++++++------- Audio/WaveBank.cpp | 18 +++++++------- Inc/Effects.h | 36 ++++++++++++++-------------- Inc/PostProcess.h | 6 ++--- Src/PlatformHelpers.h | 2 +- 7 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Audio/DynamicSoundEffectInstance.cpp b/Audio/DynamicSoundEffectInstance.cpp index e1309f1..1454c64 100644 --- a/Audio/DynamicSoundEffectInstance.cpp +++ b/Audio/DynamicSoundEffectInstance.cpp @@ -69,7 +69,7 @@ public: mBufferNeeded = bufferNeeded; } - virtual ~Impl() override + ~Impl() override { mBase.DestroyVoice(); @@ -89,39 +89,39 @@ public: const WAVEFORMATEX* GetFormat() const noexcept { return &mWaveFormat; } // IVoiceNotify - virtual void __cdecl OnBufferEnd() override + void __cdecl OnBufferEnd() override { SetEvent(mBufferEvent.get()); } - virtual void __cdecl OnCriticalError() override + void __cdecl OnCriticalError() override { mBase.OnCriticalError(); } - virtual void __cdecl OnReset() override + void __cdecl OnReset() override { mBase.OnReset(); } - virtual void __cdecl OnUpdate() override; + void __cdecl OnUpdate() override; - virtual void __cdecl OnDestroyEngine() noexcept override + void __cdecl OnDestroyEngine() noexcept override { mBase.OnDestroy(); } - virtual void __cdecl OnTrim() override + void __cdecl OnTrim() override { mBase.OnTrim(); } - virtual void __cdecl GatherStatistics(AudioStatistics& stats) const noexcept override + void __cdecl GatherStatistics(AudioStatistics& stats) const noexcept override { mBase.GatherStatistics(stats); } - virtual void __cdecl OnDestroyParent() noexcept override + void __cdecl OnDestroyParent() noexcept override { } diff --git a/Audio/SoundEffect.cpp b/Audio/SoundEffect.cpp index bdf35cc..04107b9 100644 --- a/Audio/SoundEffect.cpp +++ b/Audio/SoundEffect.cpp @@ -50,7 +50,7 @@ public: mEngine->RegisterNotify(this, false); } - virtual ~Impl() override + ~Impl() override { if (!mInstances.empty()) { @@ -95,39 +95,39 @@ public: void Play(float volume, float pitch, float pan); // IVoiceNotify - virtual void __cdecl OnBufferEnd() override + void __cdecl OnBufferEnd() override { InterlockedDecrement(&mOneShots); } - virtual void __cdecl OnCriticalError() override + void __cdecl OnCriticalError() override { mOneShots = 0; } - virtual void __cdecl OnReset() override + void __cdecl OnReset() override { // No action required } - virtual void __cdecl OnUpdate() override + void __cdecl OnUpdate() override { // We do not register for update notification assert(false); } - virtual void __cdecl OnDestroyEngine() noexcept override + void __cdecl OnDestroyEngine() noexcept override { mEngine = nullptr; mOneShots = 0; } - virtual void __cdecl OnTrim() override + void __cdecl OnTrim() override { // No action required } - virtual void __cdecl GatherStatistics(AudioStatistics& stats) const noexcept override + void __cdecl GatherStatistics(AudioStatistics& stats) const noexcept override { stats.playingOneShots += mOneShots; stats.audioBytes += mAudioBytes; @@ -138,7 +138,7 @@ public: #endif } - virtual void __cdecl OnDestroyParent() noexcept override + void __cdecl OnDestroyParent() noexcept override { } diff --git a/Audio/SoundEffectInstance.cpp b/Audio/SoundEffectInstance.cpp index e36b513..fd489c1 100644 --- a/Audio/SoundEffectInstance.cpp +++ b/Audio/SoundEffectInstance.cpp @@ -52,7 +52,7 @@ public: mBase.Initialize(engine, mWaveBank->GetFormat(index, wfx, sizeof(buff)), flags); } - virtual ~Impl() override + ~Impl() override { mBase.DestroyVoice(); @@ -66,44 +66,44 @@ public: void Play(bool loop); // IVoiceNotify - virtual void __cdecl OnBufferEnd() override + void __cdecl OnBufferEnd() override { // We don't register for this notification for SoundEffectInstances, so this should not be invoked assert(false); } - virtual void __cdecl OnCriticalError() override + void __cdecl OnCriticalError() override { mBase.OnCriticalError(); } - virtual void __cdecl OnReset() override + void __cdecl OnReset() override { mBase.OnReset(); } - virtual void __cdecl OnUpdate() override + void __cdecl OnUpdate() override { // We do not register for update notification assert(false); } - virtual void __cdecl OnDestroyEngine() noexcept override + void __cdecl OnDestroyEngine() noexcept override { mBase.OnDestroy(); } - virtual void __cdecl OnTrim() override + void __cdecl OnTrim() override { mBase.OnTrim(); } - virtual void __cdecl GatherStatistics(AudioStatistics& stats) const noexcept override + void __cdecl GatherStatistics(AudioStatistics& stats) const noexcept override { mBase.GatherStatistics(stats); } - virtual void __cdecl OnDestroyParent() noexcept override + void __cdecl OnDestroyParent() noexcept override { mBase.OnDestroy(); mWaveBank = nullptr; diff --git a/Audio/WaveBank.cpp b/Audio/WaveBank.cpp index 970dd89..b3483f6 100644 --- a/Audio/WaveBank.cpp +++ b/Audio/WaveBank.cpp @@ -37,7 +37,7 @@ public: mEngine->RegisterNotify(this, false); } - virtual ~Impl() override + ~Impl() override { if (!mInstances.empty()) { @@ -71,39 +71,39 @@ public: void Play(unsigned int index, float volume, float pitch, float pan); // IVoiceNotify - virtual void __cdecl OnBufferEnd() override + void __cdecl OnBufferEnd() override { InterlockedDecrement(&mOneShots); } - virtual void __cdecl OnCriticalError() override + void __cdecl OnCriticalError() override { mOneShots = 0; } - virtual void __cdecl OnReset() override + void __cdecl OnReset() override { // No action required } - virtual void __cdecl OnUpdate() override + void __cdecl OnUpdate() override { // We do not register for update notification assert(false); } - virtual void __cdecl OnDestroyEngine() noexcept override + void __cdecl OnDestroyEngine() noexcept override { mEngine = nullptr; mOneShots = 0; } - virtual void __cdecl OnTrim() override + void __cdecl OnTrim() override { // No action required } - virtual void __cdecl GatherStatistics(AudioStatistics& stats) const noexcept override + void __cdecl GatherStatistics(AudioStatistics& stats) const noexcept override { stats.playingOneShots += mOneShots; @@ -118,7 +118,7 @@ public: } } - virtual void __cdecl OnDestroyParent() noexcept override + void __cdecl OnDestroyParent() noexcept override { } diff --git a/Inc/Effects.h b/Inc/Effects.h index c6413c4..98f8db7 100644 --- a/Inc/Effects.h +++ b/Inc/Effects.h @@ -151,7 +151,7 @@ namespace DirectX BasicEffect(BasicEffect const&) = delete; BasicEffect& operator= (BasicEffect const&) = delete; - virtual ~BasicEffect() override; + ~BasicEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; @@ -221,7 +221,7 @@ namespace DirectX AlphaTestEffect(AlphaTestEffect const&) = delete; AlphaTestEffect& operator= (AlphaTestEffect const&) = delete; - virtual ~AlphaTestEffect() override; + ~AlphaTestEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; @@ -275,7 +275,7 @@ namespace DirectX DualTextureEffect(DualTextureEffect const&) = delete; DualTextureEffect& operator= (DualTextureEffect const&) = delete; - virtual ~DualTextureEffect() override; + ~DualTextureEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; @@ -326,7 +326,7 @@ namespace DirectX EnvironmentMapEffect(EnvironmentMapEffect const&) = delete; EnvironmentMapEffect& operator= (EnvironmentMapEffect const&) = delete; - virtual ~EnvironmentMapEffect() override; + ~EnvironmentMapEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; @@ -397,7 +397,7 @@ namespace DirectX SkinnedEffect(SkinnedEffect const&) = delete; SkinnedEffect& operator= (SkinnedEffect const&) = delete; - virtual ~SkinnedEffect() override; + ~SkinnedEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; @@ -470,7 +470,7 @@ namespace DirectX DGSLEffect(DGSLEffect const&) = delete; DGSLEffect& operator= (DGSLEffect const&) = delete; - virtual ~DGSLEffect() override; + ~DGSLEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; @@ -549,7 +549,7 @@ namespace DirectX NormalMapEffect(NormalMapEffect const&) = delete; NormalMapEffect& operator= (NormalMapEffect const&) = delete; - virtual ~NormalMapEffect() override; + ~NormalMapEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; @@ -621,7 +621,7 @@ namespace DirectX PBREffect(PBREffect const&) = delete; PBREffect& operator= (PBREffect const&) = delete; - virtual ~PBREffect() override; + ~PBREffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; @@ -706,7 +706,7 @@ namespace DirectX DebugEffect(DebugEffect const&) = delete; DebugEffect& operator= (DebugEffect const&) = delete; - virtual ~DebugEffect() override; + ~DebugEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D11DeviceContext* deviceContext) override; @@ -809,11 +809,11 @@ namespace DirectX EffectFactory(EffectFactory const&) = delete; EffectFactory& operator= (EffectFactory const&) = delete; - virtual ~EffectFactory() override; + ~EffectFactory() override; // IEffectFactory methods. - virtual std::shared_ptr __cdecl CreateEffect(_In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext) override; - virtual void __cdecl CreateTexture(_In_z_ const wchar_t* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView) override; + std::shared_ptr __cdecl CreateEffect(_In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext) override; + void __cdecl CreateTexture(_In_z_ const wchar_t* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView) override; // Settings. void __cdecl ReleaseCache(); @@ -847,11 +847,11 @@ namespace DirectX PBREffectFactory(PBREffectFactory const&) = delete; PBREffectFactory& operator= (PBREffectFactory const&) = delete; - virtual ~PBREffectFactory() override; + ~PBREffectFactory() override; // IEffectFactory methods. - virtual std::shared_ptr __cdecl CreateEffect(_In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext) override; - virtual void __cdecl CreateTexture(_In_z_ const wchar_t* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView) override; + std::shared_ptr __cdecl CreateEffect(_In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext) override; + void __cdecl CreateTexture(_In_z_ const wchar_t* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView) override; // Settings. void __cdecl ReleaseCache(); @@ -884,11 +884,11 @@ namespace DirectX DGSLEffectFactory(DGSLEffectFactory const&) = delete; DGSLEffectFactory& operator= (DGSLEffectFactory const&) = delete; - virtual ~DGSLEffectFactory() override; + ~DGSLEffectFactory() override; // IEffectFactory methods. - virtual std::shared_ptr __cdecl CreateEffect(_In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext) override; - virtual void __cdecl CreateTexture(_In_z_ const wchar_t* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView) override; + std::shared_ptr __cdecl CreateEffect(_In_ const EffectInfo& info, _In_opt_ ID3D11DeviceContext* deviceContext) override; + void __cdecl CreateTexture(_In_z_ const wchar_t* name, _In_opt_ ID3D11DeviceContext* deviceContext, _Outptr_ ID3D11ShaderResourceView** textureView) override; // DGSL methods. struct DGSLEffectInfo : public EffectInfo diff --git a/Inc/PostProcess.h b/Inc/PostProcess.h index 73c6391..e26346f 100644 --- a/Inc/PostProcess.h +++ b/Inc/PostProcess.h @@ -67,7 +67,7 @@ namespace DirectX BasicPostProcess(BasicPostProcess const&) = delete; BasicPostProcess& operator= (BasicPostProcess const&) = delete; - virtual ~BasicPostProcess() override; + ~BasicPostProcess() override; // IPostProcess methods. void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; @@ -114,7 +114,7 @@ namespace DirectX DualPostProcess(DualPostProcess const&) = delete; DualPostProcess& operator= (DualPostProcess const&) = delete; - virtual ~DualPostProcess() override; + ~DualPostProcess() override; // IPostProcess methods. void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; @@ -169,7 +169,7 @@ namespace DirectX ToneMapPostProcess(ToneMapPostProcess const&) = delete; ToneMapPostProcess& operator= (ToneMapPostProcess const&) = delete; - virtual ~ToneMapPostProcess() override; + ~ToneMapPostProcess() override; // IPostProcess methods. void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; diff --git a/Src/PlatformHelpers.h b/Src/PlatformHelpers.h index 43d9e09..d9655ad 100644 --- a/Src/PlatformHelpers.h +++ b/Src/PlatformHelpers.h @@ -31,7 +31,7 @@ namespace DirectX public: com_exception(HRESULT hr) noexcept : result(hr) {} - virtual const char* what() const override + const char* what() const override { static char s_str[64] = {}; sprintf_s(s_str, "Failure with HRESULT of %08X", static_cast(result));