diff --git a/include/MemoryHelper.h b/include/MemoryHelper.h index 624f326ec..f646c7ef3 100644 --- a/include/MemoryHelper.h +++ b/include/MemoryHelper.h @@ -22,18 +22,18 @@ */ -#ifndef _MEMORY_HELPER_H_ -#define _MEMORY_HELPER_H_ +#ifndef MEMORY_HELPER_H +#define MEMORY_HELPER_H /** * Helper class to alocate aligned memory and free it. */ class MemoryHelper { public: - - static void* alignedMalloc(int); - static void alignedFree(void*); + static void* alignedMalloc( int ); + + static void alignedFree( void* ); private: }; diff --git a/include/interpolation.h b/include/interpolation.h index e58be7be3..67ff0a3a5 100644 --- a/include/interpolation.h +++ b/include/interpolation.h @@ -81,7 +81,7 @@ inline float cosinusInterpolate( float v0, float v1, float x ) { const float f = ( 1.0f - cosf( x * F_PI ) ) * 0.5f; #ifdef FP_FAST_FMAF - return fmaf( x, v1-v0, v0 ); + return fmaf( f, v1-v0, v0 ); #else return f * (v1-v0) + v0; #endif diff --git a/plugins/monstro/Monstro.cpp b/plugins/monstro/Monstro.cpp index d9c80a3c3..60891e362 100644 --- a/plugins/monstro/Monstro.cpp +++ b/plugins/monstro/Monstro.cpp @@ -693,6 +693,7 @@ void MonstroSynth::renderModulators( fpp_t _frames ) m_lfo1_s = Oscillator::noiseSample( 0.0f ); } m_lfo1_buf[f] = cosinusInterpolate( m_lfo1_last, m_lfo1_s, p ); + if( t < m_parent->m_lfo1_att ) m_lfo1_buf[f] *= ( static_cast( t ) / m_parent->m_lfo1_att ); } m_lfo1_phase += static_cast( _frames ) / lfo1_r; break; @@ -825,6 +826,7 @@ void MonstroSynth::renderModulators( fpp_t _frames ) m_lfo2_s = Oscillator::noiseSample( 0.0f ); } m_lfo2_buf[f] = cosinusInterpolate( m_lfo2_last, m_lfo2_s, p ); + if( t < m_parent->m_lfo2_att ) m_lfo2_buf[f] *= ( static_cast( t ) / m_parent->m_lfo2_att ); } m_lfo2_phase += static_cast( _frames ) / lfo2_r; break; diff --git a/src/core/MemoryHelper.cpp b/src/core/MemoryHelper.cpp index 28a97abe4..3513ee763 100644 --- a/src/core/MemoryHelper.cpp +++ b/src/core/MemoryHelper.cpp @@ -27,42 +27,39 @@ #include "MemoryHelper.h" /** - * Allocate a number of bytes and return them. - * @param _byteNum is the number of bytes + * Allocate a number of bytes and return them. + * @param byteNum is the number of bytes */ -void* MemoryHelper::alignedMalloc(int _byteNum) { - char *ptr,*ptr2,*aligned_ptr; - int align_mask = ALIGN_SIZE- 1; +void* MemoryHelper::alignedMalloc( int byteNum ) +{ + char *ptr, *ptr2, *aligned_ptr; + int align_mask = ALIGN_SIZE - 1; - ptr = (char *) malloc(_byteNum + ALIGN_SIZE + sizeof(int)); + ptr = static_cast( malloc( byteNum + ALIGN_SIZE + sizeof( int ) ) ); - if(ptr==NULL) return(NULL); + if( ptr == NULL ) return NULL; - ptr2 = ptr + sizeof(int); - aligned_ptr = ptr2 + (ALIGN_SIZE- ((size_t)ptr2 & align_mask)); + ptr2 = ptr + sizeof( int ); + aligned_ptr = ptr2 + ( ALIGN_SIZE - ( ( size_t ) ptr2 & align_mask ) ); - ptr2 = aligned_ptr - sizeof(int); - *((int *)ptr2)=(int)(aligned_ptr - ptr); + ptr2 = aligned_ptr - sizeof( int ); + *( ( int* ) ptr2 ) = ( int )( aligned_ptr - ptr ); - return(aligned_ptr); + return aligned_ptr; } - - /** * Free an aligned buffer * @param _buffer is the buffer to free */ -void MemoryHelper::alignedFree(void* _buffer) { - if( _buffer != NULL ) +void MemoryHelper::alignedFree( void* _buffer ) +{ + if( _buffer ) { - int *ptr2=(int *)_buffer - 1; - _buffer = (char *)_buffer - *ptr2; - free(_buffer); + int *ptr2 = static_cast( _buffer ) - 1; + _buffer = static_cast( _buffer ) - *ptr2; + free( _buffer ); } } - - -