Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/AudioDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class AudioDevice
const fpp_t _frames );

// resample given buffer from samplerate _src_sr to samplerate _dst_sr
void resample( const surroundSampleFrame * _src,
fpp_t resample( const surroundSampleFrame * _src,
const fpp_t _frames,
surroundSampleFrame * _dst,
const sample_rate_t _src_sr,
Expand Down
11 changes: 5 additions & 6 deletions src/core/audio/AudioDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ fpp_t AudioDevice::getNextBuffer( surroundSampleFrame * _ab )
// resample if necessary
if( mixer()->processingSampleRate() != m_sampleRate )
{
resample( b, frames, _ab, mixer()->processingSampleRate(),
m_sampleRate );
frames = frames * m_sampleRate /
mixer()->processingSampleRate();
frames = resample( b, frames, _ab, mixer()->processingSampleRate(),
m_sampleRate );
}
else
{
Expand Down Expand Up @@ -184,15 +182,15 @@ void AudioDevice::renamePort( AudioPort * )



void AudioDevice::resample( const surroundSampleFrame * _src,
fpp_t AudioDevice::resample( const surroundSampleFrame * _src,
const fpp_t _frames,
surroundSampleFrame * _dst,
const sample_rate_t _src_sr,
const sample_rate_t _dst_sr )
{
if( m_srcState == NULL )
{
return;
return _frames;
}
m_srcData.input_frames = _frames;
m_srcData.output_frames = _frames;
Expand All @@ -206,6 +204,7 @@ void AudioDevice::resample( const surroundSampleFrame * _src,
printf( "AudioDevice::resample(): error while resampling: %s\n",
src_strerror( error ) );
}
return static_cast<fpp_t>(m_srcData.output_frames_gen);
}


Expand Down