Skip to content

Commit

Permalink
Merge pull request #18 from daschuer/auto-dj-crates
Browse files Browse the repository at this point in the history
Auto dj crates from @ulatekh
  • Loading branch information
daschuer committed Jul 16, 2013
2 parents 341cef8 + 1c3df49 commit df18c70
Show file tree
Hide file tree
Showing 27 changed files with 1,742 additions and 32 deletions.
1 change: 1 addition & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ available_features = [features.HifiEq,
features.MSVSHacks,
features.Vamp,
features.PromoTracks,
features.AutoDjCrates,

# "Features" of dubious quality
features.PerfTools,
Expand Down
24 changes: 23 additions & 1 deletion build/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def sources(self, build):
sources = ['controllers/bulk/bulkcontroller.cpp',
'controllers/bulk/bulkenumerator.cpp']
if not int(build.flags['hid']):
sources.append('controllers/hid/hidcontrollerpresetfilehandler.cpp')
sources.append('controllers/hid/hidcontrollerpresetfilehandler.cpp')
return sources


Expand Down Expand Up @@ -1082,3 +1082,25 @@ def sources(self, build):
'library/bundledsongswebview.cpp',
"library/featuredartistswebview.cpp",
]

class AutoDjCrates(Feature):
def description(self):
return "Auto-DJ crates (for random tracks)"

def enabled(self, build):
build.flags['autodjcrates'] = \
util.get_flags(build.env, 'autodjcrates', 1)
if int(build.flags['autodjcrates']):
return True
return False

def add_options(self, build, vars):
vars.Add('autodjcrates', 'Set to 1 to enable crates as a source for random Auto-DJ tracks.', 1)

def configure(self, build, conf):
if not self.enabled(build):
return
build.env.Append(CPPDEFINES = '__AUTODJCRATES__')

def sources(self, build):
return ['library/dao/autodjcratesdao.cpp']
28 changes: 18 additions & 10 deletions build/qtcreator/mixxx.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CONFIG += debug link_pkgconfig portmidi script vinylcontrol m4a
CONFIG += debug link_pkgconfig portmidi script vinylcontrol m4a autodjcrates
# ladspa
DEFINES += QMAKE \ # define QMAKE for not-SCons specific ifdefs like ui_scriptstudio.h
__PORTAUDIO__ \
Expand Down Expand Up @@ -742,15 +742,15 @@ SOURCES += $$BASE_DIR/src/vamp/vampanalyser.cpp \
$$BASE_DIR/src/analyservamptest.cpp \
$$BASE_DIR/src/analyservampkeytest.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginBufferingAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginChannelAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginHostAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginInputDomainAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginLoader.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginSummarisingAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginWrapper.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/RealTime.cpp \
$$BASE_DIR/lib/vamp/src/vamp-sdk/PluginAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-sdk/RealTime.cpp
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginChannelAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginHostAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginInputDomainAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginLoader.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginSummarisingAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/PluginWrapper.cpp \
$$BASE_DIR/lib/vamp/src/vamp-hostsdk/RealTime.cpp \
$$BASE_DIR/lib/vamp/src/vamp-sdk/PluginAdapter.cpp \
$$BASE_DIR/lib/vamp/src/vamp-sdk/RealTime.cpp
}

CONFIG(tonal) {
Expand Down Expand Up @@ -856,6 +856,14 @@ CONFIG(ffmpeg) {
-logg
}

CONFIG(autodjcrates) {
DEFINES += __AUTODJCRATES__
HEADERS +=
$$BASE_DIR/src/library/dao/autodjcratesdao.h
SOURCES +=
$$BASE_DIR/src/library/dao/autodjcratesdao.cpp
}

# Copy Windows dependencies to DESTDIR.
win32 {
!exists($$DESTDIR):system( mkdir \"$$replace(DESTDIR, /,$$DIR_SEPARATOR)\" )
Expand Down
14 changes: 14 additions & 0 deletions src/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig,
connect(pushButtonSkipNext, SIGNAL(clicked(bool)),
this, SLOT(skipNextButton(bool)));

#ifdef __AUTODJCRATES__
connect(pushButtonAddRandom, SIGNAL(clicked(bool)),
this, SIGNAL(addRandomButton(bool)));
#else // __AUTODJCRATES__
pushButtonAddRandom->setVisible(false);
horizontalLayout->removeWidget(pushButtonAddRandom);
#endif // __AUTODJCRATES__

m_pCOFadeNow = new ControlPushButton(
ConfigKey("[AutoDJ]", "fade_now"));
m_pCOTFadeNow = new ControlObjectThreadMain(m_pCOFadeNow->getKey());
Expand Down Expand Up @@ -666,3 +674,9 @@ void DlgAutoDJ::transitionValueChanged(int value) {
ConfigValue(value));
m_backUpTransition = value;
}

void DlgAutoDJ::enableRandomButton(bool enabled) {
#ifdef __AUTODJCRATES__
pushButtonAddRandom->setEnabled(enabled);
#endif // __AUTODJCRATES__
}
2 changes: 2 additions & 0 deletions src/dlgautodj.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView {
void player1PlayChanged(double value);
void player2PlayChanged(double value);
void transitionValueChanged(int value);
void enableRandomButton(bool enabled);

signals:
void addRandomButton(bool buttonChecked);
void loadTrack(TrackPointer tio);
void loadTrackToPlayer(TrackPointer tio, QString group, bool);

Expand Down
7 changes: 7 additions & 0 deletions src/dlgautodj.ui
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonAddRandom">
<property name="text">
<string>Add random</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonSkipNext">
<property name="toolTip">
Expand Down
66 changes: 64 additions & 2 deletions src/dlgprefcontrols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,45 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx,
ComboBoxAutoDjRequeue->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue")).toInt());
connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int)));

