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
15aa7769
Commit
15aa7769
authored
Mar 26, 2023
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code rearrangement in preparation for some updates.
parent
4cd06680
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
miniaudio.h
miniaudio.h
+20
-13
No files found.
miniaudio.h
View file @
15aa7769
...
...
@@ -50339,6 +50339,26 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
/* Clamp the gain. */
gain = ma_clamp(gain, ma_spatializer_get_min_gain(pSpatializer), ma_spatializer_get_max_gain(pSpatializer));
/*
The gain needs to be applied per-channel here. The spatialization code below will be changing the per-channel
gains which will then eventually be passed into the gainer which will deal with smoothing the gain transitions
to avoid harsh changes in gain.
*/
for (iChannel = 0; iChannel < channelsOut; iChannel += 1) {
pSpatializer->pNewChannelGainsOut[iChannel] = gain;
}
/*
Convert to our output channel count. If the listener is disabled we just output silence here. We cannot ignore
the whole section of code here because we need to update some internal spatialization state.
*/
if (ma_spatializer_listener_is_enabled(pListener)) {
ma_channel_map_apply_f32((float*)pFramesOut, pChannelMapOut, channelsOut, (const float*)pFramesIn, pChannelMapIn, channelsIn, frameCount, ma_channel_mix_mode_rectangular, ma_mono_expansion_mode_default);
} else {
ma_silence_pcm_frames(pFramesOut, frameCount, ma_format_f32, pSpatializer->channelsOut);
}
/*
Panning. This is where we'll apply the gain and convert to the output channel count. We have an optimized path for
when we're converting to a mono stream. In that case we don't really need to do any panning - we just apply the
...
...
@@ -50360,19 +50380,6 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
be +1 on the X axis. A dot product is performed against the direction vector of the channel and the normalized
position of the sound.
*/
for (iChannel = 0; iChannel < channelsOut; iChannel += 1) {
pSpatializer->pNewChannelGainsOut[iChannel] = gain;
}
/*
Convert to our output channel count. If the listener is disabled we just output silence here. We cannot ignore
the whole section of code here because we need to update some internal spatialization state.
*/
if (ma_spatializer_listener_is_enabled(pListener)) {
ma_channel_map_apply_f32((float*)pFramesOut, pChannelMapOut, channelsOut, (const float*)pFramesIn, pChannelMapIn, channelsIn, frameCount, ma_channel_mix_mode_rectangular, ma_mono_expansion_mode_default);
} else {
ma_silence_pcm_frames(pFramesOut, frameCount, ma_format_f32, pSpatializer->channelsOut);
}
/*
Calculate our per-channel gains. We do this based on the normalized relative position of the sound and it's
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