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

[WIP] Bars phrases and variable bpm in beats class #2512

Closed
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
148e216
Improvement in proto for beats blob
JaviVilarroig Aug 21, 2019
39a90b4
Added Signature class for storing track time signature information
JaviVilarroig Nov 20, 2019
dc8fbe7
Added Signature class
JaviVilarroig Dec 9, 2019
9ee4695
Added Beats::getSignature
JaviVilarroig Dec 16, 2019
05a4720
Merge branch 'bars_phrases_and_variable_BPM_in_beats_class' of https:…
JaviVilarroig Dec 17, 2019
2d38e75
Fix repo
JaviVilarroig Dec 17, 2019
c1428f0
Merge remote-tracking branch 'upstream/master' into bars_phrases_and_…
JaviVilarroig Dec 19, 2019
590be5d
Added Signature manipulation to BeatGrid.
JaviVilarroig Jan 13, 2020
b2c9eca
BeatGrid/BeatMap Signature support
JaviVilarroig Jan 16, 2020
0084ddc
Removed forgotten qDebug unneeded trace
JaviVilarroig Jan 16, 2020
c8b8ae4
- Added button in Tango skin for setting bar beat
JaviVilarroig Feb 17, 2020
fa68e2d
Presentaion of Bar beats in Waveform for BeatMap.
JaviVilarroig Feb 22, 2020
87cc607
Merge remote-tracking branch 'upstream/master' into bars_phrases_and_…
JaviVilarroig Feb 22, 2020
01583e8
Adds null_signature and default_signature constants.
JaviVilarroig Feb 25, 2020
b533ac4
Rename Signature to TimeSignature in protobuff and wrapper class.
JaviVilarroig Feb 25, 2020
72e030a
Fixes in TimeSignature class.
JaviVilarroig Feb 26, 2020
9d652ca
Protect naked pointers in BpmControl.
JaviVilarroig Feb 28, 2020
91c9930
BeatMap::SetBar to use the real Signature of the track to calculate the
JaviVilarroig Feb 28, 2020
df0f083
Fix issue with set bar button nor properly reacting to press an hover.
JaviVilarroig Mar 4, 2020
26b358f
Multiple small fixes on Beats. Added default value to TimeSignature
JaviVilarroig Mar 5, 2020
f97cd1e
BeatGrid removal and BeatMap consolidation into Beats
JaviVilarroig Apr 19, 2020
48ec71b
Forgoten update on cmake list for previous commit
JaviVilarroig Apr 19, 2020
58be257
Merge remote-tracking branch 'upstream/master' into
JaviVilarroig Apr 21, 2020
0532956
Improve variable names for Track pointers.
JaviVilarroig Apr 21, 2020
9a31a12
Improve variable names for Track pointers (2)
JaviVilarroig Apr 21, 2020
3837563
Document Beats class for Doxygen
JaviVilarroig Apr 21, 2020
18c8e9b
Fix if's without closing brackets.
JaviVilarroig Apr 21, 2020
ef8df26
Ads operator<< to Beats and cleanup of misc malformed make_shared
JaviVilarroig Apr 22, 2020
8930f78
Improvements in Timesignature
JaviVilarroig Apr 22, 2020
41477ec
Use mixxx::kEngineChannelCount for consistency
JaviVilarroig Apr 22, 2020
41eec7d
Rename Beats::setBar to Beats::setDownBeat
JaviVilarroig Apr 22, 2020
f5b1890
Rename Beats::setBar to Beats::setDownBeat and some adpaters
JaviVilarroig Apr 22, 2020
ca36f47
Remove ascii art from Beats header
JaviVilarroig Apr 22, 2020
4102b23
Merge branch 'bars_phrases_and_variable_BPM_in_beats_class' of github…
JaviVilarroig Apr 22, 2020
5abf85b
Replace BeatsPointer constructor by make_shared
JaviVilarroig Apr 22, 2020
89cf63c
Adapt comment to clang-format
JaviVilarroig Apr 22, 2020
a0e828f
Fix BeatsFactory method signatures to use references.
JaviVilarroig Apr 22, 2020
b3d3701
Remove anonymous namespace from beats.h
JaviVilarroig Apr 22, 2020
15626d9
Remove spurious property from Beats
JaviVilarroig Apr 22, 2020
8abb3fb
Fixes in BeatIterator
JaviVilarroig May 4, 2020
dec4d31
Remove obsolete tests
JaviVilarroig May 4, 2020
679de45
Waveformrenderbeat to interact with beats using frames
JaviVilarroig May 5, 2020
d0e4b12
pre-commit configuration taken from master
JaviVilarroig May 6, 2020
0f1848a
Small general fixes in BeatFactory.
JaviVilarroig May 6, 2020
bd57568
Comments added to const_cas in BeatIterator
JaviVilarroig May 7, 2020
9ed4081
Change name of method toByteArray to toProtobuff
JaviVilarroig May 7, 2020
12cd34c
Fix in indentation
JaviVilarroig May 7, 2020
784e646
Add comments to clearly mark temporary methods
JaviVilarroig May 7, 2020
1851baf
Merge remote-tracking branch 'upstream/master' into
JaviVilarroig May 8, 2020
d5f73c4
BeatTrtanslateTest is now OK.
JaviVilarroig May 10, 2020
920d1c6
This makes beatmap behaves like a beatgrid when constant tempo prefer…
crisclacerda May 13, 2020
b6be4dd
Revert "This makes beatmap behaves like a beatgrid when constant temp…
JaviVilarroig May 17, 2020
bfe8ab8
Beats to use Bpm type
JaviVilarroig May 21, 2020
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
11 changes: 0 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,3 @@ repos:
- commit
- push
- manual
- repo: local
JaviVilarroig marked this conversation as resolved.
Show resolved Hide resolved
hooks:
- id: line-length
name: line-length
description: Check for lines longer 100 and brakes them before 80.
entry: ./scripts/line_length.py
stages:
- commit
- push
language: python
files: \.(c|cpp|h)$
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/sources/soundsourcesndfile.cpp
src/track/albuminfo.cpp
src/track/beatfactory.cpp
src/track/beatgrid.cpp
src/track/beatmap.cpp
src/track/beats.cpp
src/track/beatutils.cpp
src/track/bpm.cpp
Expand Down Expand Up @@ -1024,8 +1022,7 @@ add_executable(mixxx-test
src/test/audiotaperpot_test.cpp
src/test/autodjprocessor_test.cpp
src/test/baseeffecttest.cpp
src/test/beatgridtest.cpp
src/test/beatmaptest.cpp
src/test/beatstest.cpp
src/test/beatstranslatetest.cpp
src/test/bpmcontrol_test.cpp
src/test/broadcastprofile_test.cpp
Expand Down
7 changes: 6 additions & 1 deletion res/skins/Tango/buttons/btn_beats_curpos.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions res/skins/Tango/buttons/btn_beats_set_bar_beat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions res/skins/Tango/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -467,19 +467,24 @@ WWidgetGroup {
#BeatgridSlower,
#BeatgridFaster,
#BeatgridEarlier,
#BeatgridLater {
#BeatgridLater,
#BeatgridSetBarBeat {
background-color: #333;
}
#BeatgridCurpos:hover,
#BeatgridSlower:hover,
#BeatgridFaster:hover,
#BeatgridEarlier:hover,
#BeatgridLater:hover {
#BeatgridLater:hover,
#BeatgridSetBarBeat:hover {
background-color: #0f0f0f;
}
#BeatgridCurpos {
image: url(skin:/buttons/btn_beats_curpos.svg) no-repeat center center;
}
#BeatgridSetBarBeat {
image: url(skin:/buttons/btn_beats_set_bar_beat.svg) no-repeat center center;
}
#BeatgridSlower {
image: url(skin:/buttons/btn_beats_slower.svg) no-repeat center center;
}
Expand Down
25 changes: 24 additions & 1 deletion res/skins/Tango/waveform.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Variables:
<SignalRGBMidColor><Variable name="SignalRGBMidColor"/></SignalRGBMidColor>
<SignalRGBHighColor><Variable name="SignalRGBHighColor"/></SignalRGBHighColor>
<BeatColor>#ffffff</BeatColor>
<BarColor>#ffff00</BarColor>
<PlayPosColor>#FF4300</PlayPosColor>
<EndOfTrackColor><Variable name="EndOfTrackColor"/></EndOfTrackColor>
<DefaultMark>
Expand Down Expand Up @@ -131,7 +132,7 @@ Variables:
<Layout>vertical</Layout>
<!-- Horizontal size is 82px and we'll add the WaveformContainer's negative margin
(shifts waveform center mark) so that all buttons are visible -->
<Size>82f,50me</Size>
<Size>107f,50me</Size>
<Children>
<WidgetGroup><Size>1me,0me</Size></WidgetGroup>
<WidgetGroup><Size>1me,1f</Size></WidgetGroup>
Expand All @@ -149,6 +150,28 @@ Variables:
<SetVariable name="ConfigKeyRight"><Variable name="group"/>,beats_translate_match_alignment</SetVariable>
</Template>

<WidgetGroup><!-- Set Bar and Phrase beat -->
<Layout>vertical</Layout>
<SizePolicy>f,f</SizePolicy>
<Children>
<Template src="skin:button_1state.xml">
<SetVariable name="TooltipId">beats_set_bar_beat</SetVariable>
<SetVariable name="ObjectName">BeatgridSetBarBeat</SetVariable>
<SetVariable name="Size">28f,24f</SetVariable>
<SetVariable name="ConfigKey"><Variable name="group"/>,beats_set_bar_beat</SetVariable>
</Template>

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

<Template src="skin:button_1state.xml">
<SetVariable name="TooltipId">beats_adjust_faster</SetVariable>
<SetVariable name="ObjectName">BeatgridFaster</SetVariable>
<SetVariable name="Size">28f,24f</SetVariable>
<SetVariable name="ConfigKey"><Variable name="group"/>,beats_adjust_faster</SetVariable>
</Template>
</Children>
</WidgetGroup><!-- Set Bar and Phrase beat -->

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

<WidgetGroup><!-- beats earlier & faster -->
Expand Down
33 changes: 17 additions & 16 deletions src/analyzer/analyzerbeats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "analyzer/plugins/analyzerqueenmarybeats.h"
#include "analyzer/plugins/analyzersoundtouchbeats.h"
#include "track/beatfactory.h"
#include "track/beatmap.h"
#include "track/beats.h"
#include "track/beatutils.h"
#include "track/track.h"

Expand Down Expand Up @@ -37,7 +37,7 @@ AnalyzerBeats::AnalyzerBeats(UserSettingsPointer pConfig, bool enforceBpmDetecti
m_iMaxBpm(9999) {
}

bool AnalyzerBeats::initialize(TrackPointer tio, int sampleRate, int totalSamples) {
bool AnalyzerBeats::initialize(TrackPointer pTrack, int sampleRate, int totalSamples) {
if (totalSamples == 0) {
return false;
}
Expand All @@ -49,7 +49,7 @@ bool AnalyzerBeats::initialize(TrackPointer tio, int sampleRate, int totalSample
return false;
}

bool bpmLock = tio->isBpmLocked();
bool bpmLock = pTrack->isBpmLocked();
if (bpmLock) {
qDebug() << "Track is BpmLocked: Beat calculation will not start";
return false;
Expand Down Expand Up @@ -100,8 +100,7 @@ bool AnalyzerBeats::initialize(TrackPointer tio, int sampleRate, int totalSample
m_iCurrentSample = 0;

// if we can load a stored track don't reanalyze it
bool bShouldAnalyze = shouldAnalyze(tio);

bool bShouldAnalyze = shouldAnalyze(pTrack);

DEBUG_ASSERT(!m_pPlugin);
if (bShouldAnalyze) {
Expand Down Expand Up @@ -130,7 +129,7 @@ bool AnalyzerBeats::initialize(TrackPointer tio, int sampleRate, int totalSample
return bShouldAnalyze;
}

bool AnalyzerBeats::shouldAnalyze(TrackPointer tio) const {
bool AnalyzerBeats::shouldAnalyze(TrackPointer pTrack) const {
int iMinBpm;
int iMaxBpm;
if (m_bpmSettings.getAllowBpmAboveRange()) {
Expand All @@ -141,7 +140,7 @@ bool AnalyzerBeats::shouldAnalyze(TrackPointer tio) const {
iMaxBpm = m_bpmSettings.getBpmRangeEnd();
}

bool bpmLock = tio->isBpmLocked();
bool bpmLock = pTrack->isBpmLocked();
if (bpmLock) {
qDebug() << "Track is BpmLocked: Beat calculation will not start";
return false;
Expand All @@ -151,7 +150,7 @@ bool AnalyzerBeats::shouldAnalyze(TrackPointer tio) const {

// If the track already has a Beats object then we need to decide whether to
// analyze this track or not.
BeatsPointer pBeats = tio->getBeats();
mixxx::BeatsPointer pBeats = pTrack->getBeats();
if (pBeats) {
QString version = pBeats->getVersion();
QString subVersion = pBeats->getSubVersion();
Expand Down Expand Up @@ -207,7 +206,7 @@ void AnalyzerBeats::cleanup() {
m_pPlugin.reset();
}

void AnalyzerBeats::storeResults(TrackPointer tio) {
void AnalyzerBeats::storeResults(TrackPointer pTrack) {
VERIFY_OR_DEBUG_ASSERT(m_pPlugin) {
return;
}
Expand All @@ -217,13 +216,13 @@ void AnalyzerBeats::storeResults(TrackPointer tio) {
return;
}

BeatsPointer pBeats;
mixxx::BeatsPointer pBeats;
if (m_pPlugin->supportsBeatTracking()) {
QVector<double> beats = m_pPlugin->getBeats();
QHash<QString, QString> extraVersionInfo = getExtraVersionInfo(
m_pluginId, m_bPreferencesFastAnalysis);
pBeats = BeatFactory::makePreferredBeats(
*tio,
pTrack,
beats,
extraVersionInfo,
m_bPreferencesFixedTempo,
JaviVilarroig marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -237,21 +236,23 @@ void AnalyzerBeats::storeResults(TrackPointer tio) {
} else {
float bpm = m_pPlugin->getBpm();
qDebug() << "AnalyzerBeats plugin detected constant BPM: " << bpm;
pBeats = BeatFactory::makeBeatGrid(*tio, bpm, 0.0f);
pBeats = std::make_shared<mixxx::Beats>(pTrack.get());
pBeats->setGrid(bpm);
pTrack->setBeats(pBeats);
}

BeatsPointer pCurrentBeats = tio->getBeats();
mixxx::BeatsPointer pCurrentBeats = pTrack->getBeats();

// If the track has no beats object then set our newly generated one
// regardless of beat lock.
if (!pCurrentBeats) {
tio->setBeats(pBeats);
pTrack->setBeats(pBeats);
return;
}

// If the track received the beat lock while we were analyzing it then we
// abort setting it.
if (tio->isBpmLocked()) {
if (pTrack->isBpmLocked()) {
qDebug() << "Track was BPM-locked as we were analyzing it. Aborting analysis.";
return;
}
Expand All @@ -264,7 +265,7 @@ void AnalyzerBeats::storeResults(TrackPointer tio) {
qDebug() << "Replacing 0-BPM beatgrid with a" << pBeats->getBpm()
<< "beatgrid.";
}
tio->setBeats(pBeats);
pTrack->setBeats(pBeats);
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/analyzer/analyzerbeats.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class AnalyzerBeats : public Analyzer {

static QList<mixxx::AnalyzerPluginInfo> availablePlugins();

bool initialize(TrackPointer tio, int sampleRate, int totalSamples) override;
bool initialize(TrackPointer pTrack, int sampleRate, int totalSamples) override;
bool processSamples(const CSAMPLE *pIn, const int iLen) override;
void storeResults(TrackPointer tio) override;
void storeResults(TrackPointer pTrack) override;
void cleanup() override;

private:
bool shouldAnalyze(TrackPointer tio) const;
bool shouldAnalyze(TrackPointer pTrack) const;
static QHash<QString, QString> getExtraVersionInfo(
QString pluginId, bool bPreferencesFastAnalysis);

Expand Down
2 changes: 2 additions & 0 deletions src/controllers/controlpickermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
addDeckControl("beats_translate_match_alignment", tr("Adjust Beatgrid - Match Alignment"),
tr("Adjust beatgrid to match another playing deck."), bpmMenu);
addDeckAndSamplerControl("quantize", tr("Quantize Mode"), tr("Toggle quantize mode"), bpmMenu);
addDeckAndSamplerControl("beats_set_bar_beat", tr("Set Bar Beat"),
tr("Make the current beat a Bar beat"), bpmMenu);

QMenu* syncMenu = addSubmenu(tr("Sync"));
addDeckAndSamplerControl("sync_enabled", tr("Sync Mode"),
Expand Down
Loading