mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-19 12:16:16 -04:00
Fix playback within Sample (#7100)
This revisits two main aspects of playback from `Sample`: copying frames into a temporary playback buffer before resampling, and advancing the state's frame index. Both operations were improperly done, causing distorted audio to be heard when resampling from within the `Sample::play` function. To fix this, playback into the temporary playback buffer is now done using the `playRaw` function, which copies the frame one by one in a loop, moving through the buffer correctly as determined by the loop mode. In addition, advancement of the playback index is done using the `advance` function, which advances the index by the given amount and handles an out of bounds index for the loop modes as necessary using the modulo operator.
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
|
||||
namespace lmms {
|
||||
|
||||
SampleBuffer::SampleBuffer(const sampleFrame* data, int numFrames, int sampleRate)
|
||||
SampleBuffer::SampleBuffer(const sampleFrame* data, size_t numFrames, int sampleRate)
|
||||
: m_data(data, data + numFrames)
|
||||
, m_sampleRate(sampleRate)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user