Audacity  2.2.2
Fade.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Fade.cpp
6 
7  Robert Leidle
8 
9 *******************************************************************//*******************************************************************/
15 
16 #include "../Audacity.h"
17 
18 #include <wx/intl.h>
19 
20 #include "Fade.h"
21 
23 {
24  mFadeIn = fadeIn;
25 }
26 
28 {
29 }
30 
31 // IdentInterface implementation
32 
34 {
35  return mFadeIn
38 }
39 
41 {
42  return mFadeIn
43  ? _("Applies a linear fade-in to the selected audio")
44  : _("Applies a linear fade-out to the selected audio");
45 }
46 
47 // EffectIdentInterface implementation
48 
49 EffectType EffectFade::GetType()
50 {
51  return EffectTypeProcess;
52 }
53 
55 {
56  return false;
57 }
58 
59 // EffectClientInterface implementation
60 
62 {
63  return 1;
64 }
65 
67 {
68  return 1;
69 }
70 
71 bool EffectFade::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelNames WXUNUSED(chanMap))
72 {
73  mSample = 0;
74 
75  return true;
76 }
77 
78 size_t EffectFade::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
79 {
80  float *ibuf = inBlock[0];
81  float *obuf = outBlock[0];
82 
83  if (mFadeIn)
84  {
85  for (decltype(blockLen) i = 0; i < blockLen; i++)
86  {
87  obuf[i] =
88  (ibuf[i] * ( mSample++ ).as_float()) /
89  mSampleCnt.as_float();
90  }
91  }
92  else
93  {
94  for (decltype(blockLen) i = 0; i < blockLen; i++)
95  {
96  obuf[i] = (ibuf[i] *
97  ( mSampleCnt - 1 - mSample++ ).as_float()) /
98  mSampleCnt.as_float();
99  }
100  }
101 
102  return blockLen;
103 }
bool mFadeIn
Definition: Fade.h:47
sampleCount mSample
Definition: Fade.h:48
#define FADEOUT_PLUGIN_SYMBOL
Definition: Fade.h:19
wxString GetDescription() override
Definition: Fade.cpp:40
unsigned GetAudioOutCount() override
Definition: Fade.cpp:66
wxString GetSymbol() override
Definition: Fade.cpp:33
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override
Definition: Fade.cpp:78
bool IsInteractive() override
Definition: Fade.cpp:54
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap=NULL) override
Definition: Fade.cpp:71
unsigned GetAudioInCount() override
Definition: Fade.cpp:61
EffectType GetType() override
Definition: Fade.cpp:49
#define FADEIN_PLUGIN_SYMBOL
Definition: Fade.h:18
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
EffectFade(bool fadeIn=false)
Definition: Fade.cpp:22
sampleCount mSampleCnt
Definition: Effect.h:478
virtual ~EffectFade()
Definition: Fade.cpp:27