Skip to content
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

Full Ableton Link support #10999

Open
wants to merge 101 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
5412312
Ableton Link initial integration
spensbot Apr 12, 2021
36c3084
Apply pre-commit.patch from github check
spensbot Apr 13, 2021
5faedad
Copy ableton-link directly
spensbot Apr 13, 2021
bc30491
Merge remote-tracking branch 'upstream/main' into abeltonlink
JoergAtGithub Jun 21, 2022
250ff3e
Added ableton-link-dev to debian buildenv
JoergAtGithub Jun 21, 2022
a5d9ba3
Find installed Ableton Link
JoergAtGithub Jun 21, 2022
7bd8463
Fixed AbletonLink embedding
JoergAtGithub Jun 25, 2022
a80b6a6
Fixed typo: Call onCallbackEnd instead of onCallbackStart
JoergAtGithub Jul 3, 2022
12bbb2b
Removed unnecessary include statements
JoergAtGithub Jul 3, 2022
f5cbbaf
Pre-Commit
JoergAtGithub Jul 3, 2022
094f0cf
Use m_audioBufferMicros to determine the latency between CPU clock an…
JoergAtGithub Jul 4, 2022
96e2fc2
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Jul 4, 2022
2305770
Made AbletonLink compile in C++20 environment
JoergAtGithub Jul 5, 2022
9fb58bc
Added GUI controls for AbletonLink (Latenight Palemoon only)
JoergAtGithub Jul 5, 2022
11b2278
Pre-Commit
JoergAtGithub Jul 5, 2022
29c2eeb
Removed conflicting delay calculation code
JoergAtGithub Jul 5, 2022
8350ac5
Replaced full AbletonLink 3.03 copy in lib folder by stripped down ve…
JoergAtGithub Jul 5, 2022
550eaac
Build fixes
JoergAtGithub Jul 5, 2022
48630d3
Added ASIO to debian_buildenv.sh
JoergAtGithub Jul 5, 2022
abb3184
Added ASIO to debian_buildenv.sh
JoergAtGithub Jul 5, 2022
5b92646
Pre-Commit
JoergAtGithub Jul 5, 2022
97b6a15
Added local ASIO
JoergAtGithub Jul 5, 2022
65b1c7d
Fix clang link failure - missing latomic
JoergAtGithub Jul 6, 2022
7094a7f
Added ASIO CMake and copyright file
JoergAtGithub Jul 6, 2022
acec4c1
atomics check
JoergAtGithub Jul 6, 2022
d867974
_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING
JoergAtGithub Jul 6, 2022
b7e3373
Set numPeers CO in callback
JoergAtGithub Jul 6, 2022
7232525
Don't call callbacks if m_pAbletonLink is the initiator of the sync c…
JoergAtGithub Jul 6, 2022
f616307
Added CheckAtomic.cmake from KDE Krita project
JoergAtGithub Jul 6, 2022
89ac353
Pre-Commit
JoergAtGithub Jul 6, 2022
0677a51
C++20patch for Ableton Link
JoergAtGithub Jul 11, 2022
c7e5252
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Jul 23, 2022
dcbe94c
Reenabled abletonlink package for Debian, after Ubuntu upgrade
JoergAtGithub Jul 23, 2022
004983a
Find external AbletonLink again
JoergAtGithub Jul 23, 2022
cfc953c
Merge remote-tracking branch 'upstream/main' into abletonlink
JoergAtGithub Oct 23, 2022
c70bf47
Made bidirectional sync working
JoergAtGithub Oct 23, 2022
a20bb60
Made updateLeaderBeatDistance work
JoergAtGithub Oct 24, 2022
801d751
gcc Build fix
JoergAtGithub Oct 24, 2022
94ded3d
Pre-Commit fixes
JoergAtGithub Oct 24, 2022
995dd6c
Pre-Commit fixes
JoergAtGithub Oct 24, 2022
8299593
Reenabled/Fixed _HAS_DEPRECATED_RESULT_OF to build AbletonLink with C…
JoergAtGithub Nov 1, 2022
781af4d
Updated to Windows/MacOS buildenv with Ableton-Link included
JoergAtGithub Nov 3, 2022
33ecd03
Removed local copy of Ableton Link in lib folder
JoergAtGithub Nov 3, 2022
62101bd
Determine beat distance only once after scratching seeking
JoergAtGithub Nov 4, 2022
3031443
Made m_link a unique pointer to control the time of deinitialization
JoergAtGithub Nov 4, 2022
2d1b479
Pre-Commit
JoergAtGithub Nov 4, 2022
14b1830
Fixed handling of scratching and at track load
JoergAtGithub Nov 5, 2022
334dfbf
Pre-Commit
JoergAtGithub Nov 5, 2022
5280f4c
Removed outdated info about Debian package for Ableton Link
JoergAtGithub Nov 5, 2022
db44071
Removed outdated info about Debian package for Ableton Link
JoergAtGithub Nov 5, 2022
d442b24
Fixed typo
JoergAtGithub Nov 7, 2022
4f9b5cb
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Dec 20, 2022
5cf27af
Removed ASCII decorations
JoergAtGithub Dec 22, 2022
f9656cd
Improved name of debug output functions for audio thread and non-audi…
JoergAtGithub Dec 22, 2022
2d9ebd2
Merge branch 'abletonlink' of https://github.com/JoergAtGithub/mixxx …
JoergAtGithub Dec 22, 2022
a2bf288
Reworked uneccessary complicated way to determine audio buffer delay …
JoergAtGithub Dec 22, 2022
958b49a
Moved hostTimeFilter into the sounddevices, next to the call of Visua…
JoergAtGithub Dec 22, 2022
2cba444
Made sync_enabled std::make_unique<ControlPushButton>
JoergAtGithub Dec 22, 2022
58792a2
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Dec 22, 2022
e75995c
Reverted unintended new line
JoergAtGithub Dec 23, 2022
80962d3
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Dec 24, 2022
590984f
Added missing AbletonLink condition to notifyBeatDistanceChanged
JoergAtGithub Dec 26, 2022
7812f3e
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Jan 6, 2023
b871982
Use mean of output latency values provided by portaudio
JoergAtGithub Jan 6, 2023
da63a02
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Feb 22, 2023
8640a38
Fixed clazy warning
JoergAtGithub Feb 22, 2023
08d69f4
Typo Reachs -> Reaches
JoergAtGithub Feb 22, 2023
63d20f1
Fixed clazy error
JoergAtGithub Feb 22, 2023
921f2e9
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Mar 25, 2023
f4ef818
Added ableton-link-dev package to qt6 buildenv
JoergAtGithub Mar 25, 2023
505a946
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Mar 29, 2023
1f14271
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Jun 1, 2023
c5bfc51
Merge remote-tracking branch 'upstream/Main' into abletonlink
JoergAtGithub Jul 26, 2023
cac0790
Move #include "moc_abletonlink.cpp" lines from mocs_compilation.cpp t…
JoergAtGithub Jul 26, 2023
fbde09a
Merge remote-tracking branch 'upstream/main' into abletonlink
JoergAtGithub Sep 6, 2023
d3db617
Fetch AbletonLink from GitHub when Linux distribution doesn't provide…
JoergAtGithub Sep 7, 2023
2e829da
Merge remote-tracking branch 'upstream/main' into abletonlink
JoergAtGithub Oct 15, 2023
3ea21c6
Pre-Commit
JoergAtGithub Oct 15, 2023
7e0c7d4
Fix unused parameter ‘bpm’ [-Werror=unused-parameter] error
JoergAtGithub Oct 15, 2023
c55cad7
Merge remote-tracking branch 'upstream/main' into abletonlink2
JoergAtGithub Mar 25, 2024
fd8805f
Merge remote-tracking branch 'upstream/main' into abletonlink2
JoergAtGithub Mar 25, 2024
d567ece
Merge remote-tracking branch 'upstream/main' into abletonlink2
JoergAtGithub Mar 30, 2024
0d9a452
Merge remote-tracking branch 'origin/abletonlink' into abletonlink2
JoergAtGithub Mar 30, 2024
9300d07
Merge remote-tracking branch 'upstream/main' into abletonlink2
JoergAtGithub Aug 18, 2024
96c5007
Use ableton::platforms::stl::Clock (which is std::chrono::steady_cloc…
JoergAtGithub Aug 18, 2024
5aa7ac7
Refactor EngineSync::notifyScratching for readability
JoergAtGithub Aug 18, 2024
d4f592b
Fix broken code formatting
JoergAtGithub Aug 18, 2024
f9d46d7
Refactor for readability and consistency
JoergAtGithub Aug 18, 2024
5c601b9
Improved readability and comments
JoergAtGithub Aug 18, 2024
7195dea
Merge remote-tracking branch 'upstream/main' into abletonlink2
JoergAtGithub Aug 18, 2024
4f3d3d9
Revert wrong pre-commit fix
JoergAtGithub Aug 18, 2024
7502dcb
Remove MSVC flag`_HAS_DEPRECATED_RESULT_OF`. This definition was pre…
JoergAtGithub Sep 6, 2024
c028793
Remove Q_UNUSED macros by omitting unused parameter names
JoergAtGithub Sep 7, 2024
1f4f192
Make m_group in AbletonLink mutable
JoergAtGithub Sep 7, 2024
faf9991
Switch debug output from qDebug() to kLogger.debug()
JoergAtGithub Sep 7, 2024
e181503
Merge remote-tracking branch 'upstream/main' into abletonlink2
JoergAtGithub Sep 7, 2024
f142616
Merge remote-tracking branch 'upstream/main' into abletonlink2
JoergAtGithub Nov 1, 2024
29f7a1f
Merge remote-tracking branch 'upstream/main' into abletonlink2
JoergAtGithub Dec 28, 2024
721c8e9
Replaced Abletons HostTimeFilter by an own single header implementati…
JoergAtGithub Jan 3, 2025
41f10b0
Removed CheckAtomic.cmake - no longer needed after Abletonlink upstre…
JoergAtGithub Jan 4, 2025
b5fe8e9
Minor HostTimeFilter code structure improvements
JoergAtGithub Jan 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/engine/sidechain/enginesidechain.cpp
src/engine/sidechain/networkinputstreamworker.cpp
src/engine/sidechain/networkoutputstreamworker.cpp
src/engine/sync/abletonlink.cpp
src/engine/sync/enginesync.cpp
src/engine/sync/internalclock.cpp
src/engine/sync/synccontrol.cpp
Expand Down Expand Up @@ -1604,7 +1605,7 @@ if(APPLE)
"-weak_framework AVFAudio"
)
target_compile_definitions(mixxx-lib PUBLIC __AU_EFFECTS__)
endif()
endif()
endif()

if(EMSCRIPTEN)
Expand All @@ -1630,9 +1631,10 @@ if(MSVC)
/wd4200 # C4200: nonstandard extension used: zero-sized array in struct/union
# Note: Even with CMAKE_C_STANDARD = 99 MSVC does not complain about C99 flexible array members
)
target_compile_definitions(mixxx-lib PUBLIC _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING _CRT_SECURE_NO_WARNINGS)
# _HAS_DEPRECATED_RESULT_OF is needed to compile AbletonLink with MSVC in C++20 mode (upstream fix is expected in AbletonLink 3.0.6: https://github.com/Ableton/link/issues/119)
target_compile_definitions(mixxx-lib PUBLIC WIN32_LEAN_AND_MEAN _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING _HAS_DEPRECATED_RESULT_OF _CRT_SECURE_NO_WARNINGS)
JoergAtGithub marked this conversation as resolved.
Show resolved Hide resolved
endif()
else()
else()
# TODO: Add -Wtrampolines, not yet supported by clazy
target_compile_options(mixxx-lib PUBLIC -Wall -Wextra $<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual> -Wfloat-conversion -Werror=return-type -Wformat=2 -Wformat-security -Wvla -Wundef)
if(WARNINGS_PEDANTIC)
Expand Down Expand Up @@ -1692,6 +1694,9 @@ if(WIN32)
# _WIN32_WINNT_WIN7 = 0x0601
target_compile_definitions(mixxx-lib PUBLIC WINVER=0x0601)
target_compile_definitions(mixxx-lib PUBLIC _WIN32_WINNT=0x0601)
# Exclude Win32 APIs such as Cryptography, DDE, RPC, Shell, and Windows Sockets where including Windows.h.
# This prevents "Winsock.h already included", when compiling the ASIO dependency of Ableton Link.
target_compile_definitions(mixxx-lib PUBLIC WIN32_LEAN_AND_MEAN)
if(MSVC)
target_compile_definitions(mixxx-lib PUBLIC _USE_MATH_DEFINES)
endif()
Expand Down Expand Up @@ -2283,6 +2288,37 @@ if(WIN32)
target_include_directories(mixxx PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
endif()

# ASIO (included in Ableton Link) requires atomic on clang to link `std::__atomic_base<unsigned int>::is_lock_free() const'
include(CheckAtomic)
if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB)
message(STATUS "Linking libatomic is needed for atomic support on this platform")
target_link_libraries(mixxx-lib PUBLIC atomic)
endif()

