Moving from named enums to double namespaces

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