1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-09 06:33:49 +01:00
Files
audacity/src/effects/Invert.cpp
Paul Licameli 67cec5ad83 Make many counts of tracks and channels unsigned...
... And in some places where a library uses signed types, assert that
the reported number is not negative.

What led me to this, is that there are many places where a size_t value for
an allocation is the product of a number of channels and some other number.
2016-09-07 10:11:41 -04:00

79 lines
1.3 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
Invert.cpp
Mark Phillips
*******************************************************************//**
\class EffectInvert
\brief An Effect that inverts the selected audio.
*//*******************************************************************/
#include "../Audacity.h"
#include <wx/intl.h>
#include "Invert.h"
EffectInvert::EffectInvert()
{
}
EffectInvert::~EffectInvert()
{
}
// IdentInterface implementation
wxString EffectInvert::GetSymbol()
{
return INVERT_PLUGIN_SYMBOL;
}
wxString EffectInvert::GetDescription()
{
return XO("Flips the audio samples upside-down, reversing their polarity");
}
// EffectIdentInterface implementation
EffectType EffectInvert::GetType()
{
return EffectTypeProcess;
}
bool EffectInvert::IsInteractive()
{
return false;
}
// EffectClientInterface implementation
unsigned EffectInvert::GetAudioInCount()
{
return 1;
}
unsigned EffectInvert::GetAudioOutCount()
{
return 1;
}
sampleCount EffectInvert::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];
for (decltype(blockLen) i = 0; i < blockLen; i++)
{
obuf[i] = -ibuf[i];
}
return blockLen;
}