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
21c3f3ad
Commit
21c3f3ad
authored
Nov 05, 2017
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prep work for improving channel mixing.
parent
a0e5997b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
mini_al.h
mini_al.h
+16
-10
No files found.
mini_al.h
View file @
21c3f3ad
...
@@ -9033,7 +9033,7 @@ static void mal_rearrange_channels(void* pFrame, mal_uint32 channels, mal_uint8
...
@@ -9033,7 +9033,7 @@ static void mal_rearrange_channels(void* pFrame, mal_uint32 channels, mal_uint8
}
}
}
}
static
void
mal_dsp_mix_channels__dec
(
float
*
pFramesOut
,
mal_uint32
channelsOut
,
const
float
*
pFramesIn
,
mal_uint32
channelsIn
,
mal_uint32
frameCount
,
mal_channel_mix_mode
mode
)
static
void
mal_dsp_mix_channels__dec
(
float
*
pFramesOut
,
mal_uint32
channelsOut
,
const
mal_uint8
channelMapOut
[
MAL_MAX_CHANNELS
],
const
float
*
pFramesIn
,
mal_uint32
channelsIn
,
const
mal_uint8
channelMapIn
[
MAL_MAX_CHANNELS
]
,
mal_uint32
frameCount
,
mal_channel_mix_mode
mode
)
{
{
mal_assert
(
pFramesOut
!=
NULL
);
mal_assert
(
pFramesOut
!=
NULL
);
mal_assert
(
channelsOut
>
0
);
mal_assert
(
channelsOut
>
0
);
...
@@ -9041,6 +9041,9 @@ static void mal_dsp_mix_channels__dec(float* pFramesOut, mal_uint32 channelsOut,
...
@@ -9041,6 +9041,9 @@ static void mal_dsp_mix_channels__dec(float* pFramesOut, mal_uint32 channelsOut,
mal_assert
(
channelsIn
>
0
);
mal_assert
(
channelsIn
>
0
);
mal_assert
(
channelsOut
<
channelsIn
);
mal_assert
(
channelsOut
<
channelsIn
);
(
void
)
channelMapOut
;
(
void
)
channelMapIn
;
if
(
mode
==
mal_channel_mix_mode_basic
)
{
if
(
mode
==
mal_channel_mix_mode_basic
)
{
// Basic mode is where we just drop excess channels.
// Basic mode is where we just drop excess channels.
for
(
mal_uint32
iFrame
=
0
;
iFrame
<
frameCount
;
++
iFrame
)
{
for
(
mal_uint32
iFrame
=
0
;
iFrame
<
frameCount
;
++
iFrame
)
{
...
@@ -9094,15 +9097,15 @@ static void mal_dsp_mix_channels__dec(float* pFramesOut, mal_uint32 channelsOut,
...
@@ -9094,15 +9097,15 @@ static void mal_dsp_mix_channels__dec(float* pFramesOut, mal_uint32 channelsOut,
}
}
}
else
if
(
channelsOut
==
2
)
{
}
else
if
(
channelsOut
==
2
)
{
// TODO: Implement proper stereo blending.
// TODO: Implement proper stereo blending.
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
pFramesIn
,
channels
In
,
frameCount
,
mal_channel_mix_mode_basic
);
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
channelMapOut
,
pFramesIn
,
channelsIn
,
channelMap
In
,
frameCount
,
mal_channel_mix_mode_basic
);
}
else
{
}
else
{
// Fall back to basic mode.
// Fall back to basic mode.
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
pFramesIn
,
channels
In
,
frameCount
,
mal_channel_mix_mode_basic
);
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
channelMapOut
,
pFramesIn
,
channelsIn
,
channelMap
In
,
frameCount
,
mal_channel_mix_mode_basic
);
}
}
}
}
}
}
static
void
mal_dsp_mix_channels__inc
(
float
*
pFramesOut
,
mal_uint32
channelsOut
,
const
float
*
pFramesIn
,
mal_uint32
channelsIn
,
mal_uint32
frameCount
,
mal_channel_mix_mode
mode
)
static
void
mal_dsp_mix_channels__inc
(
float
*
pFramesOut
,
mal_uint32
channelsOut
,
const
mal_uint8
channelMapOut
[
MAL_MAX_CHANNELS
],
const
float
*
pFramesIn
,
mal_uint32
channelsIn
,
const
mal_uint8
channelMapIn
[
MAL_MAX_CHANNELS
]
,
mal_uint32
frameCount
,
mal_channel_mix_mode
mode
)
{
{
mal_assert
(
pFramesOut
!=
NULL
);
mal_assert
(
pFramesOut
!=
NULL
);
mal_assert
(
channelsOut
>
0
);
mal_assert
(
channelsOut
>
0
);
...
@@ -9110,6 +9113,9 @@ static void mal_dsp_mix_channels__inc(float* pFramesOut, mal_uint32 channelsOut,
...
@@ -9110,6 +9113,9 @@ static void mal_dsp_mix_channels__inc(float* pFramesOut, mal_uint32 channelsOut,
mal_assert
(
channelsIn
>
0
);
mal_assert
(
channelsIn
>
0
);
mal_assert
(
channelsOut
>
channelsIn
);
mal_assert
(
channelsOut
>
channelsIn
);
(
void
)
channelMapOut
;
(
void
)
channelMapIn
;
if
(
mode
==
mal_channel_mix_mode_basic
)
{
\
if
(
mode
==
mal_channel_mix_mode_basic
)
{
\
// Basic mode is where we just zero out extra channels.
// Basic mode is where we just zero out extra channels.
for
(
mal_uint32
iFrame
=
0
;
iFrame
<
frameCount
;
++
iFrame
)
{
for
(
mal_uint32
iFrame
=
0
;
iFrame
<
frameCount
;
++
iFrame
)
{
...
@@ -9182,22 +9188,22 @@ static void mal_dsp_mix_channels__inc(float* pFramesOut, mal_uint32 channelsOut,
...
@@ -9182,22 +9188,22 @@ static void mal_dsp_mix_channels__inc(float* pFramesOut, mal_uint32 channelsOut,
}
}
}
else
if
(
channelsIn
==
2
)
{
}
else
if
(
channelsIn
==
2
)
{
// TODO: Implement an optimized stereo conversion.
// TODO: Implement an optimized stereo conversion.
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
pFramesIn
,
channels
In
,
frameCount
,
mal_channel_mix_mode_basic
);
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
channelMapOut
,
pFramesIn
,
channelsIn
,
channelMap
In
,
frameCount
,
mal_channel_mix_mode_basic
);
}
else
{
}
else
{
// Fall back to basic mixing mode.
// Fall back to basic mixing mode.
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
pFramesIn
,
channels
In
,
frameCount
,
mal_channel_mix_mode_basic
);
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
channelMapOut
,
pFramesIn
,
channelsIn
,
channelMap
In
,
frameCount
,
mal_channel_mix_mode_basic
);
}
}
}
}
}
}
static
void
mal_dsp_mix_channels
(
float
*
pFramesOut
,
mal_uint32
channelsOut
,
const
float
*
pFramesIn
,
mal_uint32
channelsIn
,
mal_uint32
frameCount
,
mal_channel_mix_mode
mode
)
static
void
mal_dsp_mix_channels
(
float
*
pFramesOut
,
mal_uint32
channelsOut
,
const
mal_uint8
channelMapOut
[
MAL_MAX_CHANNELS
],
const
float
*
pFramesIn
,
mal_uint32
channelsIn
,
const
mal_uint8
channelMapIn
[
MAL_MAX_CHANNELS
]
,
mal_uint32
frameCount
,
mal_channel_mix_mode
mode
)
{
{
if
(
channelsIn
<
channelsOut
)
{
if
(
channelsIn
<
channelsOut
)
{
// Increasing the channel count.
// Increasing the channel count.
mal_dsp_mix_channels__inc
(
pFramesOut
,
channelsOut
,
pFramesIn
,
channels
In
,
frameCount
,
mode
);
mal_dsp_mix_channels__inc
(
pFramesOut
,
channelsOut
,
channelMapOut
,
pFramesIn
,
channelsIn
,
channelMap
In
,
frameCount
,
mode
);
}
else
{
}
else
{
// Decreasing the channel count.
// Decreasing the channel count.
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
pFramesIn
,
channels
In
,
frameCount
,
mode
);
mal_dsp_mix_channels__dec
(
pFramesOut
,
channelsOut
,
channelMapOut
,
pFramesIn
,
channelsIn
,
channelMap
In
,
frameCount
,
mode
);
}
}
}
}
...
@@ -9350,7 +9356,7 @@ mal_uint32 mal_dsp_read_frames(mal_dsp* pDSP, mal_uint32 frameCount, void* pFram
...
@@ -9350,7 +9356,7 @@ mal_uint32 mal_dsp_read_frames(mal_dsp* pDSP, mal_uint32 frameCount, void* pFram
pFramesFormat
[
iFrames
]
=
mal_format_f32
;
pFramesFormat
[
iFrames
]
=
mal_format_f32
;
}
}
mal_dsp_mix_channels
((
float
*
)(
pFrames
[(
iFrames
+
1
)
%
2
]),
pDSP
->
config
.
channelsOut
,
(
const
float
*
)(
pFrames
[
iFrames
]),
pDSP
->
config
.
channels
In
,
framesRead
,
mal_channel_mix_mode_blend
);
mal_dsp_mix_channels
((
float
*
)(
pFrames
[(
iFrames
+
1
)
%
2
]),
pDSP
->
config
.
channelsOut
,
pDSP
->
config
.
channelMapOut
,
(
const
float
*
)(
pFrames
[
iFrames
]),
pDSP
->
config
.
channelsIn
,
pDSP
->
config
.
channelMap
In
,
framesRead
,
mal_channel_mix_mode_blend
);
iFrames
=
(
iFrames
+
1
)
%
2
;
iFrames
=
(
iFrames
+
1
)
%
2
;
pFramesFormat
[
iFrames
]
=
mal_format_f32
;
pFramesFormat
[
iFrames
]
=
mal_format_f32
;
}
}
...
...
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