2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
ToneGen.h
|
|
|
|
|
|
|
|
Steve Jolly
|
|
|
|
|
|
|
|
This class implements a tone generator effect.
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_EFFECT_TONEGEN__
|
|
|
|
#define __AUDACITY_EFFECT_TONEGEN__
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include <wx/arrstr.h>
|
|
|
|
#include <wx/string.h>
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include "../widgets/NumericTextCtrl.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include "Effect.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-06-18 14:24:36 +00:00
|
|
|
class ShuttleGui;
|
|
|
|
|
2015-04-19 03:49:05 +00:00
|
|
|
#define CHIRP_PLUGIN_SYMBOL XO("Chirp")
|
|
|
|
#define TONE_PLUGIN_SYMBOL XO("Tone")
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-24 06:06:39 +00:00
|
|
|
class EffectToneGen final : public Effect
|
2015-04-17 03:53:42 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
EffectToneGen(bool isChirp);
|
|
|
|
virtual ~EffectToneGen();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// IdentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
wxString GetSymbol() override;
|
|
|
|
wxString GetDescription() override;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectIdentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
EffectType GetType() override;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectClientInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-09-02 19:53:09 +00:00
|
|
|
unsigned GetAudioOutCount() override;
|
2016-02-24 06:06:47 +00:00
|
|
|
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
|
2016-09-06 13:19:27 +00:00
|
|
|
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
|
2016-02-24 06:06:47 +00:00
|
|
|
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
|
|
|
|
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// Effect implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void PopulateOrExchange(ShuttleGui & S);
|
|
|
|
bool TransferDataFromWindow();
|
|
|
|
bool TransferDataToWindow();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
private:
|
|
|
|
// EffectToneGen implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void OnControlUpdate(wxCommandEvent & evt);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
private:
|
|
|
|
bool mChirp;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
// mSample is an external placeholder to remember the last "buffer"
|
|
|
|
// position so we use it to reinitialize from where we left
|
2011-04-25 00:37:15 +00:00
|
|
|
sampleCount mSample;
|
2015-04-17 03:53:42 +00:00
|
|
|
double mPositionInCycles;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// If we made these static variables,
|
|
|
|
// Tone and Chirp would share the same parameters.
|
|
|
|
int mWaveform;
|
|
|
|
int mInterpolation;
|
|
|
|
double mFrequency[2];
|
|
|
|
double mAmplitude[2];
|
|
|
|
double mLogFrequency[2];
|
|
|
|
|
|
|
|
wxArrayString mWaveforms;
|
|
|
|
wxArrayString mInterpolations;
|
2014-11-08 15:18:43 +00:00
|
|
|
NumericTextCtrl *mToneDurationT;
|
2015-04-17 03:53:42 +00:00
|
|
|
|
2016-09-18 14:26:29 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2010-01-23 19:44:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|