Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
a6168a16
Commit
a6168a16
authored
Mar 05, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some unused experimental code.
parent
180621a0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
121 deletions
+0
-121
mini_al.h
mini_al.h
+0
-121
No files found.
mini_al.h
View file @
a6168a16
...
@@ -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;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment