feat: reduce buffers to 1024

This commit is contained in:
2026-03-22 07:49:05 +01:00
parent b0f6d6d5c9
commit 6382c57ccc
3 changed files with 32 additions and 38 deletions

View File

@@ -18,16 +18,16 @@
/** Provides music through a regular callback to oboe. Called from separate oboe thread. */
class MusicProvider : public AudioCallbackProvider {
public:
explicit MusicProvider(RubberBand::RubberBandStretcher *stretcher);
explicit MusicProvider(RubberBand::RubberBandStretcher *stretcher, size_t buf_size_samples);
~MusicProvider() override;
/** Called from separate oboe thread. */
void onAudioReady(float *data, int32_t frames) override;
private:
const size_t num_buf_samples = 48000;
RubberBand::RubberBandStretcher *stretcher;
float *buf;
int idebug;
size_t buf_size_samples;
};
class PlaybackEngine : public StepListener {
@@ -48,6 +48,8 @@ private:
int android_fd;
std::atomic<bool> haveTimeRatio;
double timeRatio;
int playbackRate;
static size_t constexpr buf_size_samples = 1024;
void initRubberBand();
void closeRubberBand();
void closeMusicFile();