feat: add per-channel audio capture with OPL/FM voice isolation#35
Open
pedrocatalao wants to merge 2 commits into
Open
feat: add per-channel audio capture with OPL/FM voice isolation#35pedrocatalao wants to merge 2 commits into
pedrocatalao wants to merge 2 commits into
Conversation
Adds opt-in per-channel audio isolation for both PCM and OPL/FM synthesis
paths, accessible via the "render.channel_capture" CTL.
PCM isolation: CSoundFile::CreateStereoMix() snapshots MixSoundBuffer
before and after each MixChannel() call, accumulating each channel's
isolated contribution in m_channelCaptureBuf.
OPL/FM isolation: Opal::Output() captures each voice's left-channel value
before summation into m_voiceOut[]. OPL::Mix() reads these per-frame and
stores them in m_voiceFrames[voice][frame], scaled to mix-buffer amplitude.
New public API (C and C++):
get_current_channel_audio_mono(channel, count, buf)
get_current_channel_audio_stereo(channel, count, buf_left, buf_right)
Both functions combine PCM and OPL contributions transparently, so callers
do not need to know which synthesis path a channel is using. Data is valid
after read() and before the next read() call.
Usage:
module.ctl_set_boolean("render.channel_capture", true);
module.read_float_mono(samplerate, count, master_out);
module.get_current_channel_audio_mono(ch, count, ch_out);
…ce output fallback logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds opt-in per-channel audio isolation for both PCM and OPL/FM synthesis paths, accessible via the "render.channel_capture" CTL.
PCM isolation: CSoundFile::CreateStereoMix() snapshots MixSoundBuffer before and after each MixChannel() call, accumulating each channel's isolated contribution in m_channelCaptureBuf.
OPL/FM isolation: Opal::Output() captures each voice's left-channel value before summation into m_voiceOut[]. OPL::Mix() reads these per-frame and stores them in m_voiceFrames[voice][frame], scaled to mix-buffer amplitude.
New public API (C and C++):
get_current_channel_audio_mono(channel, count, buf)
get_current_channel_audio_stereo(channel, count, buf_left, buf_right)
Both functions combine PCM and OPL contributions transparently, so callers do not need to know which synthesis path a channel is using. Data is valid after read() and before the next read() call.
Usage:
module.ctl_set_boolean("render.channel_capture", true);
module.read_float_mono(samplerate, count, master_out);
module.get_current_channel_audio_mono(ch, count, ch_out);