forked from audacity/audacity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvert.cpp
More file actions
84 lines (58 loc) · 1.46 KB
/
Copy pathInvert.cpp
File metadata and controls
84 lines (58 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**********************************************************************
Audacity: A Digital Audio Editor
Invert.cpp
Mark Phillips
*******************************************************************//**
\class EffectInvert
\brief An Effect that inverts the selected audio.
*//*******************************************************************/
#include "../Audacity.h"
#include "Invert.h"
#include <wx/intl.h>
#include "LoadEffects.h"
const ComponentInterfaceSymbol EffectInvert::Symbol
{ XO("Invert") };
namespace{ BuiltinEffectsModule::Registration< EffectInvert > reg; }
EffectInvert::EffectInvert()
{
}
EffectInvert::~EffectInvert()
{
}
// ComponentInterface implementation
ComponentInterfaceSymbol EffectInvert::GetSymbol()
{
return Symbol;
}
TranslatableString EffectInvert::GetDescription()
{
return XO("Flips the audio samples upside-down, reversing their polarity");
}
// EffectDefinitionInterface implementation
EffectType EffectInvert::GetType()
{
return EffectTypeProcess;
}
bool EffectInvert::IsInteractive()
{
return false;
}
// EffectClientInterface implementation
unsigned EffectInvert::GetAudioInCount()
{
return 1;
}
unsigned EffectInvert::GetAudioOutCount()
{
return 1;
}
size_t EffectInvert::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];
for (decltype(blockLen) i = 0; i < blockLen; i++)
{
obuf[i] = -ibuf[i];
}
return blockLen;
}