hi,
i’m writing a core and atm im trying to get retro_audio_callback to work.
the problem I have is that my retro_audio_callback gets called 30000 times between each retro_run, which means retroarch is basically busy waiting on one CPU core with my callback.
my guess would be that that is because retroarch thinks i’m not feeding it enough audio samples.
here is how I calculate how many samples to send:
static constexpr size_t CHANNELS = 2;
static constexpr uint64_t MICROSECONDS_PER_SECOND = 1000000ul;
static constexpr uint64_t AUDIO_SAMPLING_RATE = 48000;
uint64_t samplesCount = (microseconds * AUDIO_SAMPLING_RATE) + leftOversampleRateMicroseconds;
leftOversampleRateMicroseconds = samplesCount % MICROSECONDS_PER_SECOND;
samplesCount /= MICROSECONDS_PER_SECOND;
samplesCount *= CHANNELS;
where
leftOversampleRateMicroseconds
is a member variable, so its value carries over to the next iteration and
microseconds
is the last value from retro_frame_time_callback.
the audio sounds perfectly fine so the values can’t be too far off and I don’t see how I could possibly make this any more exact.
is there a better way to know how many samples retroarch expects? or have i completely misdiagnosed the problem?
i’m using retroarch 1.2.2 on arch linux, in case it matters