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
7c24036c
Commit
7c24036c
authored
Apr 25, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to device info retrieval for Emscripten.
parent
d9d9901e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
mini_al.h
mini_al.h
+16
-0
No files found.
mini_al.h
View file @
7c24036c
...
@@ -14394,6 +14394,21 @@ mal_result mal_context_get_device_info__sdl(mal_context* pContext, mal_device_ty
...
@@ -14394,6 +14394,21 @@ mal_result mal_context_get_device_info__sdl(mal_context* pContext, mal_device_ty
// To get an accurate idea on the backend's native format we need to open the device. Not ideal, but it's the only way. An
// To get an accurate idea on the backend's native format we need to open the device. Not ideal, but it's the only way. An
// alternative to this is to report all channel counts, sample rates and formats, but that doesn't offer a good representation
// alternative to this is to report all channel counts, sample rates and formats, but that doesn't offer a good representation
// of the device's _actual_ ideal format.
// of the device's _actual_ ideal format.
//
// Note: With Emscripten, it looks like non-zero values need to be specified for desiredSpec. Whatever is specified in
// desiredSpec will be used by SDL since it uses it just does it's own format conversion internally. Therefore, from what
// I can tell, there's no real way to know the device's actual format which means I'm just going to fall back to the full
// range of channels and sample rates on Emscripten builds.
#if defined(__EMSCRIPTEN__)
pDeviceInfo->minChannels = MAL_MIN_CHANNELS;
pDeviceInfo->maxChannels = MAL_MAX_CHANNELS;
pDeviceInfo->minSampleRate = MAL_MIN_SAMPLE_RATE;
pDeviceInfo->maxSampleRate = MAL_MAX_SAMPLE_RATE;
pDeviceInfo->formatCount = 3;
pDeviceInfo->formats[0] = mal_format_u8;
pDeviceInfo->formats[1] = mal_format_s16;
pDeviceInfo->formats[2] = mal_format_s32;
#else
MAL_SDL_AudioSpec desiredSpec, obtainedSpec;
MAL_SDL_AudioSpec desiredSpec, obtainedSpec;
mal_zero_memory(&desiredSpec, sizeof(desiredSpec));
mal_zero_memory(&desiredSpec, sizeof(desiredSpec));
...
@@ -14447,6 +14462,7 @@ mal_result mal_context_get_device_info__sdl(mal_context* pContext, mal_device_ty
...
@@ -14447,6 +14462,7 @@ mal_result mal_context_get_device_info__sdl(mal_context* pContext, mal_device_ty
} else {
} else {
return MAL_FORMAT_NOT_SUPPORTED;
return MAL_FORMAT_NOT_SUPPORTED;
}
}
#endif
return MAL_SUCCESS;
return MAL_SUCCESS;
}
}
...
...
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