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
582a8798
Commit
582a8798
authored
Aug 11, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add standard channel map based on FreeBSD's sound(4) man page.
parent
93e2d23e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
4 deletions
+92
-4
mini_al.h
mini_al.h
+92
-4
No files found.
mini_al.h
View file @
582a8798
...
@@ -587,6 +587,7 @@ typedef enum
...
@@ -587,6 +587,7 @@ typedef enum
mal_standard_channel_map_rfc3551, // Based off AIFF.
mal_standard_channel_map_rfc3551, // Based off AIFF.
mal_standard_channel_map_flac,
mal_standard_channel_map_flac,
mal_standard_channel_map_vorbis,
mal_standard_channel_map_vorbis,
mal_standard_channel_map_sound4, // FreeBSD's sound(4).
mal_standard_channel_map_sndio, // www.sndio.org/tips.html
mal_standard_channel_map_sndio, // www.sndio.org/tips.html
mal_standard_channel_map_default = mal_standard_channel_map_microsoft
mal_standard_channel_map_default = mal_standard_channel_map_microsoft
} mal_standard_channel_map;
} mal_standard_channel_map;
...
@@ -16073,8 +16074,8 @@ mal_result mal_device_init__audioio(mal_context* pContext, mal_device_type devic
...
@@ -16073,8 +16074,8 @@ mal_result mal_device_init__audioio(mal_context* pContext, mal_device_type devic
// For the channel map, I'm not sure how to query the channel map (or if it's even possible). I'm just
// For the channel map, I'm not sure how to query the channel map (or if it's even possible). I'm just
// using
mini_al's default channel map for now
.
// using
the channels defined in FreeBSD's sound(4) man page
.
mal_get_standard_channel_map(mal_standard_channel_map_
default
, pDevice->internalChannels, pDevice->internalChannelMap);
mal_get_standard_channel_map(mal_standard_channel_map_
sound4
, pDevice->internalChannels, pDevice->internalChannelMap);
// When not using MMAP mode we need to use an intermediary buffer to the data transfer between the client
// When not using MMAP mode we need to use an intermediary buffer to the data transfer between the client
...
@@ -16529,8 +16530,8 @@ mal_result mal_device_init__oss(mal_context* pContext, mal_device_type type, con
...
@@ -16529,8 +16530,8 @@ mal_result mal_device_init__oss(mal_context* pContext, mal_device_type type, con
pDevice->periods = (mal_uint32)(ossFragment >> 16);
pDevice->periods = (mal_uint32)(ossFragment >> 16);
pDevice->bufferSizeInFrames = (mal_uint32)(pDevice->oss.fragmentSizeInFrames * pDevice->periods);
pDevice->bufferSizeInFrames = (mal_uint32)(pDevice->oss.fragmentSizeInFrames * pDevice->periods);
// Set the internal channel map. Not sure if this can be queried. For now just using
our default assumptions
.
// Set the internal channel map. Not sure if this can be queried. For now just using
the channel layouts defined in FreeBSD's sound(4) man page
.
mal_get_standard_channel_map(mal_standard_channel_map_
default
, pDevice->internalChannels, pDevice->internalChannelMap);
mal_get_standard_channel_map(mal_standard_channel_map_
sound4
, pDevice->internalChannels, pDevice->internalChannelMap);
// When not using MMAP mode, we need to use an intermediary buffer for the client <-> device transfer. We do
// When not using MMAP mode, we need to use an intermediary buffer for the client <-> device transfer. We do
...
@@ -20503,6 +20504,88 @@ void mal_get_standard_channel_map_vorbis(mal_uint32 channels, mal_channel channe
...
@@ -20503,6 +20504,88 @@ void mal_get_standard_channel_map_vorbis(mal_uint32 channels, mal_channel channe
}
}
}
}
void mal_get_standard_channel_map_sound4(mal_uint32 channels, mal_channel channelMap[MAL_MAX_CHANNELS])
{
switch (channels)
{
case 1:
{
channelMap[0] = MAL_CHANNEL_MONO;
} break;
case 2:
{
channelMap[0] = MAL_CHANNEL_LEFT;
channelMap[1] = MAL_CHANNEL_RIGHT;
} break;
case 3:
{
channelMap[0] = MAL_CHANNEL_FRONT_LEFT;
channelMap[1] = MAL_CHANNEL_FRONT_RIGHT;
channelMap[2] = MAL_CHANNEL_BACK_CENTER;
} break;
case 4:
{
channelMap[0] = MAL_CHANNEL_FRONT_LEFT;
channelMap[1] = MAL_CHANNEL_FRONT_RIGHT;
channelMap[2] = MAL_CHANNEL_BACK_LEFT;
channelMap[3] = MAL_CHANNEL_BACK_RIGHT;
} break;
case 5:
{
channelMap[0] = MAL_CHANNEL_FRONT_LEFT;
channelMap[1] = MAL_CHANNEL_FRONT_RIGHT;
channelMap[2] = MAL_CHANNEL_BACK_LEFT;
channelMap[3] = MAL_CHANNEL_BACK_RIGHT;
channelMap[4] = MAL_CHANNEL_FRONT_CENTER;
} break;
case 6:
{
channelMap[0] = MAL_CHANNEL_FRONT_LEFT;
channelMap[1] = MAL_CHANNEL_FRONT_RIGHT;
channelMap[2] = MAL_CHANNEL_BACK_LEFT;
channelMap[3] = MAL_CHANNEL_BACK_RIGHT;
channelMap[4] = MAL_CHANNEL_FRONT_CENTER;
channelMap[5] = MAL_CHANNEL_LFE;
} break;
case 7:
{
channelMap[0] = MAL_CHANNEL_FRONT_LEFT;
channelMap[1] = MAL_CHANNEL_FRONT_RIGHT;
channelMap[2] = MAL_CHANNEL_BACK_LEFT;
channelMap[3] = MAL_CHANNEL_BACK_RIGHT;
channelMap[4] = MAL_CHANNEL_FRONT_CENTER;
channelMap[5] = MAL_CHANNEL_BACK_CENTER;
channelMap[6] = MAL_CHANNEL_LFE;
} break;
case 8:
default:
{
channelMap[0] = MAL_CHANNEL_FRONT_LEFT;
channelMap[1] = MAL_CHANNEL_FRONT_RIGHT;
channelMap[2] = MAL_CHANNEL_BACK_LEFT;
channelMap[3] = MAL_CHANNEL_BACK_RIGHT;
channelMap[4] = MAL_CHANNEL_FRONT_CENTER;
channelMap[5] = MAL_CHANNEL_LFE;
channelMap[6] = MAL_CHANNEL_SIDE_LEFT;
channelMap[7] = MAL_CHANNEL_SIDE_RIGHT;
} break;
}
// Remainder.
if (channels > 8) {
for (mal_uint32 iChannel = 8; iChannel < MAL_MAX_CHANNELS; ++iChannel) {
channelMap[iChannel] = (mal_channel)(MAL_CHANNEL_AUX_0 + (iChannel-8));
}
}
}
void mal_get_standard_channel_map_sndio(mal_uint32 channels, mal_channel channelMap[MAL_MAX_CHANNELS])
void mal_get_standard_channel_map_sndio(mal_uint32 channels, mal_channel channelMap[MAL_MAX_CHANNELS])
{
{
switch (channels)
switch (channels)
...
@@ -20585,6 +20668,11 @@ void mal_get_standard_channel_map(mal_standard_channel_map standardChannelMap, m
...
@@ -20585,6 +20668,11 @@ void mal_get_standard_channel_map(mal_standard_channel_map standardChannelMap, m
{
{
mal_get_standard_channel_map_vorbis(channels, channelMap);
mal_get_standard_channel_map_vorbis(channels, channelMap);
} break;
} break;
case mal_standard_channel_map_sound4:
{
mal_get_standard_channel_map_sound4(channels, channelMap);
} break;
case mal_standard_channel_map_sndio:
case mal_standard_channel_map_sndio:
{
{
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