From ff3e94bd7523e0b158ec145a3fb16153772d8a6c Mon Sep 17 00:00:00 2001 From: Vesa Date: Sat, 26 Apr 2014 16:16:38 +0300 Subject: [PATCH 1/3] Fix a typo in interpolation.h --- include/interpolation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From e638bb8ae1f78e6bb06e2150c8ec288c0bfbf35e Mon Sep 17 00:00:00 2001 From: Vesa Date: Sat, 26 Apr 2014 18:10:36 +0300 Subject: [PATCH 2/3] MemoryHelper: update coding style --- include/MemoryHelper.h | 10 +++++----- src/core/MemoryHelper.cpp | 41 ++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 27 deletions(-) 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/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 ); } } - - - From 37b9df3458b7c399a85861f4fef8ebb5bbfeef2c Mon Sep 17 00:00:00 2001 From: Vesa Date: Sat, 26 Apr 2014 19:56:21 +0300 Subject: [PATCH 3/3] Monstro: fix LFO att. on random smooth mode --- plugins/monstro/Monstro.cpp | 2 ++ 1 file changed, 2 insertions(+) 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;