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

Intro/Outro cues and silence detection #1242

Merged
merged 143 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
99994dc
Introduce silence detection
ninomp Apr 24, 2017
871474b
Address some review comments
ninomp Apr 29, 2017
b118d49
Remove label and hotcue number from begin/end markers
ninomp Apr 30, 2017
555911a
Introduce source field to cue
ninomp May 13, 2017
bed7843
Rename signal begin/end points to AutoDJ start/end
ninomp May 22, 2017
6587080
Enable user to edit AutoDJ start/end points
ninomp May 22, 2017
54cc99f
Make AutoDJ use start/end cue points
ninomp Jun 3, 2017
0f583b9
Fix tests
ninomp Jun 5, 2017
b8ecf19
Correct coding style
ninomp Jun 7, 2017
095dd81
Forbid user to place start point after end point or vice versa
ninomp Jun 7, 2017
a5b22b5
Use duration instead of track_samples/track_samplerate
ninomp Jun 11, 2017
90f2c81
Make deck CUE point follow track's CUE point
ninomp Jun 22, 2017
d5385e5
Move cue loading logic away from CueControl::trackLoaded()
ninomp Jun 24, 2017
aee31e0
Automatically place main cue point
ninomp Jun 25, 2017
6eaa83d
Introduce cue_clear CO
ninomp Jun 25, 2017
49888d7
Merge branch 'master' into silencedetection
ninomp Jun 25, 2017
666068d
Merge branch 'master' into silencedetection
ninomp Jul 9, 2017
59f19eb
Merge commit 'd2513a6ed996c81def0618a97d3059dfeca02f75' into silenced…
ninomp Feb 9, 2018
20f8796
Merge commit '80f3ea50a80086ceb2fa38b2f6256951a744d985' into silenced…
ninomp Feb 11, 2018
d0f1d90
Merge branch 'master' into silencedetection
ninomp Feb 12, 2018
92b79f1
Move src/library/dao/cue.{h,cpp} to src/track/cue.{h,cpp}
ninomp Feb 12, 2018
f95c646
Fix failing EngineBufferE2ETest.CueGotoAndPlayTest
ninomp Feb 12, 2018
4889fa2
Write basic unit test for AnalyzerSilence
ninomp Feb 13, 2018
87a3e04
Add test for AnalyzerSilence with silence in the middle
ninomp Feb 14, 2018
8c01dd0
Merge commit '833e2ce7caac14073c32a251d02cadf7b585a4b2' into silenced…
ninomp May 2, 2018
416bc08
Merge branch 'master' into silencedetection
ninomp May 3, 2018
f971053
Fix crash when attempting to clear non-existing hotcue
ninomp May 11, 2018
3ebfdc2
Enable clearing main cue point from track context menu
ninomp May 14, 2018
4d27845
Fix failing EngineBufferE2ETest.CueGotoAndPlay test
ninomp May 22, 2018
43c6441
Visualize cue source on waveform
ninomp May 27, 2018
4472462
Display AutoDJ Start/End markers in all skins
ninomp May 17, 2018
13ffd54
Attempt to fix Windows build
ninomp May 27, 2018
64082c0
Test that cues AnalyzerSilence creates have source accordingly set
ninomp May 29, 2018
784c9f8
Add buttons for setting/clearing AutoDJ cues to LateNight skin
ninomp May 31, 2018
259a169
Remove TRIGGER from AutoDJ ControlPushButtons
ninomp Jun 1, 2018
83766c0
Add controls for setting/clearing AutoDJ cues to Deere skin
ninomp Jun 2, 2018
44beb4c
Test AnalyzerSilence to respect user edits
ninomp May 30, 2018
8dacede
Add buttons for setting/clearing AutoDJ cues to Tango skin
ninomp Jun 9, 2018
e7fb679
Add buttons for setting/clearing AutoDJ cues to Shade skin
ninomp Jun 12, 2018
e09f369
Seek to AutoDJ start on track load when AutoDJ is enabled
ninomp Aug 5, 2018
865e454
Test that AutoDJProcessor changes seekOnLoadMode of decks 1 and 2
ninomp Aug 14, 2018
221b5a4
Fix incorrect use of EXPECT_EQ in AnalyzerSilenceTest
ninomp Aug 14, 2018
6a41779
Move quantization of auto-placed cue from Track to CueControl
ninomp Aug 14, 2018
7dab7fd
Make sure Track::findCueByType() is not used for hotcues
ninomp Aug 14, 2018
3ab12a3
Fix bug in Track when cue source is not modified if cue position is
ninomp Aug 15, 2018
98828b9
Test that cue point is correctly placed by AnalyzerSilence
ninomp Aug 14, 2018
227ebe8
Fix MSVS Windows build
ninomp Aug 15, 2018
ad1bf43
Merge commit 'a8db0b882a857bf79a2df5b11f3890003869a967' into silenced…
ninomp Oct 11, 2018
7959376
Merge commit '3642859e4b831e6632977527bdd0c9355f56ea7a' into silenced…
ninomp Oct 16, 2018
d5bdb64
Merge commit 'bd49c0b5bba81c23d809674d57a0bb680734d4a8' into silenced…
ninomp Oct 16, 2018
c42089c
Merge commit '43bda29af9bf931dc7fd16440e096c82b46d0b6e' into silenced…
ninomp Oct 25, 2018
f5aeeba
Merge commit '297d8803d96a7ae32853cb058304d72429ebeba1' into silenced…
ninomp Oct 25, 2018
fbc60e7
Write test that ensures AutoDJ end cue is respected
ninomp Oct 26, 2018
7f16257
Wrap cue position with its source in CuePosition class
ninomp Jul 1, 2017
ddeee23
Finish renaming begin cue to start cue
ninomp Nov 3, 2018
24e9099
AnalyzerSilence: Convert dB to ratio earlier
ninomp Nov 3, 2018
2b2da0c
Merge commit '5f9e192df59165fb8bc832aecddace694e07bd97' into silenced…
ninomp Nov 4, 2018
35707a4
Merge commit '07ddccb6f21c3cda27f1f91dabffeaeeeac349e0' into silenced…
ninomp Nov 4, 2018
638cad8
Merge commit '54261f3b8f3221578aa95c928ca5217852eeac9b' into silenced…
ninomp Nov 19, 2018
032c1c0
Merge commit 'd0a441d9cee780282eb4ce3e42d20e9412050ea7' into silenced…
ninomp Nov 19, 2018
c2916dc
Merge commit '9f3b86ef353ee6741acf927a38f64b4d525a1e37' into silenced…
ninomp Dec 15, 2018
e6a0112
Merge commit 'ea9c98367734788eb34cebc9b64d917b4b2ebcab' into silenced…
ninomp Dec 18, 2018
e89a753
Quantize detected cue point only if quantization is enabled
ninomp Dec 19, 2018
d6cfc92
Quantize AutoDJ start/end cue points
ninomp Nov 28, 2018
ae26278
Split CueControl::trackCuesUpdated() into loadCuesFromTrack() and rel…
ninomp Dec 22, 2018
4b07a89
Merge commit '7faf5e07cb612d524a8214cae2d261b178ae28d1' into silenced…
ninomp Dec 30, 2018
84b774c
Merge commit 'b9c9b7f38251524d1fa5793142e89b32920a6c27' into silenced…
ninomp Dec 30, 2018
310e4c5
Merge commit '18e9314383de7ee83af146a44b380c80298b0d55' into silenced…
ninomp Dec 31, 2018
70f0f32
Fix setting of AutoDJ start/end cue when AutoDJ end/start cue is not set
ninomp Dec 31, 2018
24f137d
Rename AutoDJ Start/End cues to Intro/Outro cues
ninomp Jan 3, 2019
1a2d5c1
Introduce Intro/Outro Start/End cue points
ninomp Jan 6, 2019
fa95569
Merge commit '28f902e0c1e16779062cab9fee3e137bf8a32d19' into silenced…
ninomp Jan 10, 2019
a61ac72
Merge commit '2ddc30fbfdda13fb543c389faf83ac00b507553b' into silenced…
ninomp Jan 14, 2019
8a9f716
Merge commit '4fe4653b859f0555874343d7e9309304e1eb8b93' into silenced…
ninomp Jan 15, 2019
bd92970
Merge commit '5a605d5b01a223891ce15e84e99a4d56067503a6' into silenced…
ninomp Jan 15, 2019
3a6e8dc
CueControl: replace SIGNAL & SLOT with Qt 5 functor syntax
ninomp Jan 15, 2019
02332e7
CueControl: Reduce duplication around loading cues
ninomp Jan 18, 2019
9250a74
Try to satisfy CodeFactor and address some review comments
ninomp Jan 18, 2019
667370a
Try to fix build on Windows and macOS
ninomp Jan 20, 2019
586d331
Merge commit 'e2a91cfe3db56ed858de8028643dbd819a86ca76' into silenced…
ninomp Jan 22, 2019
3b51ac4
Merge branch 'master' into silencedetection
ninomp Jan 22, 2019
d36ee69
Save intro and outro cues as range cues
ninomp Jan 22, 2019
10bb36e
Write tests for AutoDJ pause transition
ninomp Jan 27, 2019
2ab4adb
AutoDJProcessor: Replace SIGNAL & SLOT with Qt 5 functor syntax
ninomp Jan 28, 2019
468017e
Make AutoDJProcessor respect Outro Start cue
ninomp Jan 30, 2019
fd4d979
CueControl: No need to update COs from set/clear slots for intro/outr…
ninomp Jan 31, 2019
6d7d523
CueControl: Introduce *_enabled COs for intro and outro cues
ninomp Jan 31, 2019
a8d66a7
intro/outro markers Shade
ronso0 Feb 1, 2019
e9923a6
intro/outro markers Tango
ronso0 Feb 1, 2019
2913cdd
intro/outro markers LateNight
ronso0 Feb 1, 2019
f345515
intro/outro markers Deere
ronso0 Feb 1, 2019
bd5a5a4
tweak Deere, clean up
ronso0 Feb 1, 2019
58565ee
fix LateNight overview marker
ronso0 Feb 1, 2019
2a75438
"AutoDJ Cue Buttons" -> "Intro & Outro Cues"
Be-ing Feb 1, 2019
6f50e4c
Fix crash when there are multiple <MarkRange> tags in overviews and w…
ninomp Feb 3, 2019
86fae61
Undo introduction of WaveformMarkRangePointer
ninomp Feb 4, 2019
1ba11bd
AnalyzerSilence: Don't modify track from process()
ninomp Feb 4, 2019
6ed59d5
Merge commit '5d2651d93d3a923aa2c0e25153e33340bcd7e15e' into silenced…
ninomp Feb 5, 2019
028fc57
Merge branch 'master' into silencedetection
ninomp Feb 5, 2019
cbefc58
Merge pull request #2 from Be-ing/intro_outro_markers
ninomp Feb 5, 2019
da03ecb
Add <MarkRange> for intro and outro cues to all skins
ninomp Feb 5, 2019
21b51f9
Remove obsolete button icons from Deere and LateNight
ninomp Feb 5, 2019
39acb51
Move custom logic from CuePosition::getSource() to AnalyzerSilence::s…
ninomp Feb 5, 2019
cbb2eb2
AnalyzerSilence: Create Cues in finalize() instead of initialize()
ninomp Feb 7, 2019
4f29098
CueControl: Implement hotcue-like behaviour for intro/outro cues
ninomp Feb 8, 2019
fa3855c
Make all skins use hotcue-like behaviour for intro/outro cues
ninomp Feb 8, 2019
b345adc
WaveformRenderMark: Only append question mark to AUTOMATIC cues
ninomp Feb 8, 2019
59d20a8
CueControl: Disallow placing intro/outro cues out of order
ninomp Feb 8, 2019
f1d887f
Fix saving of range cues with only start or end
ninomp Feb 8, 2019
4ebecca
Tango: Fix intro/outro cue buttons not indicating if cue is set
ninomp Feb 9, 2019
e827104
Shade: Draw icons for intro/outro cue buttons
ninomp Feb 11, 2019
425bb20
Shade: Remove intro/outro cue buttons from looping section
ninomp Feb 12, 2019
cc24260
Track properties dialog: Show intro and outro cues on Cuepoints tab
ninomp Feb 12, 2019
0ddf621
Track properties dialog: Add Type column to table on Cuepoints tab
ninomp Feb 12, 2019
2aa9f99
Skins: Shorten labels for intro/outro cues on waveforms
ninomp Feb 12, 2019
e69e41a
Merge commit 'b70157731738f93239cd60a43af35fdb58598b84' into silenced…
ninomp Feb 14, 2019
090e1ca
Merge commit '4c2f2403a34fded43ece3f443db2981fc5a1f5d2' into silenced…
ninomp Feb 14, 2019
788c67a
Waveform: Add ability to hide individual marks and ranges via CO
ninomp Feb 16, 2019
d8d4875
Shade: Use the same CO for showing/hiding intro/outro cues as all oth…
ninomp Feb 16, 2019
a7cfbd5
Skins: Show/Hide intro/outro cues on waveforms and overviews
ninomp Feb 16, 2019
e4f0d5a
Skins: Make intro/outro cues shown by default
ninomp Feb 17, 2019
ce04bfa
Skins: Remove question mark that visualizes cue source
ninomp Feb 18, 2019
ee4ab9e
Merge commit 'ce98cd4b5dc251a18d8e38fa46a47442007e0b1b' into silenced…
ninomp Feb 22, 2019
acc6b4c
Merge commit '49b728f06207d0fbb6215a1fd96c6078f31e6281' into silenced…
ninomp Feb 22, 2019
014a55f
Write tooltips for intro/outro cue buttons
ninomp Feb 23, 2019
1341ef1
Skins: Use tooltips for intro/outro cue buttons
ninomp Feb 23, 2019
25a67d9
Write basic unit tests for CueControl
ninomp Mar 23, 2019
807c180
Write more tests for CueControl
ninomp Mar 25, 2019
7a7e3e5
CueControl: Stop exposing sources of cues because they are unused
ninomp Mar 19, 2019
65dc18e
CueControl: Fix computation of end position for intro/outro cues
ninomp Mar 27, 2019
8cc7d9d
Waveform: Remove unused functionality: Visualizing sources of cues
ninomp Mar 19, 2019
1cd3fcc
Merge commit 'da9d5a15cdd608d27895fbab5c6ebd854e88eacb' into silenced…
ninomp Mar 27, 2019
55307f7
Merge commit '56bdf12297eb17741a948a705276f1f9d5538931' into silenced…
ninomp Mar 29, 2019
60d5326
Merge commit '9ee75377510d00b0491e4a934704b11e5cd33efb' into silenced…
ninomp Mar 29, 2019
bbf985a
Merge commit 'edc8cd2e9001fcdefefba9ef6eeab98db50147bd' into silenced…
ninomp Mar 29, 2019
edbbf3c
Merge commit '1276bf81ad02d2068d693bd67cfcf10f4899d59a' into silenced…
ninomp Mar 29, 2019
fcdff0f
CueControl: Reduce duplication of quantization code
ninomp Mar 13, 2019
eb03b2f
Remove undefined methods from Cue
ninomp Mar 29, 2019
9dbac85
Test AnalyzerSilence to correctly update range cues
ninomp Apr 7, 2019
4923a2a
AnalyzerSilence: Correctly update range cues
ninomp Apr 7, 2019
36b4418
Test CueControl to properly quantize cues on track load
ninomp Apr 9, 2019
57a922d
WOverview: Make marks visible by default
ninomp Apr 9, 2019
6b36e82
CueControl: Write tests for SeekOnLoad modes
ninomp Apr 14, 2019
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
3 changes: 2 additions & 1 deletion build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ def sources(self, build):
"analyzer/analyzerwaveform.cpp",
"analyzer/analyzergain.cpp",
"analyzer/analyzerebur128.cpp",
"analyzer/analyzersilence.cpp",

"controllers/controller.cpp",
"controllers/controllerdebug.cpp",
Expand Down Expand Up @@ -984,7 +985,6 @@ def sources(self, build):
"library/scanner/recursivescandirectorytask.cpp",

"library/dao/cuedao.cpp",
"library/dao/cue.cpp",
"library/dao/trackdao.cpp",
"library/dao/playlistdao.cpp",
"library/dao/libraryhashdao.cpp",
Expand Down Expand Up @@ -1079,6 +1079,7 @@ def sources(self, build):
"track/beatutils.cpp",
"track/beats.cpp",
"track/bpm.cpp",
"track/cue.cpp",
"track/keyfactory.cpp",
"track/keys.cpp",
"track/keyutils.cpp",
Expand Down
9 changes: 9 additions & 0 deletions res/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,13 @@ METADATA
ALTER TABLE cues ADD COLUMN color INTEGER DEFAULT 4294901760 NOT NULL;
</sql>
</revision>
<revision version="28" min_compatible="3">
<description>
Add source to cue. Default is MANUAL.
daschuer marked this conversation as resolved.
Show resolved Hide resolved
See library/dao/cue.h.
</description>
<sql>
ALTER TABLE cues ADD COLUMN source INTEGER DEFAULT 2 NOT NULL;
</sql>
</revision>
</schema>
14 changes: 14 additions & 0 deletions res/skins/LateNight/waveform.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@
<Color>#FF001C</Color>
<TextColor>#FFFFFF</TextColor>
</Mark>
<Mark>
<Control>autodj_start_position</Control>
<Text>BEGIN</Text>
<Align>left|vcenter</Align>
<Color>#00FF00</Color>
<TextColor>#FFFFFF</TextColor>
</Mark>
<Mark>
<Control>autodj_end_position</Control>
<Text>END</Text>
<Align>right|vcenter</Align>
<Color>#00FF00</Color>
<TextColor>#FFFFFF</TextColor>
</Mark>
</Visual>
</Children>
</WidgetGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/analyzer/analyzerqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "analyzer/analyzergain.h"
#include "analyzer/analyzerebur128.h"
#include "analyzer/analyzerwaveform.h"
#include "analyzer/analyzersilence.h"
#include "library/dao/analysisdao.h"
#include "engine/engine.h"
#include "mixer/playerinfo.h"
Expand Down Expand Up @@ -60,6 +61,7 @@ AnalyzerQueue::AnalyzerQueue(
}
m_pAnalyzers.push_back(std::make_unique<AnalyzerGain>(pConfig));
m_pAnalyzers.push_back(std::make_unique<AnalyzerEbur128>(pConfig));
m_pAnalyzers.push_back(std::make_unique<AnalyzerSilence>(pConfig));
#ifdef __VAMP__
m_pAnalyzers.push_back(std::make_unique<AnalyzerBeats>(pConfig));
m_pAnalyzers.push_back(std::make_unique<AnalyzerKey>(pConfig));
Expand Down
114 changes: 114 additions & 0 deletions src/analyzer/analyzersilence.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#include "analyzer/analyzersilence.h"
#include "engine/engine.h"

namespace {
const mixxx::AudioSignal::ChannelCount kChannelCount = mixxx::kEngineChannelCount;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No indent for namespaces and prefer to use constexpr instead of const

const float kSilenceThresholdDb = -60.0f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this work?
constexpr float kSilenceThreshold = db2ratio(-60.0f);

} // anonymous namespace

AnalyzerSilence::AnalyzerSilence(UserSettingsPointer pConfig)
: m_pConfig(pConfig),
m_fThreshold(db2ratio(kSilenceThresholdDb)),
m_iFramesProcessed(0),
m_bPrevSilence(true),
m_iSignalBegin(-1),
m_iSignalEnd(-1) {
}

AnalyzerSilence::~AnalyzerSilence() {
}

bool AnalyzerSilence::initialize(TrackPointer tio, int sampleRate, int totalSamples) {
Q_UNUSED(sampleRate);
Q_UNUSED(totalSamples);

m_iFramesProcessed = 0;
m_bPrevSilence = true;
m_iSignalBegin = -1;
m_iSignalEnd = -1;

m_pTrack = tio;

m_pBeginCue = tio->findCueByType(Cue::BEGIN);
if (!m_pBeginCue) {
m_pBeginCue = tio->createAndAddCue();
m_pBeginCue->setType(Cue::BEGIN);
m_pBeginCue->setSource(Cue::AUTOMATIC);
m_pBeginCue->setPosition(-1.0);
}

m_pEndCue = tio->findCueByType(Cue::END);
if (!m_pEndCue) {
m_pEndCue = tio->createAndAddCue();
m_pEndCue->setType(Cue::END);
m_pEndCue->setSource(Cue::AUTOMATIC);
m_pEndCue->setPosition(-1.0);
}

return !isDisabledOrLoadStoredSuccess(tio);
}

bool AnalyzerSilence::isDisabledOrLoadStoredSuccess(TrackPointer tio) const {
return tio->getCuePointSource() == Cue::MANUAL &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the CUE relevant here?
You may wrap this into a function with an explaining name

m_pBeginCue->getSource() == Cue::MANUAL &&
m_pEndCue->getSource() == Cue::MANUAL;
}

void AnalyzerSilence::process(const CSAMPLE* pIn, const int iLen) {
for (int i = 0; i < iLen; i += kChannelCount) {
daschuer marked this conversation as resolved.
Show resolved Hide resolved
// Compute max of channels in this sample frame
CSAMPLE fMax = CSAMPLE_ZERO;
for (SINT ch = 0; ch < kChannelCount; ++ch) {
daschuer marked this conversation as resolved.
Show resolved Hide resolved
CSAMPLE fAbs = fabs(pIn[i + ch]);
fMax = math_max(fMax, fAbs);
}

bool bSilence = fMax < m_fThreshold;

if (m_bPrevSilence && !bSilence) {
if (m_iSignalBegin < 0) {
m_iSignalBegin = m_iFramesProcessed + i / kChannelCount;

if (m_pTrack->getCuePointSource() != Cue::MANUAL) {
double position = m_iFramesProcessed * kChannelCount + i;
m_pTrack->setCuePoint(position, Cue::AUTOMATIC);
}
}
} else if (!m_bPrevSilence && bSilence) {
m_iSignalEnd = m_iFramesProcessed + i / kChannelCount;
}

m_bPrevSilence = bSilence;
}

m_iFramesProcessed += iLen / kChannelCount;
}

void AnalyzerSilence::cleanup(TrackPointer tio) {
Q_UNUSED(tio);
}

void AnalyzerSilence::finalize(TrackPointer tio) {
Q_UNUSED(tio);

if (m_iSignalBegin < 0) {
m_iSignalBegin = 0;
}
if (m_iSignalEnd < 0) {
m_iSignalEnd = m_iFramesProcessed;
}

// If track didn't end with silence, place signal end marker
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handle m_iSignalBegin < 0 and m_iSignalEnd < 0 explicitly here ?

// on the end of the track.
if (!m_bPrevSilence) {
m_iSignalEnd = m_iFramesProcessed;
}

if (m_pBeginCue->getSource() != Cue::MANUAL) {
m_pBeginCue->setPosition(kChannelCount * m_iSignalBegin);
}

if (m_pEndCue->getSource() != Cue::MANUAL) {
m_pEndCue->setPosition(kChannelCount * m_iSignalEnd);
}
}
33 changes: 33 additions & 0 deletions src/analyzer/analyzersilence.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef ANALYZER_ANALYZERSILENCE_H
#define ANALYZER_ANALYZERSILENCE_H

#include "analyzer/analyzer.h"
#include "preferences/usersettings.h"

class CuePointer;

class AnalyzerSilence : public Analyzer {
public:
AnalyzerSilence(UserSettingsPointer pConfig);
virtual ~AnalyzerSilence() override;

bool initialize(TrackPointer tio, int sampleRate, int totalSamples) override;
bool isDisabledOrLoadStoredSuccess(TrackPointer tio) const override;
void process(const CSAMPLE* pIn, const int iLen) override;
void finalize(TrackPointer tio) override;
void cleanup(TrackPointer tio) override;

private:
UserSettingsPointer m_pConfig;
float m_fThreshold;
int m_iFramesProcessed;
bool m_bPrevSilence;
int m_iSignalBegin;
int m_iSignalEnd;

TrackPointer m_pTrack;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to store a TrackPointer and you should not modify the track while processing. If the analysis is aborted you end up with an inconsistent state!

The track must be modified in finalize() which provides the TrackPointer.

CuePointer m_pBeginCue;
CuePointer m_pEndCue;
};

#endif // ANALYZER_ANALYZERSILENCE_H
2 changes: 1 addition & 1 deletion src/database/mixxxdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const QString MixxxDb::kDefaultSchemaFile(":/schema.xml");

//static
const int MixxxDb::kRequiredSchemaVersion = 27;
const int MixxxDb::kRequiredSchemaVersion = 28;

namespace {

Expand Down
Loading