Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/engine/enginesidechain.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           enginesidechain.h
00003                              -------------------
00004     copyright            : (C) 2008 Albert Santoni
00005     email                : gamegod \a\t users.sf.net
00006 ***************************************************************************/
00007 
00008 /***************************************************************************
00009 *                                                                         *
00010 *   This program is free software; you can redistribute it and/or modify  *
00011 *   it under the terms of the GNU General Public License as published by  *
00012 *   the Free Software Foundation; either version 2 of the License, or     *
00013 *   (at your option) any later version.                                   *
00014 *                                                                         *
00015 ***************************************************************************/
00016 
00017 #ifndef ENGINESIDECHAIN_H
00018 #define ENGINESIDECHAIN_H
00019 
00020 #include <QtCore>
00021 #include "defs.h"
00022 #include "configobject.h"
00023 #include "controlobject.h"
00024 #include "controlobjectthreadmain.h"
00025 #include "../recording/defs_recording.h"
00026 #include "errordialoghandler.h"
00027 #include "recording/recordingmanager.h"
00028 
00029 #ifdef __SHOUTCAST__
00030 class EngineShoutcast;
00031 #endif
00032 
00033 class EngineRecord;
00034 
00035 #define SIDECHAIN_BUFFER_SIZE 65536
00036 
00037 class EngineSideChain : public QThread {
00038 Q_OBJECT
00039 
00040 public:
00041     EngineSideChain(ConfigObject<ConfigValue> * pConfig);
00042     virtual ~EngineSideChain();
00043     void submitSamples(CSAMPLE* buffer, int buffer_size);
00044 
00045   signals:
00046     void bytesRecorded(int);
00047     void isRecording(bool);
00048 
00049   private:
00050     void swapBuffers();
00051     void run();
00052 
00053     ConfigObject<ConfigValue> * m_pConfig;
00054     const char* m_group;
00055     volatile bool m_bStopThread;                     //Indicates that the thread should exit.
00056     unsigned long m_iBufferEnd;             //Index of the last valid sample in the buffer.
00057     CSAMPLE* m_buffer;                      //Pointer to the fillable giant buffer (for double-buffering)
00058     CSAMPLE* m_filledBuffer;                //Pointer to the filled giant buffer (after swapping).
00059     CSAMPLE* m_bufferFront;                 //Giant buffer to store audio.
00060     CSAMPLE* m_bufferBack;                  //Another giant buffer to store audio.
00061     QMutex m_backBufferLock;                //Provides thread safety for the back buffer.
00062     QMutex m_waitLock;                      //Provides thread safety around the wait condition below.
00063     QWaitCondition m_waitForFullBuffer;     //Allows sleeping until we have a full buffer.
00064 
00065 #ifdef __SHOUTCAST__
00066     EngineShoutcast *m_shoutcast;
00067 #endif
00068     EngineRecord* m_rec;
00069 };
00070 
00071 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines