Mixxx

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

Go to the documentation of this file.
00001 #ifndef __VINYLCONTROLXWAX_H__
00002 #define __VINYLCONTROLXWAX_H__
00003 
00004 #include "vinylcontrol.h"
00005 #include <time.h>
00006 #include <QTime>
00007 
00008 #ifdef _MSC_VER
00009 #include "timecoder.h"
00010 #else
00011 extern "C" {
00012 #include "timecoder.h"
00013 }
00014 #endif
00015 
00016 #define XWAX_DEVICE_FRAME 32
00017 #define XWAX_SMOOTHING (128 / XWAX_DEVICE_FRAME) /* result value is in frames */
00018 #define RING_SIZE 30
00019 #define QUALITY_RING_SIZE 100
00020 #define MIN_SIGNAL 75
00021 
00022 
00023 class VinylControlXwax : public VinylControl
00024 {
00025   public:
00026     VinylControlXwax(ConfigObject<ConfigValue> *pConfig, QString group);
00027     virtual ~VinylControlXwax();
00028     void ToggleVinylControl(bool enable);
00029     bool isEnabled();
00030     static void freeLUTs();
00031     unsigned char* getScopeBytemap();
00032     float getAngle();
00033     void AnalyseSamples(const short* samples, size_t size);
00034   protected:
00035     void run(); // main thread loop
00036   private:
00037     void syncPosition();
00038     void togglePlayButton(bool on);
00039     bool checkEnabled(bool was, bool is);
00040     void doTrackSelection(bool valid_pos, double pitch, double position);
00041     void resetSteadyPitch(double pitch, double time);
00042     double checkSteadyPitch(double pitch, double time);
00043     void enableRecordEndMode();
00044     void disableRecordEndMode();
00045     void enableConstantMode();
00046     void enableConstantMode(double rate);
00047     bool uiUpdateTime(double time);
00048     void establishQuality(bool quality_sample);
00049 
00050     double dFileLength; // The length (in samples) of the current song.
00051     unsigned int m_uiSafeZone; // Cache the position of the end of record
00052 
00053     double dOldPos; // The position read last time it was polled.
00054     double dOldPitch;
00055 
00056     bool bQualityRing[QUALITY_RING_SIZE];
00057     int iQualPos;
00058     int iQualFilled;
00059 
00060     bool bSeeking; // Are we seeking through the record? (ie. is it moving really fast?)
00061     bool bHaveSignal; // Any signal at all?
00062     bool bAtRecordEnd;
00063     bool bForceResync;
00064     int iOldMode;
00065     double dOldFilePos;
00066     double dSteadyPitch;
00067     double dOldSteadyPitch;
00068     double dSteadyPitchTime;
00069     QTime tSinceSteadyPitch;
00070     double dUiUpdateTime;
00071 
00072     ControlObjectThread *trackSelector, *trackLoader;
00073     double dLastTrackSelectPos;
00074     double dCurTrackSelectPos;
00075     bool bTrackSelectMode;
00076 
00077     // Contains information that xwax's code needs internally about the timecode and how to process it.
00078     struct timecoder_t timecoder;
00079     static QMutex s_xwaxLUTMutex; 
00080     static bool m_bLUTInitialized;
00081 
00082     short*  m_samples;
00083     size_t  m_SamplesSize;
00084 
00085     bool bShouldClose;
00086     bool bIsRunning;
00087     bool m_bNeedleSkipPrevention;
00088     bool m_bCDControl;
00089 };
00090 
00091 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines