Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.4' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Apr 28, 2023
2 parents be93545 + febe5ce commit 24c6410
Show file tree
Hide file tree
Showing 33 changed files with 1,637 additions and 1,406 deletions.
25 changes: 16 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,13 @@ else()
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# using regular Clang or AppleClang
set(LLVM_CLANG true)
if (CMAKE_CXX_SIMULATE_ID MATCHES "MSVC")
set(LLVM_CLANG false)
set(MSVC true)
else()
# using regular Clang or AppleClang
set(LLVM_CLANG true)
endif()
else()
set(LLVM_CLANG false)
endif()
Expand Down Expand Up @@ -749,6 +754,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/library/export/trackexportworker.cpp
src/library/externaltrackcollection.cpp
src/library/hiddentablemodel.cpp
src/library/itunes/itunesdao.cpp
src/library/itunes/itunesfeature.cpp
src/library/itunes/itunesxmlimporter.cpp
src/library/library_prefs.cpp
Expand Down Expand Up @@ -840,14 +846,12 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/preferences/dialog/dlgprefbeatsdlg.ui
src/preferences/dialog/dlgprefcolors.cpp
src/preferences/dialog/dlgprefcolorsdlg.ui
src/preferences/dialog/dlgprefcrossfader.cpp
src/preferences/dialog/dlgprefcrossfaderdlg.ui
src/preferences/dialog/dlgprefmixer.cpp
src/preferences/dialog/dlgprefmixerdlg.ui
src/preferences/dialog/dlgprefdeck.cpp
src/preferences/dialog/dlgprefdeckdlg.ui
src/preferences/dialog/dlgprefeffects.cpp
src/preferences/dialog/dlgprefeffectsdlg.ui
src/preferences/dialog/dlgprefeq.cpp
src/preferences/dialog/dlgprefeqdlg.ui
src/preferences/dialog/dlgpreferencepage.cpp
src/preferences/dialog/dlgpreferences.cpp
src/preferences/dialog/dlgpreferencesdlg.ui
Expand Down Expand Up @@ -2052,10 +2056,10 @@ if(MSVC)
target_compile_options(fidlib PRIVATE /W3)
elseif(MINGW)
target_compile_definitions(fidlib PRIVATE T_MINGW)
target_compile_options(fidlib PRIVATE -Wall -Wextra -Wfloat-conversion -Werror=return-type)
target_compile_options(fidlib PRIVATE -fno-finite-math-only -Wall -Wextra -Wfloat-conversion -Werror=return-type)
else()
target_compile_definitions(fidlib PRIVATE T_LINUX)
target_compile_options(fidlib PRIVATE -Wall -Wextra -Wfloat-conversion -Werror=return-type)
target_compile_options(fidlib PRIVATE -fno-finite-math-only -Wall -Wextra -Wfloat-conversion -Werror=return-type)
endif()
target_include_directories(mixxx-lib SYSTEM PUBLIC lib/fidlib)
target_link_libraries(mixxx-lib PRIVATE fidlib)
Expand Down Expand Up @@ -2130,7 +2134,10 @@ target_link_libraries(mixxx-lib PRIVATE FLAC::FLAC)
# inlining It is compiled without optimization and allows to use these function
# from -ffast-math optimized objects. The MSVC option /fp:fast does not suffer this issue
add_library(FpClassify STATIC EXCLUDE_FROM_ALL src/util/fpclassify.cpp)
if(GNU_GCC OR LLVM_CLANG)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC")
target_compile_options(FpClassify PRIVATE /fp:precise)
elseif(GNU_GCC OR LLVM_CLANG)
# The option `-ffp-contract=on` must precede `-fno-fast-math`
# to silence a warning on Clang 14
target_compile_options(FpClassify PRIVATE -ffp-contract=on -fno-fast-math)
Expand Down
4 changes: 2 additions & 2 deletions packaging/macos/build_environment
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mixxx-deps-2.4-x64-osx-min1012-db02b82
2724e371307ff2ad5ae670ffa595eec3260825bd6c7de26d8bf5b6f7a2894c23
mixxx-deps-2.4-x64-osx-min1012-e2a51b1
60de6ac952a70b7d1a03736aea2be616f43ac36ffc764fe129753e40b738a0bb
2 changes: 1 addition & 1 deletion packaging/windows/build_environment
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mixxx-deps-2.4-x64-windows-db02b82
mixxx-deps-2.4-x64-windows-e2a51b1
22 changes: 12 additions & 10 deletions src/engine/filters/enginefilteriir.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class EngineFilterIIR : public EngineFilterIIRBase {
char* desc;
FidFilter* filt = fid_design(spec_d, sampleRate, freq0, freq1, adj, &desc);
int delay = fid_calc_delay(filt);
qDebug() << QString().fromLatin1(desc) << "delay:" << delay;
qDebug() << QString().fromLatin1(desc);
qDebug() << spec_d << "delay:" << delay;
double resp0, phase0;
resp0 = fid_response_pha(filt, freq0 / sampleRate, &phase0);
qDebug() << "freq0:" << freq0 << resp0 << phase0;
Expand All @@ -126,16 +127,16 @@ class EngineFilterIIR : public EngineFilterIIRBase {
}
double resp2, phase2;
resp2 = fid_response_pha(filt, freq0 / sampleRate / 2, &phase2);
qDebug() << "freq2:" << freq0 / 2 << resp2 << phase0;
qDebug() << "freq2:" << freq0 / 2 << resp2 << phase2;
double resp3, phase3;
resp3 = fid_response_pha(filt, freq0 / sampleRate * 2, &phase3);
qDebug() << "freq3:" << freq0 * 2 << resp3 << phase0;
qDebug() << "freq3:" << freq0 * 2 << resp3 << phase3;
double resp4, phase4;
resp4 = fid_response_pha(filt, freq0 / sampleRate / 2.2, &phase4);
qDebug() << "freq4:" << freq0 / 2.2 << resp2 << phase0;
qDebug() << "freq4:" << freq0 / 2.2 << resp4 << phase4;
double resp5, phase5;
resp5 = fid_response_pha(filt, freq0 / sampleRate * 2.2, &phase5);
qDebug() << "freq5:" << freq0 * 2.2 << resp3 << phase0;
qDebug() << "freq5:" << freq0 * 2.2 << resp5 << phase5;
free(filt);
#endif
}
Expand Down Expand Up @@ -191,7 +192,8 @@ class EngineFilterIIR : public EngineFilterIIRBase {
FidFilter* filt = fid_cat(1, filt1, filt2, NULL);
int delay = fid_calc_delay(filt);
qDebug() << QString().fromLatin1(desc1) << "X"
<< QString().fromLatin1(desc2) << "delay:" << delay;
<< QString().fromLatin1(desc2);
qDebug() << spec1 << "X" << spec2 << "delay:" << delay;
double resp0, phase0;
resp0 = fid_response_pha(filt, freq01 / sampleRate, &phase0);
qDebug() << "freq01:" << freq01 << resp0 << phase0;
Expand All @@ -209,16 +211,16 @@ class EngineFilterIIR : public EngineFilterIIRBase {
}
double resp2, phase2;
resp2 = fid_response_pha(filt, freq01 / sampleRate / 2, &phase2);
qDebug() << "freq2:" << freq01 / 2 << resp2 << phase0;
qDebug() << "freq2:" << freq01 / 2 << resp2 << phase2;
double resp3, phase3;
resp3 = fid_response_pha(filt, freq01 / sampleRate * 2, &phase3);
qDebug() << "freq3:" << freq01 * 2 << resp3 << phase0;
qDebug() << "freq3:" << freq01 * 2 << resp3 << phase3;
double resp4, phase4;
resp4 = fid_response_pha(filt, freq01 / sampleRate / 2.2, &phase4);
qDebug() << "freq4:" << freq01 / 2.2 << resp2 << phase0;
qDebug() << "freq4:" << freq01 / 2.2 << resp4 << phase4;
double resp5, phase5;
resp5 = fid_response_pha(filt, freq01 / sampleRate * 2.2, &phase5);
qDebug() << "freq5:" << freq01 * 2.2 << resp3 << phase0;
qDebug() << "freq5:" << freq01 * 2.2 << resp5 << phase5;
free(filt);
#endif
}
Expand Down
1 change: 0 additions & 1 deletion src/engine/sidechain/enginenetworkstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ qint64 EngineNetworkStream::getNetworkTimeUs() {
return ((qint64)ft.dwHighDateTime << 32 | ft.dwLowDateTime) / 10;
} else {
static qint64 oldNow = 0;
static qint64 incCount = 0;
static PerformanceTimer timerSinceInc;
GetSystemTimeAsFileTime(&ft);
qint64 now = ((qint64)ft.dwHighDateTime << 32 | ft.dwLowDateTime) / 10;
Expand Down
50 changes: 33 additions & 17 deletions src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,16 +1086,18 @@ void AutoDJProcessor::playerOutroEndChanged(DeckAttributes* pAttributes, double
}

double AutoDJProcessor::getIntroStartSecond(DeckAttributes* pDeck) {
const mixxx::audio::FramePos trackEndPosition = pDeck->trackEndPosition();
const mixxx::audio::FramePos introStartPosition = pDeck->introStartPosition();
if (!introStartPosition.isValid()) {
if (!introStartPosition.isValid() || introStartPosition > trackEndPosition) {
return getFirstSoundSecond(pDeck);
}
return framePositionToSeconds(introStartPosition, pDeck);
}

double AutoDJProcessor::getIntroEndSecond(DeckAttributes* pDeck) {
const mixxx::audio::FramePos trackEndPosition = pDeck->trackEndPosition();
const mixxx::audio::FramePos introEndPosition = pDeck->introEndPosition();
if (!introEndPosition.isValid()) {
if (!introEndPosition.isValid() || introEndPosition > trackEndPosition) {
// Assume a zero length intro if introEnd is not set.
// The introStart is automatically placed by AnalyzerSilence, so use
// that as a fallback if the user has not placed outroStart. If it has
Expand All @@ -1106,8 +1108,9 @@ double AutoDJProcessor::getIntroEndSecond(DeckAttributes* pDeck) {
}

double AutoDJProcessor::getOutroStartSecond(DeckAttributes* pDeck) {
const mixxx::audio::FramePos trackEndPosition = pDeck->trackEndPosition();
const mixxx::audio::FramePos outroStartPosition = pDeck->outroStartPosition();
if (!outroStartPosition.isValid()) {
if (!outroStartPosition.isValid() || outroStartPosition > trackEndPosition) {
// Assume a zero length outro if outroStart is not set.
// The outroEnd is automatically placed by AnalyzerSilence, so use
// that as a fallback if the user has not placed outroStart. If it has
Expand All @@ -1118,8 +1121,9 @@ double AutoDJProcessor::getOutroStartSecond(DeckAttributes* pDeck) {
}

double AutoDJProcessor::getOutroEndSecond(DeckAttributes* pDeck) {
const mixxx::audio::FramePos trackEndPosition = pDeck->trackEndPosition();
const mixxx::audio::FramePos outroEndPosition = pDeck->outroEndPosition();
if (!outroEndPosition.isValid()) {
if (!outroEndPosition.isValid() || outroEndPosition > trackEndPosition) {
return getLastSoundSecond(pDeck);
}
return framePositionToSeconds(outroEndPosition, pDeck);
Expand All @@ -1136,7 +1140,14 @@ double AutoDJProcessor::getFirstSoundSecond(DeckAttributes* pDeck) {
if (pFromTrackN60dBSound) {
const mixxx::audio::FramePos firstSound = pFromTrackN60dBSound->getPosition();
if (firstSound.isValid()) {
return framePositionToSeconds(firstSound, pDeck);
const mixxx::audio::FramePos trackEndPosition = pDeck->trackEndPosition();
if (firstSound <= trackEndPosition) {
return framePositionToSeconds(firstSound, pDeck);
} else {
qWarning() << "-60 dB Sound Cue starts after track end in:"
<< pTrack->getLocation()
<< "Using the first sample instead.";
}
}
}
return 0.0;
Expand All @@ -1148,15 +1159,21 @@ double AutoDJProcessor::getLastSoundSecond(DeckAttributes* pDeck) {
return 0.0;
}

const mixxx::audio::FramePos trackEndPosition = pDeck->trackEndPosition();
CuePointer pFromTrackN60dBSound = pTrack->findCueByType(mixxx::CueType::N60dBSound);
if (pFromTrackN60dBSound) {
Cue::StartAndEndPositions pos = pFromTrackN60dBSound->getStartAndEndPosition();
if (pos.endPosition > mixxx::audio::kStartFramePos &&
(pos.endPosition - pos.startPosition) > 0) {
return framePositionToSeconds(pos.endPosition, pDeck);
if (pFromTrackN60dBSound && pFromTrackN60dBSound->getLengthFrames() > 0.0) {
const mixxx::audio::FramePos lastSound = pFromTrackN60dBSound->getEndPosition();
if (lastSound > mixxx::audio::FramePos(0.0)) {
if (lastSound <= trackEndPosition) {
return framePositionToSeconds(lastSound, pDeck);
} else {
qWarning() << "-60 dB Sound Cue ends after track end in:"
<< pTrack->getLocation()
<< "Using the last sample instead.";
}
}
}
return getEndSecond(pDeck);
return framePositionToSeconds(trackEndPosition, pDeck);
}

double AutoDJProcessor::getEndSecond(DeckAttributes* pDeck) {
Expand Down Expand Up @@ -1270,12 +1287,11 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck,
}

double introLength = 0;
const mixxx::audio::FramePos introEndPosition = pToDeck->introEndPosition();
if (introEndPosition.isValid()) {
const double introEnd = framePositionToSeconds(introEndPosition, pToDeck);
if (introStart < introEnd) {
introLength = introEnd - introStart;
}

// This returns introStart in case the user has not yet set an intro end
const double introEnd = getIntroEndSecond(pToDeck);
if (introStart < introEnd) {
introLength = introEnd - introStart;
}

if constexpr (sDebug) {
Expand Down
61 changes: 56 additions & 5 deletions src/library/dlgtrackinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ DlgTrackInfo::DlgTrackInfo(
m_tapFilter(this, kFilterLength, kMaxInterval),
m_pWCoverArtMenu(make_parented<WCoverArtMenu>(this)),
m_pWCoverArtLabel(make_parented<WCoverArtLabel>(this, m_pWCoverArtMenu)),
m_pWStarRating(make_parented<WStarRating>(nullptr, this)) {
m_pWStarRating(make_parented<WStarRating>(nullptr, this)),
m_pColorPicker(make_parented<WColorPickerAction>(
WColorPicker::Option::AllowNoColor |
// TODO(xxx) remove this once the preferences are themed via QSS
WColorPicker::Option::NoExtStyleSheet,
ColorPaletteSettings(m_pUserSettings).getTrackColorPalette(),
this)) {
init();
}

Expand Down Expand Up @@ -245,6 +251,23 @@ void DlgTrackInfo::init() {
&WCoverArtMenu::reloadCoverArt,
this,
&DlgTrackInfo::slotReloadCoverArt);

btnColorPicker->setStyle(QStyleFactory::create(QStringLiteral("fusion")));
QMenu* pColorPickerMenu = new QMenu(this);
pColorPickerMenu->addAction(m_pColorPicker);
btnColorPicker->setMenu(pColorPickerMenu);

connect(btnColorPicker,
&QPushButton::clicked,
this,
&DlgTrackInfo::slotColorButtonClicked);
connect(m_pColorPicker.get(),
&WColorPickerAction::colorPicked,
this,
[this](const mixxx::RgbColor::optional_t& newColor) {
trackColorDialogSetColor(newColor);
m_trackRecord.setColor(newColor);
});
}

void DlgTrackInfo::slotApply() {
Expand All @@ -262,9 +285,6 @@ void DlgTrackInfo::slotCancel() {
reject();
}

void DlgTrackInfo::trackUpdated() {
}

void DlgTrackInfo::slotNextButton() {
loadNextTrack();
}
Expand Down Expand Up @@ -311,6 +331,9 @@ void DlgTrackInfo::updateFromTrack(const Track& track) {
track.getRecord(),
track.getLocation());

// paint the color selector and check the respective color picker button
trackColorDialogSetColor(track.getColor());

txtLocation->setText(QDir::toNativeSeparators(track.getLocation()));

reloadTrackBeats(track);
Expand Down Expand Up @@ -491,10 +514,38 @@ void DlgTrackInfo::slotOpenInFileBrowser() {
if (!m_pLoadedTrack) {
return;
}

mixxx::DesktopHelper::openInFileBrowser(QStringList(m_pLoadedTrack->getLocation()));
}

void DlgTrackInfo::slotColorButtonClicked() {
if (!m_pLoadedTrack) {
return;
}
btnColorPicker->showMenu();
}

void DlgTrackInfo::trackColorDialogSetColor(const mixxx::RgbColor::optional_t& newColor) {
m_pColorPicker->setSelectedColor(newColor);
btnColorPicker->menu()->close();

if (newColor) {
btnColorPicker->setText("");
const QColor ccolor = mixxx::RgbColor::toQColor(newColor);
const QString styleSheet =
QStringLiteral(
"QPushButton { background-color: %1; color: %2; }")
.arg(ccolor.name(QColor::HexRgb),
Color::isDimColor(ccolor)
? "white"
: "black");
btnColorPicker->setStyleSheet(styleSheet);
} else { // no color
btnColorPicker->setText(tr("(no color)"));
// clear custom stylesheet, i.e. restore Fusion style,
btnColorPicker->setStyleSheet("");
}
}

void DlgTrackInfo::saveTrack() {
if (!m_pLoadedTrack) {
return;
Expand Down
7 changes: 5 additions & 2 deletions src/library/dlgtrackinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
#include "track/trackrecord.h"
#include "util/parented_ptr.h"
#include "util/tapfilter.h"
#include "widget/wcolorpickeraction.h"

class TrackModel;
class DlgTagFetcher;
class WCoverArtLabel;
class WCoverArtMenu;
class WStarRating;
class WColorPickerAction;

/// A dialog box to display and edit track properties.
/// Use TrackPointer to load a track into the dialog or
Expand Down Expand Up @@ -52,8 +54,6 @@ class DlgTrackInfo : public QDialog, public Ui::DlgTrackInfo {
void slotApply();
void slotCancel();

void trackUpdated();

void slotBpmScale(mixxx::Beats::BpmScale bpmScale);
void slotBpmClear();
void slotBpmConstChanged(int state);
Expand All @@ -67,6 +67,7 @@ class DlgTrackInfo : public QDialog, public Ui::DlgTrackInfo {

void slotTrackChanged(TrackId trackId);
void slotOpenInFileBrowser();
void slotColorButtonClicked();

void slotCoverFound(
const QObject* pRequestor,
Expand All @@ -82,6 +83,7 @@ class DlgTrackInfo : public QDialog, public Ui::DlgTrackInfo {
void loadPrevTrack();
void loadTrackInternal(const TrackPointer& pTrack);
void reloadTrackBeats(const Track& track);
void trackColorDialogSetColor(const mixxx::RgbColor::optional_t& color);
void saveTrack();
void clear();
void init();
Expand Down Expand Up @@ -122,6 +124,7 @@ class DlgTrackInfo : public QDialog, public Ui::DlgTrackInfo {
parented_ptr<WCoverArtMenu> m_pWCoverArtMenu;
parented_ptr<WCoverArtLabel> m_pWCoverArtLabel;
parented_ptr<WStarRating> m_pWStarRating;
parented_ptr<WColorPickerAction> m_pColorPicker;

std::unique_ptr<DlgTagFetcher> m_pDlgTagFetcher;
};
Loading

0 comments on commit 24c6410

Please sign in to comment.