fix: fixes for buffer level handling, player lifecycle handling
This commit is contained in:
@@ -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, int num_ch_out);
|
||||
explicit MusicProvider(RubberBand::RubberBandStretcher *stretcher, size_t buf_size_samples, int num_ch_out, std::atomic<int> *back_pressure);
|
||||
~MusicProvider() override;
|
||||
|
||||
/** Called from separate oboe thread. */
|
||||
@@ -30,6 +30,8 @@ private:
|
||||
int idebug;
|
||||
size_t buf_size_samples;
|
||||
int num_ch_out;
|
||||
/** contains the current available() frames from 'stretcher' in the audio callback thread 2 (oboe) */
|
||||
std::atomic<int> *back_pressure;
|
||||
};
|
||||
|
||||
class PlaybackEngine : public StepListener {
|
||||
@@ -47,12 +49,16 @@ private:
|
||||
std::atomic<bool> haveMusicFile;
|
||||
std::unique_ptr<std::thread> musicFeed;
|
||||
std::atomic<bool> exitMusicFeedThread;
|
||||
/** where musicFeedThread() keeps track of the fact that we have music set -- will start the audio cb */
|
||||
std::atomic<bool> isSetMusic;
|
||||
int android_fd;
|
||||
std::atomic<bool> haveTimeRatio;
|
||||
std::atomic<double> timeRatio;
|
||||
std::atomic<int> playbackRate;
|
||||
std::atomic<int> numOutChannels;
|
||||
std::atomic<int> numInChannels;
|
||||
/** contains the current available() frames from 'stretcher' in the audio callback thread 2 (oboe) */
|
||||
std::atomic<int> back_pressure;
|
||||
/** this is actually in frames, not samples */
|
||||
static size_t constexpr buf_size_samples = 1024;
|
||||
void initRubberBand();
|
||||
|
||||
Reference in New Issue
Block a user