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
f2934b13
Commit
f2934b13
authored
Mar 07, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Core Audio: Fix warnings for non-Desktop Apple platforms.
parent
fbdad2d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
69 deletions
+71
-69
miniaudio.h
miniaudio.h
+71
-69
No files found.
miniaudio.h
View file @
f2934b13
...
@@ -21245,7 +21245,9 @@ typedef OSStatus (* ma_AudioUnitRender_proc)(AudioUnit inUnit, AudioUnitRenderAc
...
@@ -21245,7 +21245,9 @@ typedef OSStatus (* ma_AudioUnitRender_proc)(AudioUnit inUnit, AudioUnitRenderAc
#define MA_COREAUDIO_OUTPUT_BUS 0
#define MA_COREAUDIO_OUTPUT_BUS 0
#define MA_COREAUDIO_INPUT_BUS 1
#define MA_COREAUDIO_INPUT_BUS 1
#if defined(MA_APPLE_DESKTOP)
static ma_result ma_device_reinit_internal__coreaudio(ma_device* pDevice, ma_device_type deviceType, ma_bool32 disposePreviousAudioUnit);
static ma_result ma_device_reinit_internal__coreaudio(ma_device* pDevice, ma_device_type deviceType, ma_bool32 disposePreviousAudioUnit);
#endif
/*
/*
Core Audio
Core Audio
...
@@ -21330,6 +21332,72 @@ static ma_channel ma_channel_from_AudioChannelBitmap(AudioChannelBitmap bit)
...
@@ -21330,6 +21332,72 @@ static ma_channel ma_channel_from_AudioChannelBitmap(AudioChannelBitmap bit)
}
}
#endif
#endif
static ma_result ma_format_from_AudioStreamBasicDescription(const AudioStreamBasicDescription* pDescription, ma_format* pFormatOut)
{
MA_ASSERT(pDescription != NULL);
MA_ASSERT(pFormatOut != NULL);
*pFormatOut = ma_format_unknown; /* Safety. */
/* There's a few things miniaudio doesn't support. */
if (pDescription->mFormatID != kAudioFormatLinearPCM) {
return MA_FORMAT_NOT_SUPPORTED;
}
/* We don't support any non-packed formats that are aligned high. */
if ((pDescription->mFormatFlags & kLinearPCMFormatFlagIsAlignedHigh) != 0) {
return MA_FORMAT_NOT_SUPPORTED;
}
/* Only supporting native-endian. */
if ((ma_is_little_endian() && (pDescription->mFormatFlags & kAudioFormatFlagIsBigEndian) != 0) || (ma_is_big_endian() && (pDescription->mFormatFlags & kAudioFormatFlagIsBigEndian) == 0)) {
return MA_FORMAT_NOT_SUPPORTED;
}
/* We are not currently supporting non-interleaved formats (this will be added in a future version of miniaudio). */
/*if ((pDescription->mFormatFlags & kAudioFormatFlagIsNonInterleaved) != 0) {
return MA_FORMAT_NOT_SUPPORTED;
}*/
if ((pDescription->mFormatFlags & kLinearPCMFormatFlagIsFloat) != 0) {
if (pDescription->mBitsPerChannel == 32) {
*pFormatOut = ma_format_f32;
return MA_SUCCESS;
}
} else {
if ((pDescription->mFormatFlags & kLinearPCMFormatFlagIsSignedInteger) != 0) {
if (pDescription->mBitsPerChannel == 16) {
*pFormatOut = ma_format_s16;
return MA_SUCCESS;
} else if (pDescription->mBitsPerChannel == 24) {
if (pDescription->mBytesPerFrame == (pDescription->mBitsPerChannel/8 * pDescription->mChannelsPerFrame)) {
*pFormatOut = ma_format_s24;
return MA_SUCCESS;
} else {
if (pDescription->mBytesPerFrame/pDescription->mChannelsPerFrame == sizeof(ma_int32)) {
/* TODO: Implement ma_format_s24_32. */
/**pFormatOut = ma_format_s24_32;*/
/*return MA_SUCCESS;*/
return MA_FORMAT_NOT_SUPPORTED;
}
}
} else if (pDescription->mBitsPerChannel == 32) {
*pFormatOut = ma_format_s32;
return MA_SUCCESS;
}
} else {
if (pDescription->mBitsPerChannel == 8) {
*pFormatOut = ma_format_u8;
return MA_SUCCESS;
}
}
}
/* Getting here means the format is not supported. */
return MA_FORMAT_NOT_SUPPORTED;
}
#if defined(MA_APPLE_DESKTOP)
static ma_channel ma_channel_from_AudioChannelLabel(AudioChannelLabel label)
static ma_channel ma_channel_from_AudioChannelLabel(AudioChannelLabel label)
{
{
switch (label)
switch (label)
...
@@ -21424,71 +21492,6 @@ static ma_channel ma_channel_from_AudioChannelLabel(AudioChannelLabel label)
...
@@ -21424,71 +21492,6 @@ static ma_channel ma_channel_from_AudioChannelLabel(AudioChannelLabel label)
}
}
}
}
static ma_result ma_format_from_AudioStreamBasicDescription(const AudioStreamBasicDescription* pDescription, ma_format* pFormatOut)
{
MA_ASSERT(pDescription != NULL);
MA_ASSERT(pFormatOut != NULL);
*pFormatOut = ma_format_unknown; /* Safety. */
/* There's a few things miniaudio doesn't support. */
if (pDescription->mFormatID != kAudioFormatLinearPCM) {
return MA_FORMAT_NOT_SUPPORTED;
}
/* We don't support any non-packed formats that are aligned high. */
if ((pDescription->mFormatFlags & kLinearPCMFormatFlagIsAlignedHigh) != 0) {
return MA_FORMAT_NOT_SUPPORTED;
}
/* Only supporting native-endian. */
if ((ma_is_little_endian() && (pDescription->mFormatFlags & kAudioFormatFlagIsBigEndian) != 0) || (ma_is_big_endian() && (pDescription->mFormatFlags & kAudioFormatFlagIsBigEndian) == 0)) {
return MA_FORMAT_NOT_SUPPORTED;
}
/* We are not currently supporting non-interleaved formats (this will be added in a future version of miniaudio). */
/*if ((pDescription->mFormatFlags & kAudioFormatFlagIsNonInterleaved) != 0) {
return MA_FORMAT_NOT_SUPPORTED;
}*/
if ((pDescription->mFormatFlags & kLinearPCMFormatFlagIsFloat) != 0) {
if (pDescription->mBitsPerChannel == 32) {
*pFormatOut = ma_format_f32;
return MA_SUCCESS;
}
} else {
if ((pDescription->mFormatFlags & kLinearPCMFormatFlagIsSignedInteger) != 0) {
if (pDescription->mBitsPerChannel == 16) {
*pFormatOut = ma_format_s16;
return MA_SUCCESS;
} else if (pDescription->mBitsPerChannel == 24) {
if (pDescription->mBytesPerFrame == (pDescription->mBitsPerChannel/8 * pDescription->mChannelsPerFrame)) {
*pFormatOut = ma_format_s24;
return MA_SUCCESS;
} else {
if (pDescription->mBytesPerFrame/pDescription->mChannelsPerFrame == sizeof(ma_int32)) {
/* TODO: Implement ma_format_s24_32. */
/**pFormatOut = ma_format_s24_32;*/
/*return MA_SUCCESS;*/
return MA_FORMAT_NOT_SUPPORTED;
}
}
} else if (pDescription->mBitsPerChannel == 32) {
*pFormatOut = ma_format_s32;
return MA_SUCCESS;
}
} else {
if (pDescription->mBitsPerChannel == 8) {
*pFormatOut = ma_format_u8;
return MA_SUCCESS;
}
}
}
/* Getting here means the format is not supported. */
return MA_FORMAT_NOT_SUPPORTED;
}
static ma_result ma_get_channel_map_from_AudioChannelLayout(AudioChannelLayout* pChannelLayout, ma_channel channelMap[MA_MAX_CHANNELS])
static ma_result ma_get_channel_map_from_AudioChannelLayout(AudioChannelLayout* pChannelLayout, ma_channel channelMap[MA_MAX_CHANNELS])
{
{
MA_ASSERT(pChannelLayout != NULL);
MA_ASSERT(pChannelLayout != NULL);
...
@@ -21566,8 +21569,6 @@ static ma_result ma_get_channel_map_from_AudioChannelLayout(AudioChannelLayout*
...
@@ -21566,8 +21569,6 @@ static ma_result ma_get_channel_map_from_AudioChannelLayout(AudioChannelLayout*
return MA_SUCCESS;
return MA_SUCCESS;
}
}
#if defined(MA_APPLE_DESKTOP)
static ma_result ma_get_device_object_ids__coreaudio(ma_context* pContext, UInt32* pDeviceCount, AudioObjectID** ppDeviceObjectIDs) /* NOTE: Free the returned buffer with ma_free(). */
static ma_result ma_get_device_object_ids__coreaudio(ma_context* pContext, UInt32* pDeviceCount, AudioObjectID** ppDeviceObjectIDs) /* NOTE: Free the returned buffer with ma_free(). */
{
{
AudioObjectPropertyAddress propAddressDevices;
AudioObjectPropertyAddress propAddressDevices;
...
@@ -22324,7 +22325,6 @@ static ma_result ma_find_best_format__coreaudio(ma_context* pContext, AudioObjec
...
@@ -22324,7 +22325,6 @@ static ma_result ma_find_best_format__coreaudio(ma_context* pContext, AudioObjec
ma_free(pDeviceFormatDescriptions, &pContext->allocationCallbacks);
ma_free(pDeviceFormatDescriptions, &pContext->allocationCallbacks);
return MA_SUCCESS;
return MA_SUCCESS;
}
}
#endif
static ma_result ma_get_AudioUnit_channel_map(ma_context* pContext, AudioUnit audioUnit, ma_device_type deviceType, ma_channel channelMap[MA_MAX_CHANNELS])
static ma_result ma_get_AudioUnit_channel_map(ma_context* pContext, AudioUnit audioUnit, ma_device_type deviceType, ma_channel channelMap[MA_MAX_CHANNELS])
{
{
...
@@ -22370,6 +22370,7 @@ static ma_result ma_get_AudioUnit_channel_map(ma_context* pContext, AudioUnit au
...
@@ -22370,6 +22370,7 @@ static ma_result ma_get_AudioUnit_channel_map(ma_context* pContext, AudioUnit au
ma__free_from_callbacks(pChannelLayout, &pContext->allocationCallbacks);
ma__free_from_callbacks(pChannelLayout, &pContext->allocationCallbacks);
return MA_SUCCESS;
return MA_SUCCESS;
}
}
#endif /* MA_APPLE_DESKTOP */
static ma_bool32 ma_context_is_device_id_equal__coreaudio(ma_context* pContext, const ma_device_id* pID0, const ma_device_id* pID1)
static ma_bool32 ma_context_is_device_id_equal__coreaudio(ma_context* pContext, const ma_device_id* pID0, const ma_device_id* pID1)
{
{
...
@@ -23624,6 +23625,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
...
@@ -23624,6 +23625,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
return result;
return result;
}
}
#if defined(MA_APPLE_DESKTOP)
static ma_result ma_device_reinit_internal__coreaudio(ma_device* pDevice, ma_device_type deviceType, ma_bool32 disposePreviousAudioUnit)
static ma_result ma_device_reinit_internal__coreaudio(ma_device* pDevice, ma_device_type deviceType, ma_bool32 disposePreviousAudioUnit)
{
{
ma_device_init_internal_data__coreaudio data;
ma_device_init_internal_data__coreaudio data;
...
@@ -23713,7 +23715,7 @@ static ma_result ma_device_reinit_internal__coreaudio(ma_device* pDevice, ma_dev
...
@@ -23713,7 +23715,7 @@ static ma_result ma_device_reinit_internal__coreaudio(ma_device* pDevice, ma_dev
return MA_SUCCESS;
return MA_SUCCESS;
}
}
#endif /* MA_APPLE_DESKTOP */
static ma_result ma_device_init__coreaudio(ma_context* pContext, const ma_device_config* pConfig, ma_device* pDevice)
static ma_result ma_device_init__coreaudio(ma_context* pContext, const ma_device_config* pConfig, ma_device* pDevice)
{
{
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