# Ableton Link
find_package(AbletonLink NAMES AbletonLink ableton ableton-link ableton-link-dev)
# Note Debian Bug#993999 - Wrong CMake include path: https://salsa.debian.org/multimedia-team/ableton-link/-/commit/047f75abeeb6494256cb8d498995c17afd2a17e8

if (AbletonLink_FOUND)
message(STATUS "Using existing system installation of Ableton Link")
target_link_libraries(mixxx-lib PUBLIC Ableton::Link)
else()
message(STATUS "Fetch Ableton Link from GitHub")
include(FetchContent)

set(FETCHCONTENT_QUIET FALSE)

FetchContent_Declare(AbletonLink
GIT_REPOSITORY https://github.com/Ableton/link.git
GIT_TAG Link-3.0.6
)
FetchContent_MakeAvailable(AbletonLink)

include(${abletonlink_SOURCE_DIR}/AbletonLinkConfig.cmake)
target_link_libraries(mixxx-lib PUBLIC Ableton::Link)
target_include_directories(mixxx-lib SYSTEM PUBLIC ${abletonlink_SOURCE_DIR}/include/)
endif()

# Chromaprint
find_package(Chromaprint REQUIRED)
target_link_libraries(mixxx-lib PRIVATE Chromaprint::Chromaprint)
Expand Down Expand Up @@ -2613,7 +2649,7 @@ else()
if(APPLE)
# Restore the previous CMAKE_FIND_FRAMEWORK value
set(CMAKE_FIND_FRAMEWORK ${_previous_find_framework})
endif()
endif()
endif()

# Ogg
Expand Down
106 changes: 106 additions & 0 deletions cmake/modules/CheckAtomic.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# SPDX-FileCopyrightText: 2003-2018 University of Illinois at Urbana-Champaign.
#
# SPDX-License-Identifier: BSD-3-Clause

#[=======================================================================[.rst:
CheckAtomic
-----------

Check if the compiler supports std:atomic out of the box or if libatomic is
needed for atomic support. If it is needed libatomicis added to
``CMAKE_REQUIRED_LIBRARIES``. So after running CheckAtomic you can use
std:atomic.

Since 5.75.0.
#]=======================================================================]

include(CheckCXXSourceCompiles)
include(CheckLibraryExists)

# Sometimes linking against libatomic is required for atomic ops, if
# the platform doesn't support lock-free atomics.

function(check_working_cxx_atomics varname)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
check_cxx_source_compiles("
#include <atomic>
std::atomic<int> x;
std::atomic<short> y;
std::atomic<char> z;
int main() {
++z;
++y;
return ++x;
}
" ${varname})
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endfunction()

function(check_working_cxx_atomics64 varname)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "-std=c++11 ${CMAKE_REQUIRED_FLAGS}")
check_cxx_source_compiles("
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x (0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
x.is_lock_free();
return 0;
}
" ${varname})
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endfunction()

# Check for (non-64-bit) atomic operations.
if(MSVC)
set(HAVE_CXX_ATOMICS_WITHOUT_LIB True)
else()
# First check if atomics work without the library.
if (CMAKE_COMPILER_IS_GNUCXX
OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang"
OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"
OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
endif()
# If not, check if the library exists, and atomics work with it.
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
if(HAVE_LIBATOMIC)
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
message(FATAL_ERROR "Host compiler must support std::atomic!")
endif()
else()
message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
endif()
endif()
endif()

# Check for 64 bit atomic operations.
if(MSVC)
set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True)
else()
# First check if atomics work without the library.
if (CMAKE_COMPILER_IS_GNUCXX
OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang"
OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"
OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
endif()
# If not, check if the library exists, and atomics work with it.
if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
if(HAVE_CXX_LIBATOMICS64)
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB)
if (NOT HAVE_CXX_ATOMICS64_WITH_LIB)
message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!")
endif()
else()
message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.")
endif()
endif()
endif()
3 changes: 3 additions & 0 deletions res/skins/LateNight/style_palemoon.qss
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@ WTrackProperty[selected="true"],
padding: 0px 2px 0px 2px;
}
#BatteryBox,
#AbletonLinkPeers{
color: #d2d2d2;
}
#ClockWidget {
margin-bottom: 1px;
}
Expand Down
28 changes: 28 additions & 0 deletions res/skins/LateNight/toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,34 @@
</Connection>
</StatusLight>

<WidgetGroup>
<ObjectName>AbletonLinkWidget</ObjectName>
<Layout>horizontal</Layout>
<SizePolicy>min,min</SizePolicy>
<Children>
<Template src="skin:/controls/button_2state_persist.xml">
<SetVariable name="TooltipId">sync_enabled</SetVariable>
<SetVariable name="ObjectName">GuiToggleButton</SetVariable>
<SetVariable name="Size">35f,20f</SetVariable>
<SetVariable name="state_0_text">Link</SetVariable>
<SetVariable name="state_1_text">Link</SetVariable>
<SetVariable name="ConfigKey">[AbletonLink],sync_enabled</SetVariable>
</Template>
<Number>
<TooltipId>num_peers</TooltipId>
<ObjectName>AbletonLinkPeers</ObjectName>
<Size>25f,0min</Size>
<NumberOfDigits>0</NumberOfDigits>
<Alignment>center</Alignment>
<Connection>
<ConfigKey>[AbletonLink],num_peers</ConfigKey>
</Connection>
</Number>
</Children>
</WidgetGroup>

<WidgetGroup><Size>100f,1min</Size></WidgetGroup>

<WidgetGroup>
<ObjectName>ClockWidget</ObjectName>
<Layout>horizontal</Layout>
Expand Down
12 changes: 12 additions & 0 deletions src/controllers/controlpickermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,18 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
tr("Decrease internal Leader BPM by 0.1"),
pSyncMenu);
pSyncMenu->addSeparator();
addControl("[AbletonLink]",
"sync_enabled",
tr("Link button"),
tr("Joins or disconnect from Ableton Link session"),
pSyncMenu);
addControl("[AbletonLink]",
"num_peers",
tr("Ableton Link number of peers"),
tr("Number of connected Ableton Link peers"),
pSyncMenu);

pSyncMenu->addSeparator();
addDeckAndSamplerControl("sync_leader",
tr("Sync Leader"),
tr("Sync mode 3-state toggle / indicator (Off, Soft Leader, "
Expand Down
4 changes: 4 additions & 0 deletions src/engine/enginebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,10 @@ mixxx::audio::FramePos EngineBuffer::getTrackEndPosition() const {
m_pTrackSamples->get());
}

double EngineBuffer::getTrackSampleRate() const {
return m_pTrackSampleRate->get();
}

void EngineBuffer::setTrackEndPosition(mixxx::audio::FramePos position) {
m_pTrackSamples->set(position.toEngineSamplePosMaybeInvalid());
}
Expand Down
1 change: 1 addition & 0 deletions src/engine/enginebuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class EngineBuffer : public EngineObject {
mixxx::audio::FramePos getExactPlayPos() const;
double getVisualPlayPos() const;
mixxx::audio::FramePos getTrackEndPosition() const;
double getTrackSampleRate() const;
void setTrackEndPosition(mixxx::audio::FramePos position);
double getUserOffset() const;

Expand Down
14 changes: 8 additions & 6 deletions src/engine/enginemixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,11 @@ const CSAMPLE* EngineMixer::getSidechainBuffer() const {
return m_sidechainMix.data();
}

void EngineMixer::processChannels(int iBufferSize) {
void EngineMixer::processChannels(int iBufferSize,
std::chrono::microseconds absTimeWhenPrevOutputBufferReachsDac) {
// Update internal sync lock rate.
m_pEngineSync->onCallbackStart(m_sampleRate, iBufferSize);
m_pEngineSync->onCallbackStart(
m_sampleRate, iBufferSize, absTimeWhenPrevOutputBufferReachsDac);

m_activeBusChannels[EngineChannel::LEFT].clear();
m_activeBusChannels[EngineChannel::CENTER].clear();
Expand Down Expand Up @@ -391,17 +393,17 @@ void EngineMixer::processChannels(int iBufferSize) {

// After local bpms are updated, trigger the rest of the post-processing
// which ensures that all channels are updating certain values at the
// same point in time. This prevents sync from failing depending on
// same point in time. This prevents sync from failing depending on
// if the sync target was processed before or after the sync origin.
for (int i = activeChannelsStartIndex;
i < m_activeChannels.size(); ++i) {
m_activeChannels[i]->m_pChannel->postProcess(iBufferSize);
}
}

void EngineMixer::process(const int iBufferSize) {
void EngineMixer::process(const int iBufferSize,
std::chrono::microseconds absTimeWhenPrevOutputBufferReachsDac) {
DEBUG_ASSERT(iBufferSize <= static_cast<int>(kMaxEngineSamples));

static bool haveSetName = false;
if (!haveSetName) {
QThread::currentThread()->setObjectName("Engine");
Expand All @@ -423,7 +425,7 @@ void EngineMixer::process(const int iBufferSize) {
}

// Prepare all channels for output
processChannels(iBufferSize);
processChannels(iBufferSize, absTimeWhenPrevOutputBufferReachsDac);

// Compute headphone mix
// Head phone left/right mix
Expand Down
6 changes: 4 additions & 2 deletions src/engine/enginemixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class EngineMixer : public QObject, public AudioSource {
void onInputConnected(const AudioInput& input);
void onInputDisconnected(const AudioInput& input);

void process(const int iBufferSize);
void process(const int iBufferSize,
std::chrono::microseconds absTimeWhenPrevOutputBufferReachesDac);

// Add an EngineChannel to the mixing engine. This is not thread safe --
// only call it before the engine has started mixing.
Expand Down Expand Up @@ -256,7 +257,8 @@ class EngineMixer : public QObject, public AudioSource {
// m_activeBusChannels, m_activeHeadphoneChannels, and
// m_activeTalkoverChannels with each channel that is active for the
// respective output.
void processChannels(int iBufferSize);
void processChannels(int iBufferSize,
std::chrono::microseconds absTimeWhenPrevOutputBufferReachesDac);

ChannelHandleFactoryPointer m_pChannelHandleFactory;
void applyMainEffects(int bufferSize);
Expand Down
Loading
Loading