feat: actually map channels

This commit is contained in:
2026-03-22 08:44:41 +01:00
parent 6382c57ccc
commit 25e5cc19d0
4 changed files with 109 additions and 34 deletions

View File

@@ -18,7 +18,7 @@
/** Provides music through a regular callback to oboe. Called from separate oboe thread. */
class MusicProvider : public AudioCallbackProvider {
public:
explicit MusicProvider(RubberBand::RubberBandStretcher *stretcher, size_t buf_size_samples);
explicit MusicProvider(RubberBand::RubberBandStretcher *stretcher, size_t buf_size_samples, int num_ch_out);
~MusicProvider() override;
/** Called from separate oboe thread. */
@@ -26,8 +26,10 @@ public:
private:
RubberBand::RubberBandStretcher *stretcher;
float *buf;
float **buf_ptr;
int idebug;
size_t buf_size_samples;
int num_ch_out;
};
class PlaybackEngine : public StepListener {
@@ -47,13 +49,17 @@ private:
std::atomic<bool> exitMusicFeedThread;
int android_fd;
std::atomic<bool> haveTimeRatio;
double timeRatio;
int playbackRate;
std::atomic<double> timeRatio;
std::atomic<int> playbackRate;
std::atomic<int> numOutChannels;
std::atomic<int> numInChannels;
/** this is actually in frames, not samples */
static size_t constexpr buf_size_samples = 1024;
void initRubberBand();
void closeRubberBand();
void closeMusicFile();
void musicFeedThread();
void mapChannels(int *channel_map, int num_ch_in, int num_ch_out);
};
#endif //LOCKSTEP_PLAYBACKENGINE_H