#ifdef __AUTODJCRATES__

// The minimum available for randomly-selected tracks
autoDjMinimumAvailableSpinBox->setValue(
m_pConfig->getValueString(
ConfigKey("[Auto DJ]", "MinimumAvailable"), "20").toInt());
connect(autoDjMinimumAvailableSpinBox, SIGNAL(valueChanged(int)), this,
SLOT(slotSetAutoDjMinimumAvailable(int)));

// The auto-DJ replay-age for randomly-selected tracks
autoDjIgnoreTimeCheckBox->setChecked(
(bool) m_pConfig->getValueString(
ConfigKey("[Auto DJ]", "UseIgnoreTime"), "0").toInt());
connect(autoDjIgnoreTimeCheckBox, SIGNAL(stateChanged(int)), this,
SLOT(slotSetAutoDjUseIgnoreTime(int)));
autoDjIgnoreTimeEdit->setTime(
QTime::fromString(
m_pConfig->getValueString(
ConfigKey("[Auto DJ]", "IgnoreTime"), "23:59"),
autoDjIgnoreTimeEdit->displayFormat()));
autoDjIgnoreTimeEdit->setEnabled(
autoDjIgnoreTimeCheckBox->checkState() == Qt::Checked);
connect(autoDjIgnoreTimeEdit, SIGNAL(timeChanged(const QTime &)), this,
SLOT(slotSetAutoDjIgnoreTime(const QTime &)));

#else // __AUTODJCRATES__

// Remove the preferences.
autoDjMinimumAvailableLabel->setVisible(false);
GridLayout1->removeWidget(autoDjMinimumAvailableLabel);
autoDjMinimumAvailableSpinBox->setVisible(false);
GridLayout1->removeWidget(autoDjMinimumAvailableSpinBox);
autoDjIgnoreTimeCheckBox->setVisible(false);
GridLayout1->removeWidget(autoDjIgnoreTimeCheckBox);
autoDjIgnoreTimeEdit->setVisible(false);
GridLayout1->removeWidget(autoDjIgnoreTimeEdit);

#endif // __AUTODJCRATES__

//
// Skin configurations
//
Expand Down Expand Up @@ -424,8 +463,31 @@ void DlgPrefControls::slotSetAutoDjRequeue(int)
m_pConfig->set(ConfigKey("[Auto DJ]", "Requeue"), ConfigValue(ComboBoxAutoDjRequeue->currentIndex()));
}

void DlgPrefControls::slotSetTooltips(int)
{
void DlgPrefControls::slotSetAutoDjMinimumAvailable(int a_iValue) {
#ifdef __AUTODJCRATES__
QString str;
str.setNum(a_iValue);
m_pConfig->set(ConfigKey("[Auto DJ]","MinimumAvailable"),str);
#endif // __AUTODJCRATES__
}

void DlgPrefControls::slotSetAutoDjUseIgnoreTime(int a_iState) {
#ifdef __AUTODJCRATES__
bool bChecked = (a_iState == Qt::Checked);
QString strChecked = (bChecked) ? "1" : "0";
m_pConfig->set(ConfigKey("[Auto DJ]", "UseIgnoreTime"), strChecked);
autoDjIgnoreTimeEdit->setEnabled(bChecked);
#endif // __AUTODJCRATES__
}

void DlgPrefControls::slotSetAutoDjIgnoreTime(const QTime &a_rTime) {
#ifdef __AUTODJCRATES__
QString str = a_rTime.toString(autoDjIgnoreTimeEdit->displayFormat());
m_pConfig->set(ConfigKey("[Auto DJ]", "IgnoreTime"),str);
#endif // __AUTODJCRATES__
}

void DlgPrefControls::slotSetTooltips(int) {
int configValue = (ComboBoxTooltips->currentIndex() + 1) % 3;
m_mixxx->setToolTipsCfg(configValue);
}
Expand Down
3 changes: 3 additions & 0 deletions src/dlgprefcontrols.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public slots:
void slotSetCueDefault(int);
void slotSetCueRecall(int);
void slotSetAutoDjRequeue(int);
void slotSetAutoDjMinimumAvailable(int);
void slotSetAutoDjUseIgnoreTime(int);
void slotSetAutoDjIgnoreTime(const QTime &a_rTime);
void slotSetRateRamp(bool);
void slotSetRateRampSensitivity(int);
void slotSetLocale(int);
Expand Down
45 changes: 44 additions & 1 deletion src/dlgprefcontrolsdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>519</width>
<height>729</height>
<height>939</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -283,6 +283,49 @@
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="autoDjMinimumAvailableLabel">
<property name="text">
<string>Auto DJ: Minimum available tracks [%]</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="2">
<widget class="QSpinBox" name="autoDjMinimumAvailableSpinBox">
<property name="toolTip">
<string>This percentage of tracks are always available for selecting, regardless of when they were last played.</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>20</number>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QCheckBox" name="autoDjIgnoreTimeCheckBox">
<property name="toolTip">
<string>Uncheck, to ignore all played tracks.</string>
</property>
<property name="text">
<string>Auto DJ: Suspend track from re-queue</string>
</property>
</widget>
</item>
<item row="12" column="1" colspan="2">
<widget class="QTimeEdit" name="autoDjIgnoreTimeEdit">
<property name="toolTip">
<string>Duration after which a track is eligible for selection by Auto DJ again</string>
</property>
<property name="displayFormat">
<string>hh:mm</string>
</property>
<property name="timeSpec">
<enum>Qt::LocalTime</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
Expand Down
Loading

0 comments on commit df18c70

Please sign in to comment.