-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fill sidechainMix from external sidechain input. This fixes lp1876222 #2743
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bb58f66
Fill sidechainMix from external sidechain input. This fixes lp1876222
daschuer 64abeda
Improve comments
daschuer 4d60739
guard more copy calls with if (m_pEngineSideChain)
daschuer d00f2ca
Added EngineMaster::sidechainMixRequired() function for a repeated co…
daschuer 95cd14a
update CHANGELOG
daschuer 89e99fb
make sidechainMixRequired const
daschuer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -153,7 +153,9 @@ EngineMaster::EngineMaster(UserSettingsPointer pConfig, | |||||
} | ||||||
|
||||||
// Starts a thread for recording and broadcast | ||||||
m_pEngineSideChain = bEnableSidechain ? new EngineSideChain(pConfig) : NULL; | ||||||
m_pEngineSideChain = | ||||||
bEnableSidechain ? | ||||||
new EngineSideChain(pConfig, m_pSidechainMix) : nullptr; | ||||||
|
||||||
// X-Fader Setup | ||||||
m_pXFaderMode = new ControlPushButton( | ||||||
|
@@ -562,7 +564,7 @@ void EngineMaster::process(const int iBufferSize) { | |||||
m_masterGainOld = master_gain; | ||||||
|
||||||
// Record/broadcast signal is the same as the master output | ||||||
if (!m_bExternalRecordBroadcastInputConnected) { | ||||||
if (sidechainMixRequired()) { | ||||||
SampleUtil::copy(m_pSidechainMix, m_pMaster, m_iBufferSize); | ||||||
} | ||||||
} else if (configuredMicMonitorMode == MicMonitorMode::MASTER_AND_BOOTH) { | ||||||
|
@@ -599,7 +601,7 @@ void EngineMaster::process(const int iBufferSize) { | |||||
m_masterGainOld = master_gain; | ||||||
|
||||||
// Record/broadcast signal is the same as the master output | ||||||
if (!m_bExternalRecordBroadcastInputConnected) { | ||||||
if (sidechainMixRequired()) { | ||||||
SampleUtil::copy(m_pSidechainMix, m_pMaster, m_iBufferSize); | ||||||
} | ||||||
} else if (configuredMicMonitorMode == MicMonitorMode::DIRECT_MONITOR) { | ||||||
|
@@ -632,41 +634,42 @@ void EngineMaster::process(const int iBufferSize) { | |||||
SampleUtil::applyRampingGain(m_pMaster, m_masterGainOld, | ||||||
master_gain, m_iBufferSize); | ||||||
m_masterGainOld = master_gain; | ||||||
if (!m_bExternalRecordBroadcastInputConnected) { | ||||||
if (sidechainMixRequired()) { | ||||||
SampleUtil::copy(m_pSidechainMix, m_pMaster, m_iBufferSize); | ||||||
} | ||||||
|
||||||
// The talkover signal Mixxx receives is delayed by the round trip latency. | ||||||
// There is an output latency between the time Mixxx processes the audio | ||||||
// and the user hears it. So if the microphone user plays on beat with | ||||||
// what they hear, they will be playing out of sync with the engine's | ||||||
// processing by the output latency. Additionally, Mixxx gets input signals | ||||||
// delayed by the input latency. By the time Mixxx receives the input signal, | ||||||
// a full round trip through the signal chain has elapsed since Mixxx | ||||||
// processed the output signal. | ||||||
// Although Mixxx receives the input signal delayed, the user hears it mixed | ||||||
// in hardware with the master & booth outputs without that | ||||||
// latency, so to record/broadcast the same signal that is heard | ||||||
// on the master & booth outputs, the master mix must be delayed before | ||||||
// mixing the talkover signal for the record/broadcast mix. | ||||||
// If not using microphone inputs or recording/broadcasting from | ||||||
// a sound card input, skip unnecessary processing here. | ||||||
if (m_pNumMicsConfigured->get() > 0 | ||||||
&& !m_bExternalRecordBroadcastInputConnected) { | ||||||
// Copy the master mix to a separate buffer before delaying it | ||||||
// to avoid delaying the master output. | ||||||
m_pLatencyCompensationDelay->process(m_pSidechainMix, m_iBufferSize); | ||||||
SampleUtil::add(m_pSidechainMix, m_pTalkover, m_iBufferSize); | ||||||
if (m_pNumMicsConfigured->get() > 0) { | ||||||
// The talkover signal Mixxx receives is delayed by the round trip latency. | ||||||
// There is an output latency between the time Mixxx processes the audio | ||||||
// and the user hears it. So if the microphone user plays on beat with | ||||||
// what they hear, they will be playing out of sync with the engine's | ||||||
// processing by the output latency. Additionally, Mixxx gets input signals | ||||||
// delayed by the input latency. By the time Mixxx receives the input signal, | ||||||
// a full round trip through the signal chain has elapsed since Mixxx | ||||||
// processed the output signal. | ||||||
// Although Mixxx receives the input signal delayed, the user hears it mixed | ||||||
// in hardware with the master & booth outputs without that | ||||||
// latency, so to record/broadcast the same signal that is heard | ||||||
// on the master & booth outputs, the master mix must be delayed before | ||||||
// mixing the talkover signal for the record/broadcast mix. | ||||||
// If not using microphone inputs or recording/broadcasting from | ||||||
// a sound card input, skip unnecessary processing here. | ||||||
|
||||||
// Copy the master mix to a separate buffer before delaying it | ||||||
// to avoid delaying the master output. | ||||||
m_pLatencyCompensationDelay->process(m_pSidechainMix, m_iBufferSize); | ||||||
SampleUtil::add(m_pSidechainMix, m_pTalkover, m_iBufferSize); | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
// Submit buffer to the side chain to do broadcasting, recording, | ||||||
// etc. (CPU intensive non-realtime tasks) | ||||||
// If recording/broadcasting from a sound card input, | ||||||
// SoundManager will send the input buffer from the sound card to m_pSidechain | ||||||
// so skip sending a buffer to m_pSidechain here. | ||||||
if (!m_bExternalRecordBroadcastInputConnected | ||||||
&& m_pEngineSideChain != nullptr) { | ||||||
// Submit buffer to the side chain to do CPU intensive non-realtime | ||||||
// tasks like recording. The SoundDeviceNetwork, responsible for | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently (i.e. with this PR), SideChain is not used for broadcasting, only the pSidechainMix |
||||||
// passing samples to the network reads directly from m_pSidechainMix, | ||||||
// registering it with SoundDevice::addOutput(). | ||||||
// Note: In case the broadcast/recording input is configured, | ||||||
uklotzde marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
// EngineSideChain::receiveBuffer has copied the input buffer to m_pSidechainMix | ||||||
// via before (called by SoundManager::pushInputBuffers()) | ||||||
if (m_pEngineSideChain) { | ||||||
m_pEngineSideChain->writeSamples(m_pSidechainMix, iFrames); | ||||||
} | ||||||
|
||||||
|
@@ -963,3 +966,7 @@ void EngineMaster::registerNonEngineChannelSoundIO(SoundManager* pSoundManager) | |||||
} | ||||||
pSoundManager->registerOutput(AudioOutput(AudioOutput::RECORD_BROADCAST, 0, 2), this); | ||||||
} | ||||||
|
||||||
bool EngineMaster::sidechainMixRequired() const { | ||||||
return m_pEngineSideChain && !m_bExternalRecordBroadcastInputConnected; | ||||||
} |
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to match the GUI in the Sound Hardware Preferences