1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-07 15:49:42 +02:00

Remove 8 warnings about re-#define-d names, related to SoundTouch

This commit is contained in:
Paul Licameli 2018-07-23 14:27:44 -04:00
parent e432883dec
commit 83e01fb43b
4 changed files with 62 additions and 14 deletions

View File

@ -37,6 +37,20 @@ the pitch without changing the tempo.
#include "../widgets/valnum.h" #include "../widgets/valnum.h"
#include "TimeWarper.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 { enum {
ID_PercentChange = 10000, ID_PercentChange = 10000,
ID_FromPitch, ID_FromPitch,
@ -201,7 +215,7 @@ bool EffectChangePitch::Process()
else else
#endif #endif
{ {
mSoundTouch = std::make_unique<SoundTouch>(); mSoundTouch = std::make_unique<soundtouch::SoundTouch>();
IdentityTimeWarper warper; IdentityTimeWarper warper;
mSoundTouch->setPitchSemiTones((float)(m_dSemitonesChange)); mSoundTouch->setPitchSemiTones((float)(m_dSemitonesChange));
#ifdef USE_MIDI #ifdef USE_MIDI

View File

@ -34,6 +34,20 @@
#include "ChangeTempo.h" #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 enum
{ {
ID_PercentChange = 10000, ID_PercentChange = 10000,
@ -189,7 +203,7 @@ bool EffectChangeTempo::Process()
else else
#endif #endif
{ {
mSoundTouch = std::make_unique<SoundTouch>(); mSoundTouch = std::make_unique<soundtouch::SoundTouch>();
mSoundTouch->setTempoChange(m_PercentChange); mSoundTouch->setTempoChange(m_PercentChange);
double mT1Dashed = mT0 + (mT1 - mT0)/(m_PercentChange/100.0 + 1.0); double mT1Dashed = mT0 + (mT1 - mT0)/(m_PercentChange/100.0 + 1.0);
RegionTimeWarper warper{ mT0, mT1, RegionTimeWarper warper{ mT0, mT1,

View File

@ -25,6 +25,31 @@ effect that uses SoundTouch to do its processing (ChangeTempo
#include "TimeWarper.h" #include "TimeWarper.h"
#include "../NoteTrack.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( bool EffectSoundTouch::ProcessLabelTrack(
LabelTrack *lt, const TimeWarper &warper) LabelTrack *lt, const TimeWarper &warper)
{ {

View File

@ -21,15 +21,9 @@
#include "Effect.h" #include "Effect.h"
// Soundtouch defines these as well, so get rid of them before including // forward declaration of a class defined in SoundTouch.h
#undef PACKAGE_NAME // which is not included here
#undef PACKAGE_STRING namespace soundtouch { class SoundTouch; }
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef PACKAGE_BUGREPORT
#include "SoundTouch.h"
using namespace soundtouch;
class TimeWarper; class TimeWarper;
@ -38,7 +32,7 @@ class WaveTrack;
class EffectSoundTouch /* not final */ : public Effect class EffectSoundTouch /* not final */ : public Effect
{ {
public: public:
// Effect implementation // Effect implementation
void End() override; void End() override;
@ -47,15 +41,16 @@ public:
#ifdef USE_MIDI #ifdef USE_MIDI
double mSemitones; // pitch change for NoteTracks double mSemitones; // pitch change for NoteTracks
EffectSoundTouch() { mSemitones = 0; } EffectSoundTouch();
#endif #endif
~EffectSoundTouch() override;
protected: protected:
// Effect implementation // Effect implementation
bool ProcessWithTimeWarper(const TimeWarper &warper); bool ProcessWithTimeWarper(const TimeWarper &warper);
std::unique_ptr<SoundTouch> mSoundTouch; std::unique_ptr<soundtouch::SoundTouch> mSoundTouch;
double mCurT0; double mCurT0;
double mCurT1; double mCurT1;