Moving from named enums to double namespaces

parent 16030b61
......@@ -31,44 +31,50 @@
namespace ITABase
{
enum MixingMethod
namespace MixingMethod
{
OVERWRITE = 0, //!< Overwrites the target buffer with new samples
ADD = 1, //!< Adds (mixes) the new samples to the target buffer
};
enum SwitchingMethod
{
};
enum
{
OVERWRITE = 0, //!< Overwrites the target buffer with new samples
ADD = 1, //!< Adds (mixes) the new samples to the target buffer
};
}
//! berblendfunktionen
enum FadingFunction
namespace FadingFunction
{
LINEAR = 0, //!< Lineare berblendung aka. Rampe
COSINE_SQUARE = 1, //!< Cosinus-Quadrat berblendung (aka Hanning-Fenster)
};
enum
{
SWITCH = -1,
LINEAR = 0, //!< Lineare berblendung aka. Rampe
COSINE_SQUARE, //!< Cosinus-Quadrat berblendung (aka Hanning-Fenster)
};
}
//! Fading sign
/**
* Direction how to fade, i.e. in or out
*/
enum FadingSign
namespace FadingSign
{
IN = 0, //!< Fade in
OUT = 1, //!< Fade out
};
enum
{
FADE_IN = 0, //!< Fade in
FADE_OUT, //!< Fade out
};
}
//! Crossfade direction
/**
* Fading direction from source or to source
*/
enum CrossfadeDirection
namespace CrossfadeDirection
{
TO_SOURCE = 0, //!< Crossfade to the source signal
OFF_SOURCE = 1, //!< Crossfade off source signal
};
enum
{
TO_SOURCE = 0, //!< Crossfade to the source signal
FROM_SOURCE, //!< Crossfade off source signal
};
}
}
#endif // INCLUDE_WATCHER_ITA_BASE_DEFINITIONS
......@@ -17,11 +17,12 @@ void Fade( float* pfData, int iFadeLength, int iFadingSign, int iFadeFunction, i
float alpha;
switch( iFadeFunction ) {
switch( iFadeFunction )
{
case ITABase::FadingFunction::LINEAR:
{
alpha = 1 / ( float ) iFadeLength;
if( iFadingSign == ITABase::FadingSign::IN )
if( iFadingSign == ITABase::FadingSign::FADE_IN )
{
// Einblenden
for( int i = 0; i < iLength; i++ )
......@@ -54,7 +55,7 @@ void Fade( float* pfData, int iFadeLength, int iFadingSign, int iFadeFunction, i
{
alpha = ITAConstants::HALF_PI_F / ( float ) iFadeLength;
if( iFadingSign == ITABase::FadingSign::IN )
if( iFadingSign == ITABase::FadingSign::FADE_IN )
for( int i = 0; i < iLength; i++ )
{
// Saubere Werte vor bzw. hinter der Blendphase
......@@ -116,7 +117,8 @@ void Crossfade( const float* pfSrc1, const float* pfSrc2, float* pfDest, int iFa
{
alpha = ITAConstants::HALF_PI_F / ( float ) iFadeLength;
for( int i = 0; i < iFadeLength; i++ ) {
for( int i = 0; i < iFadeLength; i++ )
{
float c = cos( alpha * ( float ) i );
float csq = ( float ) ( c*c );
pfDest[ i ] = csq*pfSrc1[ i ] + ( 1 - csq )*pfSrc2[ i ];
......
......@@ -161,7 +161,7 @@ void ITASampleBuffer::Crossfade( const ITASampleBuffer* psbSrc, int iOffset, int
switch( iCrossfadeDirection )
{
case ITABase::CrossfadeDirection::OFF_SOURCE:
case ITABase::CrossfadeDirection::FROM_SOURCE:
{
// Samples am Anfang kopieren
for( int i = 0; i < iOffset; i++ )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment