Commit a6168a16 authored by David Reid's avatar David Reid

Remove some unused experimental code.

parent 180621a0
...@@ -23153,127 +23153,6 @@ void mal_device_uninit(mal_device* pDevice) ...@@ -23153,127 +23153,6 @@ void mal_device_uninit(mal_device* pDevice)
mal_zero_object(pDevice); mal_zero_object(pDevice);
} }
/*
Writes PCM frames to the device.
*/
mal_result mal_device_write(mal_device* pDevice, const void* pPCMFrames, mal_uint32 frameCount)
{
mal_result result;
mal_uint32 totalFramesWritten = 0;
if (mal_device__is_async(pDevice)) {
return MAL_INVALID_ARGS;
}
/* Backend must supporting synchronous writes. */
if (pDevice->pContext->onDeviceWrite == NULL) {
return MAL_INVALID_OPERATION;
}
/* If it's a passthrough we can call the backend directly, otherwise we need a data conversion into an intermediary buffer. */
if (pDevice->playback.converter.isPassthrough) {
/* Fast path. Write directly to the device. */
result = pDevice->pContext->onDeviceWrite(pDevice, pPCMFrames, frameCount);
} else {
/* Slow path. Perform a data conversion. */
/* TODO: Implement me. */
result = MAL_SUCCESS;
/* NOTE: Only doing format conversion for now just while testing. */
mal_uint8 buffer[4096];
mal_uint32 bufferSizeInFrames = sizeof(buffer) / mal_get_bytes_per_frame(pDevice->playback.internalFormat, pDevice->playback.internalChannels);
while (totalFramesWritten < frameCount) {
mal_uint32 framesRemaining = (frameCount - totalFramesWritten);
mal_uint32 framesToProcess = framesRemaining;
if (framesToProcess > bufferSizeInFrames) {
framesToProcess = bufferSizeInFrames;
}
mal_pcm_convert(
buffer,
pDevice->playback.internalFormat,
mal_offset_ptr(pPCMFrames, totalFramesWritten * mal_get_bytes_per_frame(pDevice->playback.format, pDevice->playback.channels)),
pDevice->playback.format,
framesToProcess*pDevice->playback.channels,
mal_dither_mode_none);
result = pDevice->pContext->onDeviceWrite(pDevice, buffer, framesToProcess);
totalFramesWritten += framesToProcess;
if (result != MAL_SUCCESS) {
break;
}
}
}
return result;
}
/*
Reads PCM frames from the device.
*/
mal_result mal_device_read(mal_device* pDevice, void* pPCMFrames, mal_uint32 frameCount)
{
mal_result result;
mal_uint32 totalFramesRead = 0;
if (pDevice == NULL || pPCMFrames == NULL) {
return MAL_INVALID_ARGS;
}
/* Not allowed to call this in asynchronous mode. */
if (mal_device__is_async(pDevice)) {
return MAL_INVALID_OPERATION;
}
/* Backend must supporting synchronous reads. */
if (pDevice->pContext->onDeviceRead == NULL) {
return MAL_INVALID_OPERATION;
}
/* If it's a passthrough we can call the backend directly, otherwise we need a data conversion into an intermediary buffer. */
if (pDevice->capture.converter.isPassthrough) {
/* Fast path. Write directly to the device. */
result = pDevice->pContext->onDeviceRead(pDevice, pPCMFrames, frameCount);
} else {
/* Slow path. Perform a data conversion. */
/* TODO: Implement me. */
result = MAL_SUCCESS;
/* NOTE: Only doing format conversion for now just while testing. */
mal_uint8 buffer[4096];
mal_uint32 bufferSizeInFrames = sizeof(buffer) / mal_get_bytes_per_frame(pDevice->capture.internalFormat, pDevice->capture.internalChannels);
while (totalFramesRead < frameCount) {
mal_uint32 framesRemaining = (frameCount - totalFramesRead);
mal_uint32 framesToProcess = framesRemaining;
if (framesToProcess > bufferSizeInFrames) {
framesToProcess = bufferSizeInFrames;
}
result = pDevice->pContext->onDeviceRead(pDevice, buffer, framesToProcess);
mal_pcm_convert(
mal_offset_ptr(pPCMFrames, totalFramesRead * mal_get_bytes_per_frame(pDevice->capture.format, pDevice->capture.channels)),
pDevice->capture.format,
buffer,
pDevice->capture.internalFormat,
framesToProcess*pDevice->capture.channels,
mal_dither_mode_none);
totalFramesRead += framesToProcess;
if (result != MAL_SUCCESS) {
break;
}
}
}
return result;
}
void mal_device_set_stop_callback(mal_device* pDevice, mal_stop_proc proc) void mal_device_set_stop_callback(mal_device* pDevice, mal_stop_proc proc)
{ {
if (pDevice == NULL) return; if (pDevice == NULL) return;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment