Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/vinylcontrol/vinylcontrol.h

Go to the documentation of this file.
00001 #ifndef VINYLCONTROL_H
00002 #define VINYLCONTROL_H
00003 
00004 #include <qthread.h>
00005 #include "configobject.h"
00006 #include "controlobject.h"
00007 #include "soundmanagerconfig.h"
00008 //XXX: this is only so we have access to vinylcontrol status consts
00009 #include "engine/enginebuffer.h"
00010 
00011 class ControlObjectThread;
00012 
00013 #define MIXXX_VINYL_FINALSCRATCH "Final Scratch (crappy)"
00014 #define MIXXX_VINYL_MIXVIBESDVSCD "MixVibes DVS CD"
00015 #define MIXXX_VINYL_SERATOCV02VINYLSIDEA "Serato CV02 Vinyl, Side A"
00016 #define MIXXX_VINYL_SERATOCV02VINYLSIDEB "Serato CV02 Vinyl, Side B"
00017 #define MIXXX_VINYL_SERATOCD "Serato CD"
00018 #define MIXXX_VINYL_TRAKTORSCRATCHSIDEA "Traktor Scratch, side A"
00019 #define MIXXX_VINYL_TRAKTORSCRATCHSIDEB "Traktor Scratch, side B"
00020 
00021 #define MIXXX_VINYL_SPEED_33 "33.3 RPM"
00022 #define MIXXX_VINYL_SPEED_45 "45 RPM"
00023 
00024 #define MIXXX_VINYL_SPEED_33_NUM 33.3f 
00025 #define MIXXX_VINYL_SPEED_45_NUM 45.0f 
00026 
00027 #define MIXXX_VCMODE_ABSOLUTE 0
00028 #define MIXXX_VCMODE_RELATIVE 1
00029 #define MIXXX_VCMODE_CONSTANT  2
00030 #define MIXXX_VCMODE_SCRATCH  3
00031 
00032 #define MIXXX_RELATIVE_CUE_OFF 0
00033 #define MIXXX_RELATIVE_CUE_ONECUE 1
00034 #define MIXXX_RELATIVE_CUE_HOTCUE 2
00035 
00036 #define MIXXX_VC_DEFAULT_LEADINTIME 0
00037 
00038 #define MIXXX_VINYL_SCOPE_SIZE 100
00039 
00040 //TODO: Make this an EngineObject instead one day? (need to route all the input audio through the engine that way too...)
00041 
00042 class VinylControl : public QThread
00043 {
00044   public:
00045     VinylControl(ConfigObject<ConfigValue> *pConfig, QString group);
00046     virtual ~VinylControl();
00047     virtual void ToggleVinylControl(bool enable) = 0;
00048     virtual bool isEnabled() = 0;
00049     /*virtual void syncPitch(double pitch) = 0;
00050     virtual void syncPosition() = 0; */
00051     virtual void AnalyseSamples(const short* samples, size_t size) = 0;
00052     virtual float getSpeed();
00053     virtual float getTimecodeQuality();
00054     virtual unsigned char* getScopeBytemap();
00055     virtual float getAngle();
00056   protected:
00057     virtual void run() = 0; // main thread loop
00058 
00059     QString strVinylType;
00060     QString strVinylSpeed;
00061     ConfigObject<ConfigValue> *m_pConfig;    
00062     QString m_group;
00063     ControlObjectThread *playButton; //The ControlObject used to start/stop playback of the song.
00064     ControlObjectThread *playPos; //The ControlObject used to read the playback position in the song.
00065     ControlObjectThread *trackSamples;
00066     ControlObjectThread *trackSampleRate; 
00067     ControlObjectThread *vinylSeek; //The ControlObject used to change the playback position in the song.
00068     ControlObjectThread *controlScratch; //The ControlObject used to seek when the record is spinning fast.
00069     ControlObjectThread *rateSlider; //The ControlObject used to change the speed/pitch of the song.
00070     ControlObjectThread *reverseButton; //The ControlObject used to reverse playback of the song.
00071     ControlObjectThread *duration; //The ControlObject used to get the duration of the current song.
00072     ControlObjectThread *mode; //The ControlObject used to get the vinyl control mode (absolute/relative/scratch)
00073     ControlObjectThread *enabled; //The ControlObject used to get if the vinyl control is enabled or disabled.
00074     ControlObjectThread *wantenabled; //The ControlObject used to get if the vinyl control should try to enable itself
00075     ControlObjectThread *cueing; //Should cueing mode be active?
00076     ControlObjectThread *rateRange; //The ControlObject used to the get the pitch range from the prefs.
00077     ControlObjectThread *vinylStatus;
00078     ControlObjectThread *rateDir; //direction of rate
00079     ControlObjectThread *loopEnabled; //looping enabled?
00080     ControlObjectThread *signalenabled; //show the signal in the skin?
00081     //ControlObject *vinylStatus;  //Status of vinyl control
00082 
00083     int iLeadInTime; //The lead-in time...
00084     float dVinylPitch; //The speed/pitch of the timecoded vinyl as read by scratchlib.
00085     double dVinylPosition; //The position of the needle on the record as read by scratchlib.
00086     double dVinylScratch;
00087     double dDriftControl; //The difference between Mixxx's position and the needle's position on the record.
00088     //... these two values naturally drift apart, so we need to keep making adjustments to the pitch
00089     //to stop it from getting bad.
00090     float fRateRange; //The pitch range setting from Mixxx's preferences
00091     float m_fTimecodeQuality; //Used as a measure of the quality of the timecode signal.
00092 
00093     float fTrackDuration;
00094     unsigned long iSampleRate;
00095     bool bIsEnabled;
00096     int iRIAACorrection;
00097     int iVCMode;
00098     bool atRecordEnd;
00099 
00100     QWaitCondition waitForNextInput;
00101     QMutex lockInput;
00102     QMutex lockSamples;
00103 };
00104 
00105 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines