mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 16:54:03 +02:00
Web Audio: Minor change for multi-threaded mode.
This commit is contained in:
+18
-14
@@ -42914,24 +42914,28 @@ static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T a
|
|||||||
sampleRate = EM_ASM_INT({ return emscriptenGetAudioObject($0).sampleRate; }, audioContext);
|
sampleRate = EM_ASM_INT({ return emscriptenGetAudioObject($0).sampleRate; }, audioContext);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We're now going to choose a period size. The quantum size reported by Web Audio is too small for us to use so
|
We're now going to choose a period size. For single-threaded mode, the quantum size reported by Web Audio is too small
|
||||||
we'll need to use something bigger for our internal bufferring.
|
for us to use so we'll need to use something bigger for our internal bufferring.
|
||||||
*/
|
*/
|
||||||
chosenPeriodSizeInFrames = intermediaryBufferSizeInFrames;
|
if (ma_device_get_threading_mode(pParameters->pDevice) == MA_THREADING_MODE_SINGLE_THREADED) {
|
||||||
if (pParameters->pDescriptorCapture != NULL) {
|
chosenPeriodSizeInFrames = intermediaryBufferSizeInFrames;
|
||||||
if (chosenPeriodSizeInFrames < pParameters->pDescriptorCapture->periodSizeInFrames) {
|
if (pParameters->pDescriptorCapture != NULL) {
|
||||||
chosenPeriodSizeInFrames = pParameters->pDescriptorCapture->periodSizeInFrames;
|
if (chosenPeriodSizeInFrames < pParameters->pDescriptorCapture->periodSizeInFrames) {
|
||||||
|
chosenPeriodSizeInFrames = pParameters->pDescriptorCapture->periodSizeInFrames;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (pParameters->pDescriptorPlayback != NULL) {
|
||||||
if (pParameters->pDescriptorPlayback != NULL) {
|
if (chosenPeriodSizeInFrames < pParameters->pDescriptorPlayback->periodSizeInFrames) {
|
||||||
if (chosenPeriodSizeInFrames < pParameters->pDescriptorPlayback->periodSizeInFrames) {
|
chosenPeriodSizeInFrames = pParameters->pDescriptorPlayback->periodSizeInFrames;
|
||||||
chosenPeriodSizeInFrames = pParameters->pDescriptorPlayback->periodSizeInFrames;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* I'd like to keep this a power of two. In my testing, 512 was too small and results in glitching so going with 1024. */
|
/* I'd like to keep this a power of two. In my testing, 512 was too small and results in glitching so going with 1024. */
|
||||||
if (chosenPeriodSizeInFrames < 1024) {
|
if (chosenPeriodSizeInFrames < 1024) {
|
||||||
chosenPeriodSizeInFrames = 1024;
|
chosenPeriodSizeInFrames = 1024;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
chosenPeriodSizeInFrames = intermediaryBufferSizeInFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pParameters->pDescriptorCapture != NULL) {
|
if (pParameters->pDescriptorCapture != NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user