Resample SampleBuffer only once when loading from SampleClip (#6594)
The SampleBuffer's sample rate in SampleClip was altered twice during SampleClip::loadSettings: first when setSampleFile was called, which set the sample rate of the SampleBuffer to the AudioEngine's sample rate (good), and a second time when calling setSampleRate, which set it to the sample rate specified within the project file (bad). This led to the sample rate of the buffer being different than that of the project, resulting in it being pitched incorrectly on playback.
This commit is contained in:
@@ -292,15 +292,15 @@ void SampleClip::loadSettings( const QDomElement & _this )
|
||||
if( sampleFile().isEmpty() && _this.hasAttribute( "data" ) )
|
||||
{
|
||||
m_sampleBuffer->loadFromBase64( _this.attribute( "data" ) );
|
||||
if (_this.hasAttribute("sample_rate"))
|
||||
{
|
||||
m_sampleBuffer->setSampleRate(_this.attribute("sample_rate").toInt());
|
||||
}
|
||||
}
|
||||
changeLength( _this.attribute( "len" ).toInt() );
|
||||
setMuted( _this.attribute( "muted" ).toInt() );
|
||||
setStartTimeOffset( _this.attribute( "off" ).toInt() );
|
||||
|
||||
if ( _this.hasAttribute( "sample_rate" ) ) {
|
||||
m_sampleBuffer->setSampleRate( _this.attribute( "sample_rate" ).toInt() );
|
||||
}
|
||||
|
||||
if( _this.hasAttribute( "color" ) )
|
||||
{
|
||||
useCustomClipColor( true );
|
||||
|
||||
Reference in New Issue
Block a user