Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions libs/miniaudio/miniaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -20396,7 +20396,7 @@ static void ma_device__handle_data_callback(ma_device* pDevice, void* pFramesOut
}

if (!pDevice->noClip && pDevice->playback.format == ma_format_f32) {
ma_clip_samples_f32((float*)pFramesOut, (const float*)pFramesOut, frameCount * pDevice->playback.channels); /* Intentionally specifying the same pointer for both input and output for in-place processing. */
ma_clip_samples_f32((float*)pFramesOut, (const float*)pFramesOut, (ma_uint64)frameCount * pDevice->playback.channels); /* Intentionally specifying the same pointer for both input and output for in-place processing. */
}
}
}
Expand Down Expand Up @@ -29413,7 +29413,7 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic

/* Buffer Size */
{
ma_snd_pcm_uframes_t actualBufferSizeInFrames = ma_calculate_buffer_size_in_frames_from_descriptor(pDescriptor, internalSampleRate, pConfig->performanceProfile) * internalPeriods;
ma_snd_pcm_uframes_t actualBufferSizeInFrames = (ma_snd_pcm_uframes_t)ma_calculate_buffer_size_in_frames_from_descriptor(pDescriptor, internalSampleRate, pConfig->performanceProfile) * internalPeriods;

resultALSA = ((ma_snd_pcm_hw_params_set_buffer_size_near_proc)pDevice->pContext->alsa.snd_pcm_hw_params_set_buffer_size_near)(pPCM, pHWParams, &actualBufferSizeInFrames);
if (resultALSA < 0) {
Expand Down Expand Up @@ -29465,7 +29465,7 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic

resultALSA = ((ma_snd_pcm_sw_params_get_boundary_proc)pDevice->pContext->alsa.snd_pcm_sw_params_get_boundary)(pSWParams, &bufferBoundary);
if (resultALSA < 0) {
bufferBoundary = internalPeriodSizeInFrames * internalPeriods;
bufferBoundary = (ma_snd_pcm_uframes_t)internalPeriodSizeInFrames * internalPeriods;
}

if (deviceType == ma_device_type_playback && !isUsingMMap) { /* Only playback devices in writei/readi mode need a start threshold. */
Expand Down Expand Up @@ -33009,7 +33009,7 @@ static int ma_device__jack_buffer_size_callback(ma_jack_nframes_t frameCount, vo
MA_ASSERT(pDevice != NULL);

if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) {
size_t newBufferSize = frameCount * (pDevice->capture.internalChannels * ma_get_bytes_per_sample(pDevice->capture.internalFormat));
size_t newBufferSize = (size_t)frameCount * (pDevice->capture.internalChannels * ma_get_bytes_per_sample(pDevice->capture.internalFormat));
float* pNewBuffer = (float*)ma_calloc(newBufferSize, &pDevice->pContext->allocationCallbacks);
if (pNewBuffer == NULL) {
return MA_OUT_OF_MEMORY;
Expand All @@ -33022,7 +33022,7 @@ static int ma_device__jack_buffer_size_callback(ma_jack_nframes_t frameCount, vo
}

if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
size_t newBufferSize = frameCount * (pDevice->playback.internalChannels * ma_get_bytes_per_sample(pDevice->playback.internalFormat));
size_t newBufferSize = (size_t)frameCount * (pDevice->playback.internalChannels * ma_get_bytes_per_sample(pDevice->playback.internalFormat));
float* pNewBuffer = (float*)ma_calloc(newBufferSize, &pDevice->pContext->allocationCallbacks);
if (pNewBuffer == NULL) {
return MA_OUT_OF_MEMORY;
Expand Down Expand Up @@ -33184,7 +33184,7 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config
pDescriptorCapture->periodSizeInFrames = periodSizeInFrames;
pDescriptorCapture->periodCount = 1; /* There's no notion of a period in JACK. Just set to 1. */

pDevice->jack.pIntermediaryBufferCapture = (float*)ma_calloc(pDescriptorCapture->periodSizeInFrames * ma_get_bytes_per_frame(pDescriptorCapture->format, pDescriptorCapture->channels), &pDevice->pContext->allocationCallbacks);
pDevice->jack.pIntermediaryBufferCapture = (float*)ma_calloc((size_t)pDescriptorCapture->periodSizeInFrames * ma_get_bytes_per_frame(pDescriptorCapture->format, pDescriptorCapture->channels), &pDevice->pContext->allocationCallbacks);
if (pDevice->jack.pIntermediaryBufferCapture == NULL) {
ma_device_uninit__jack(pDevice);
return MA_OUT_OF_MEMORY;
Expand Down Expand Up @@ -43908,7 +43908,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC
}
}

intermediaryBufferSizeInBytes = pDevice->playback.intermediaryBufferCap * ma_get_bytes_per_frame(pDevice->playback.format, pDevice->playback.channels);
intermediaryBufferSizeInBytes = (ma_uint64)pDevice->playback.intermediaryBufferCap * ma_get_bytes_per_frame(pDevice->playback.format, pDevice->playback.channels);

pDevice->playback.pIntermediaryBuffer = ma_malloc((size_t)intermediaryBufferSizeInBytes, &pContext->allocationCallbacks);
if (pDevice->playback.pIntermediaryBuffer == NULL) {
Expand Down Expand Up @@ -58664,7 +58664,7 @@ MA_API ma_result ma_pcm_rb_init_ex(ma_format format, ma_uint32 channels, ma_uint
return MA_INVALID_ARGS;
}

result = ma_rb_init_ex(subbufferSizeInFrames*bpf, subbufferCount, subbufferStrideInFrames*bpf, pOptionalPreallocatedBuffer, pAllocationCallbacks, &pRB->rb);
result = ma_rb_init_ex((size_t)subbufferSizeInFrames*bpf, subbufferCount, (size_t)subbufferStrideInFrames*bpf, pOptionalPreallocatedBuffer, pAllocationCallbacks, &pRB->rb);
if (result != MA_SUCCESS) {
return result;
}
Expand Down Expand Up @@ -58721,7 +58721,7 @@ MA_API ma_result ma_pcm_rb_acquire_read(ma_pcm_rb* pRB, ma_uint32* pSizeInFrames
return MA_INVALID_ARGS;
}

sizeInBytes = *pSizeInFrames * ma_pcm_rb_get_bpf(pRB);
sizeInBytes = (size_t)*pSizeInFrames * ma_pcm_rb_get_bpf(pRB);

result = ma_rb_acquire_read(&pRB->rb, &sizeInBytes, ppBufferOut);
if (result != MA_SUCCESS) {
Expand All @@ -58738,7 +58738,7 @@ MA_API ma_result ma_pcm_rb_commit_read(ma_pcm_rb* pRB, ma_uint32 sizeInFrames)
return MA_INVALID_ARGS;
}

return ma_rb_commit_read(&pRB->rb, sizeInFrames * ma_pcm_rb_get_bpf(pRB));
return ma_rb_commit_read(&pRB->rb, (size_t)sizeInFrames * ma_pcm_rb_get_bpf(pRB));
}

MA_API ma_result ma_pcm_rb_acquire_write(ma_pcm_rb* pRB, ma_uint32* pSizeInFrames, void** ppBufferOut)
Expand All @@ -58750,7 +58750,7 @@ MA_API ma_result ma_pcm_rb_acquire_write(ma_pcm_rb* pRB, ma_uint32* pSizeInFrame
return MA_INVALID_ARGS;
}

sizeInBytes = *pSizeInFrames * ma_pcm_rb_get_bpf(pRB);
sizeInBytes = (size_t)*pSizeInFrames * ma_pcm_rb_get_bpf(pRB);

result = ma_rb_acquire_write(&pRB->rb, &sizeInBytes, ppBufferOut);
if (result != MA_SUCCESS) {
Expand All @@ -58767,7 +58767,7 @@ MA_API ma_result ma_pcm_rb_commit_write(ma_pcm_rb* pRB, ma_uint32 sizeInFrames)
return MA_INVALID_ARGS;
}

return ma_rb_commit_write(&pRB->rb, sizeInFrames * ma_pcm_rb_get_bpf(pRB));
return ma_rb_commit_write(&pRB->rb, (size_t)sizeInFrames * ma_pcm_rb_get_bpf(pRB));
}

MA_API ma_result ma_pcm_rb_seek_read(ma_pcm_rb* pRB, ma_uint32 offsetInFrames)
Expand All @@ -58776,7 +58776,7 @@ MA_API ma_result ma_pcm_rb_seek_read(ma_pcm_rb* pRB, ma_uint32 offsetInFrames)
return MA_INVALID_ARGS;
}

return ma_rb_seek_read(&pRB->rb, offsetInFrames * ma_pcm_rb_get_bpf(pRB));
return ma_rb_seek_read(&pRB->rb, (size_t)offsetInFrames * ma_pcm_rb_get_bpf(pRB));
}

MA_API ma_result ma_pcm_rb_seek_write(ma_pcm_rb* pRB, ma_uint32 offsetInFrames)
Expand All @@ -58785,7 +58785,7 @@ MA_API ma_result ma_pcm_rb_seek_write(ma_pcm_rb* pRB, ma_uint32 offsetInFrames)
return MA_INVALID_ARGS;
}

return ma_rb_seek_write(&pRB->rb, offsetInFrames * ma_pcm_rb_get_bpf(pRB));
return ma_rb_seek_write(&pRB->rb, (size_t)offsetInFrames * ma_pcm_rb_get_bpf(pRB));
}

