Skip to content

Commit

Permalink
Allow toggle of recording via control. This is meant to be a 1.11.x i…
Browse files Browse the repository at this point in the history
…mprovement but I'm adding it here since it's very simple and so that 1.11.x skins aren't totally broken when used on 1.10.x releases. Fixes Bug #910697
  • Loading branch information
rryan committed Mar 16, 2012
1 parent 8fc9be4 commit a59dbd3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mixxx/src/recording/defs_recording.h
Expand Up @@ -8,9 +8,9 @@
#define ENCODING_OGG "OGG"
#define ENCODING_MP3 "MP3"

#define RECORD_READY 0.50f
#define RECORD_ON 1.0f
#define RECORD_OFF 0.0f
#define RECORD_READY 1.0f
#define RECORD_ON 2.0f

//File options for preferences Splitting
#define SPLIT_650MB "650 MB (CD)"
Expand Down
15 changes: 15 additions & 0 deletions mixxx/src/recording/recordingmanager.cpp
Expand Up @@ -5,6 +5,7 @@
#include <QDir>
#include "recordingmanager.h"
#include "recording/defs_recording.h"
#include "controlpushbutton.h"

#define CD_650

Expand All @@ -18,13 +19,17 @@ RecordingManager::RecordingManager(ConfigObject<ConfigValue>* pConfig) :
m_iNumberOfBytesRecored(0),
m_split_size(0),
m_iNumberSplits(0) {
m_pToggleRecording = new ControlPushButton(ConfigKey("[Master]", "toggle_recording"));
connect(m_pToggleRecording, SIGNAL(valueChanged(double)),
this, SLOT(slotToggleRecording(double)));
m_recReadyCO = new ControlObject(ConfigKey("[Master]", "Record"));
m_recReady = new ControlObjectThread(m_recReadyCO);

QDir os_music_folder_dir(m_pConfig->getValueString(ConfigKey("[Playlist]", "Directory")));
//Check if there's a folder Mixxx within the music directory
QDir mixxxDir(os_music_folder_dir.absolutePath() +"/Mixxx");


if(!mixxxDir.exists()) {

if(os_music_folder_dir.mkdir("Mixxx")) {
Expand Down Expand Up @@ -71,6 +76,16 @@ QString RecordingManager::formatDateTimeForFilename(QDateTime dateTime) const {
return formatted;
}

void RecordingManager::slotToggleRecording(double v) {
if (v > 0) {
if (isRecordingActive()) {
stopRecording();
} else {
startRecording();
}
}
}

void RecordingManager::startRecording(bool generateFileName) {
m_iNumberOfBytesRecored = 0;
m_split_size = getFileSplitSize();
Expand Down
5 changes: 5 additions & 0 deletions mixxx/src/recording/recordingmanager.h
Expand Up @@ -23,6 +23,7 @@
* Note: The RecordingManager lives in the GUI thread
*/

class ControlPushButton;
class ControlObjectThreadMain;

class RecordingManager : public QObject
Expand Down Expand Up @@ -56,10 +57,14 @@ class RecordingManager : public QObject
void slotIsRecording(bool);
void slotBytesRecorded(int);

private slots:
void slotToggleRecording(double v);

private:
QString formatDateTimeForFilename(QDateTime dateTime) const;
ControlObjectThread* m_recReady;
ControlObject* m_recReadyCO;
ControlPushButton* m_pToggleRecording;

long getFileSplitSize();

Expand Down

0 comments on commit a59dbd3

Please sign in to comment.