"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/core/SampleBuffer.cpp" between
lmms_1.2.0.tar.xz and lmms_1.2.1.tar.xz

About: LMMS (Linux MultiMedia Studio) is a sound generation system (creation of melodies and beats, synthesis and mixing of sounds, arranging of samples; full MIDI support).

SampleBuffer.cpp  (lmms_1.2.0.tar.xz):SampleBuffer.cpp  (lmms_1.2.1.tar.xz)
skipping to change at line 367 skipping to change at line 367
idx += _channels; idx += _channels;
} }
} }
delete[] _fbuf; delete[] _fbuf;
} }
void SampleBuffer::normalizeSampleRate( const sample_rate_t _src_sr, void SampleBuffer::normalizeSampleRate( const sample_rate_t _src_sr,
bool _keep_settings ) bool _keep_settings )
{ {
const sample_rate_t old_rate = m_sampleRate;
// do samplerate-conversion to our default-samplerate // do samplerate-conversion to our default-samplerate
if( _src_sr != mixerSampleRate() ) if( _src_sr != mixerSampleRate() )
{ {
SampleBuffer * resampled = resample( _src_sr, SampleBuffer * resampled = resample( _src_sr,
mixerSampleRate() ); mixerSampleRate() );
m_sampleRate = mixerSampleRate();
MM_FREE( m_data ); MM_FREE( m_data );
m_frames = resampled->frames(); m_frames = resampled->frames();
m_data = MM_ALLOC( sampleFrame, m_frames ); m_data = MM_ALLOC( sampleFrame, m_frames );
memcpy( m_data, resampled->data(), m_frames * memcpy( m_data, resampled->data(), m_frames *
sizeof( sampleFrame ) ); sizeof( sampleFrame ) );
delete resampled; delete resampled;
} }
if( _keep_settings == false ) if( _keep_settings == false )
{ {
// update frame-variables // update frame-variables
m_loopStartFrame = m_startFrame = 0; m_loopStartFrame = m_startFrame = 0;
m_loopEndFrame = m_endFrame = m_frames; m_loopEndFrame = m_endFrame = m_frames;
} }
else if( old_rate != mixerSampleRate() )
{
auto old_rate_to_new_rate_ratio = static_cast<float>(mixerSampleR
ate()) / old_rate;
m_startFrame = qBound(0, f_cnt_t(m_startFrame*old_rate_to_new_rat
e_ratio), m_frames);
m_endFrame = qBound(m_startFrame, f_cnt_t(m_endFrame*old_rate_to_
new_rate_ratio), m_frames);
m_loopStartFrame = qBound(0, f_cnt_t(m_loopStartFrame*old_rate_to
_new_rate_ratio), m_frames);
m_loopEndFrame = qBound(m_loopStartFrame, f_cnt_t(m_loopEndFrame*
old_rate_to_new_rate_ratio), m_frames);
m_sampleRate = mixerSampleRate();
}
} }
f_cnt_t SampleBuffer::decodeSampleSF(QString _f, f_cnt_t SampleBuffer::decodeSampleSF(QString _f,
sample_t * & _buf, sample_t * & _buf,
ch_cnt_t & _channels, ch_cnt_t & _channels,
sample_rate_t & _samplerate ) sample_rate_t & _samplerate )
{ {
SNDFILE * snd_file; SNDFILE * snd_file;
SF_INFO sf_info; SF_INFO sf_info;
sf_info.format = 0; sf_info.format = 0;
 End of changes. 3 change blocks. 
0 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)