MA_API ma_int32 ma_pcm_rb_pointer_distance(ma_pcm_rb* pRB)
Expand Down
4 changes: 2 additions & 2 deletions libs/miniaudio/osaudio_miniaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ static void osaudio_data_callback_playback(osaudio_t audio, void* pOutput, ma_ui
break;
}

memcpy(pOutput, pBuffer, framesToRead * ma_get_bytes_per_frame(audio->device.playback.format, audio->device.playback.channels));
memcpy(pOutput, pBuffer, (size_t)framesToRead * ma_get_bytes_per_frame(audio->device.playback.format, audio->device.playback.channels));
ma_pcm_rb_commit_read(&audio->buffer, framesToRead);

frameCount -= framesToRead;
Expand Down Expand Up @@ -439,7 +439,7 @@ static void osaudio_data_callback_capture(osaudio_t audio, const void* pInput, m
break;
}

memcpy(pBuffer, pInput, framesToWrite * ma_get_bytes_per_frame(audio->device.capture.format, audio->device.capture.channels));
memcpy(pBuffer, pInput, (size_t)framesToWrite * ma_get_bytes_per_frame(audio->device.capture.format, audio->device.capture.channels));
ma_pcm_rb_commit_write(&audio->buffer, framesToWrite);

frameCount -= framesToWrite;
Expand Down
Loading