MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / enqueue

Method enqueue

ps3fw/cellAudio.cpp:250–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void audio_ringbuffer::enqueue(bool enqueue_silence, bool force)
251{
252 AUDIT(cur_pos < cfg.num_allocated_buffers);
253
254 // Prepare buffer
255 static float silence_buffer[u32{AUDIO_MAX_CHANNELS_COUNT} * u32{AUDIO_BUFFER_SAMPLES}]{};
256 float* buf = silence_buffer;
257
258 if (!enqueue_silence)
259 {
260 buf = buffer[cur_pos].get();
261 cur_pos = (cur_pos + 1) % cfg.num_allocated_buffers;
262 }
263
264 if (!backend_active.observe() && !force)
265 {
266 // backend is not ready yet
267 return;
268 }
269
270 // Enqueue audio
271 if (cfg.time_stretching_enabled)
272 {
273 resampler.put_samples(buf, AUDIO_BUFFER_SAMPLES);
274 }
275 else
276 {
277 // Since time stretching step is skipped, we can commit to buffer directly
278 commit_data(buf, AUDIO_BUFFER_SAMPLES);
279 }
280}
281
282void audio_ringbuffer::enqueue_silence(u32 buf_count, bool force)
283{

Callers 1

operator()Method · 0.45

Calls 3

put_samplesMethod · 0.80
getMethod · 0.45
observeMethod · 0.45

Tested by

no test coverage detected