![]() |
Mixxx
|
00001 #ifndef RECORDINGMANAGER_H 00002 #define RECORDINGMANAGER_H 00003 00004 #include <QDesktopServices> 00005 #include <QDateTime> 00006 #include <QObject> 00007 00008 00009 #include "configobject.h" 00010 #include "controlobject.h" 00011 #include "controlobjectthread.h" 00012 #include "controlobjectthreadmain.h" 00013 #include "recording/defs_recording.h" 00014 00015 /* 00016 * The RecordingManager is a central class and manages 00017 * the recoring feature of Mixxx. 00018 * 00019 * There is exactly one instance of this class 00020 * 00021 * All methods in this class are thread-safe 00022 * 00023 * Note: The RecordingManager lives in the GUI thread 00024 */ 00025 00026 class ControlPushButton; 00027 class ControlObjectThreadMain; 00028 00029 class RecordingManager : public QObject 00030 { 00031 Q_OBJECT 00032 public: 00033 RecordingManager(ConfigObject<ConfigValue>* pConfig); 00034 virtual ~RecordingManager(); 00035 00036 00037 // This will try to start recording If successfuly, slotIsRecording will be 00038 // called and a signal isRecording will be emitted. Parameter semantic: If 00039 // true the method computes the filename based on date/time information this 00040 // is the default behaviour If false, slotBytesRecorded just noticed that 00041 // recording must be interrupted to split the file The nth filename will 00042 // follow the date/time name of the first split but with a suffix 00043 void startRecording(bool generateFileName=true); 00044 void stopRecording(); 00045 bool isRecordingActive(); 00046 QString& getRecordingDir(); 00047 // Returns the currently recording file 00048 QString& getRecordingFile(); 00049 QString& getRecordingLocation(); 00050 00051 signals: 00052 //emits the commulated number of bytes being recorded 00053 void bytesRecorded(long); 00054 void isRecording(bool); 00055 00056 public slots: 00057 void slotIsRecording(bool); 00058 void slotBytesRecorded(int); 00059 00060 private slots: 00061 void slotToggleRecording(double v); 00062 00063 private: 00064 QString formatDateTimeForFilename(QDateTime dateTime) const; 00065 ControlObjectThread* m_recReady; 00066 ControlObject* m_recReadyCO; 00067 ControlPushButton* m_pToggleRecording; 00068 00069 long getFileSplitSize(); 00070 00071 ConfigObject<ConfigValue>* m_pConfig; 00072 QString m_recordingDir; 00073 //the base file 00074 QString m_recording_base_file; 00075 //filename without path 00076 QString m_recordingFile; 00077 //Absolute file 00078 QString m_recordingLocation; 00079 00080 bool m_isRecording; 00081 //will be a very large number 00082 long m_iNumberOfBytesRecored; 00083 long m_split_size; 00084 int m_iNumberSplits; 00085 }; 00086 00087 #endif // RECORDINGMANAGER_H