Merge branch 'stable-1.1'

Conflicts:
	include/MixHelpers.h
	src/core/FxMixer.cpp
This commit is contained in:
Vesa
2014-07-13 22:20:10 +03:00
6 changed files with 39 additions and 10 deletions

View File

@@ -536,7 +536,7 @@ void FxMixer::masterMix( sampleFrame * _buf )
const float v = volBuf
? 1.0f
: m_fxChannels[0]->m_volumeModel.value();
MixHelpers::addMultiplied( _buf, m_fxChannels[0]->m_buffer, v, fpp );
MixHelpers::addSanitizedMultiplied( _buf, m_fxChannels[0]->m_buffer, v, fpp );
m_fxChannels[0]->m_peakLeft *= engine::mixer()->masterGain();
m_fxChannels[0]->m_peakRight *= engine::mixer()->masterGain();

View File

@@ -22,8 +22,7 @@
*
*/
#include <math.h>
#include "lmms_math.h"
#include "MixHelpers.h"
#include "ValueBuffer.h"
@@ -126,6 +125,26 @@ void addMultipliedByBuffers( sampleFrame* dst, const sampleFrame* src, ValueBuff
}
struct AddSanitizedMultipliedOp
{
AddSanitizedMultipliedOp( float coeff ) : m_coeff( coeff ) { }
void operator()( sampleFrame& dst, const sampleFrame& src ) const
{
dst[0] += ( isinff( src[0] ) || isnanf( src[0] ) ) ? 0.0f : src[0] * m_coeff;
dst[1] += ( isinff( src[1] ) || isnanf( src[1] ) ) ? 0.0f : src[1] * m_coeff;
}
const float m_coeff;
};
void addSanitizedMultiplied( sampleFrame* dst, const sampleFrame* src, float coeffSrc, int frames )
{
run<>( dst, src, frames, AddSanitizedMultipliedOp(coeffSrc) );
}
struct AddMultipliedStereoOp
{
AddMultipliedStereoOp( float coeffLeft, float coeffRight )

View File

@@ -29,6 +29,7 @@
#include "JournallingObject.h"
#include "song.h"
const int ProjectJournal::MAX_UNDO_STATES = 100; // TODO: make this configurable in settings
ProjectJournal::ProjectJournal() :
m_joIDs(),
@@ -109,6 +110,10 @@ void ProjectJournal::addJournalCheckPoint( JournallingObject *jo )
jo->saveState( dataFile, dataFile.content() );
m_undoCheckPoints.push( CheckPoint( jo->id(), dataFile ) );
if( m_undoCheckPoints.size() > MAX_UNDO_STATES )
{
m_undoCheckPoints.remove( 0, m_undoCheckPoints.size() - MAX_UNDO_STATES );
}
}
}
@@ -120,7 +125,7 @@ jo_id_t ProjectJournal::allocID( JournallingObject * _obj )
const jo_id_t EO_ID_MAX = (1 << 23)-1;
jo_id_t id;
while( m_joIDs.contains( id =
static_cast<jo_id_t>( (jo_id_t)rand()*(jo_id_t)rand() %
static_cast<jo_id_t>( (jo_id_t)rand()*(jo_id_t)rand() %
EO_ID_MAX ) ) )
{
}