From 83e01fb43bdf0c49de9955335ea5f6c105f5f7c3 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Mon, 23 Jul 2018 14:27:44 -0400 Subject: [PATCH] Remove 8 warnings about re-#define-d names, related to SoundTouch --- src/effects/ChangePitch.cpp | 16 +++++++++++++++- src/effects/ChangeTempo.cpp | 16 +++++++++++++++- src/effects/SoundTouchEffect.cpp | 25 +++++++++++++++++++++++++ src/effects/SoundTouchEffect.h | 19 +++++++------------ 4 files changed, 62 insertions(+), 14 deletions(-) diff --git a/src/effects/ChangePitch.cpp b/src/effects/ChangePitch.cpp index 651baee3d..9a3df3978 100644 --- a/src/effects/ChangePitch.cpp +++ b/src/effects/ChangePitch.cpp @@ -37,6 +37,20 @@ the pitch without changing the tempo. #include "../widgets/valnum.h" #include "TimeWarper.h" +// Soundtouch defines these as well, which are also in generated configmac.h +// and configunix.h, so get rid of them before including, +// to avoid compiler warnings, and be sure to do this +// after all other #includes, to avoid any mischief that might result +// from doing the un-definitions before seeing any wx headers. +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef PACKAGE_BUGREPORT +#undef PACKAGE +#undef VERSION +#include "SoundTouch.h" + enum { ID_PercentChange = 10000, ID_FromPitch, @@ -201,7 +215,7 @@ bool EffectChangePitch::Process() else #endif { - mSoundTouch = std::make_unique(); + mSoundTouch = std::make_unique(); IdentityTimeWarper warper; mSoundTouch->setPitchSemiTones((float)(m_dSemitonesChange)); #ifdef USE_MIDI diff --git a/src/effects/ChangeTempo.cpp b/src/effects/ChangeTempo.cpp index cac09cd4a..bd1647ad9 100644 --- a/src/effects/ChangeTempo.cpp +++ b/src/effects/ChangeTempo.cpp @@ -34,6 +34,20 @@ #include "ChangeTempo.h" +// Soundtouch defines these as well, which are also in generated configmac.h +// and configunix.h, so get rid of them before including, +// to avoid compiler warnings, and be sure to do this +// after all other #includes, to avoid any mischief that might result +// from doing the un-definitions before seeing any wx headers. +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef PACKAGE_BUGREPORT +#undef PACKAGE +#undef VERSION +#include "SoundTouch.h" + enum { ID_PercentChange = 10000, @@ -189,7 +203,7 @@ bool EffectChangeTempo::Process() else #endif { - mSoundTouch = std::make_unique(); + mSoundTouch = std::make_unique(); mSoundTouch->setTempoChange(m_PercentChange); double mT1Dashed = mT0 + (mT1 - mT0)/(m_PercentChange/100.0 + 1.0); RegionTimeWarper warper{ mT0, mT1, diff --git a/src/effects/SoundTouchEffect.cpp b/src/effects/SoundTouchEffect.cpp index b56de741c..d57f39cf5 100644 --- a/src/effects/SoundTouchEffect.cpp +++ b/src/effects/SoundTouchEffect.cpp @@ -25,6 +25,31 @@ effect that uses SoundTouch to do its processing (ChangeTempo #include "TimeWarper.h" #include "../NoteTrack.h" +// Soundtouch defines these as well, which are also in generated configmac.h +// and configunix.h, so get rid of them before including, +// to avoid compiler warnings, and be sure to do this +// after all other #includes, to avoid any mischief that might result +// from doing the un-definitions before seeing any wx headers. +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef PACKAGE_BUGREPORT +#undef PACKAGE +#undef VERSION +#include "SoundTouch.h" + +#ifdef USE_MIDI +EffectSoundTouch::EffectSoundTouch() +{ + mSemitones = 0; +} +#endif + +EffectSoundTouch::~EffectSoundTouch() +{ +} + bool EffectSoundTouch::ProcessLabelTrack( LabelTrack *lt, const TimeWarper &warper) { diff --git a/src/effects/SoundTouchEffect.h b/src/effects/SoundTouchEffect.h index 7588766cf..abbcabd90 100644 --- a/src/effects/SoundTouchEffect.h +++ b/src/effects/SoundTouchEffect.h @@ -21,15 +21,9 @@ #include "Effect.h" -// Soundtouch defines these as well, so get rid of them before including -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION -#undef PACKAGE_BUGREPORT -#include "SoundTouch.h" - -using namespace soundtouch; +// forward declaration of a class defined in SoundTouch.h +// which is not included here +namespace soundtouch { class SoundTouch; } class TimeWarper; @@ -38,7 +32,7 @@ class WaveTrack; class EffectSoundTouch /* not final */ : public Effect { public: - + // Effect implementation void End() override; @@ -47,15 +41,16 @@ public: #ifdef USE_MIDI double mSemitones; // pitch change for NoteTracks - EffectSoundTouch() { mSemitones = 0; } + EffectSoundTouch(); #endif + ~EffectSoundTouch() override; protected: // Effect implementation bool ProcessWithTimeWarper(const TimeWarper &warper); - std::unique_ptr mSoundTouch; + std::unique_ptr mSoundTouch; double mCurT0; double mCurT1;