defuze.me  Client
audiooutputdevicethread.hpp
00001 /**************************************************************************
00002 ** defuze.me Epitech Innovative Project
00003 **
00004 ** Copyright 2010-2011
00005 **   Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard
00006 **   Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier
00007 **
00008 ** All rights reserved.
00009 **************************************************************************/
00010 
00011 #ifndef AUDIO_OUTPUT_DEVICE_THREAD_HPP
00012 #define AUDIO_OUTPUT_DEVICE_THREAD_HPP
00013 
00014 #include <QAudioOutput>
00015 #include <QAudioDeviceInfo>
00016 #include <QThread>
00017 #include "audioio.hpp"
00018 #include "thread.hpp"
00019 
00020 namespace Audio
00021 {
00022     class AudioOutputDevice;
00023 
00030     class AudioOutputDeviceThread : public Thread
00031     {
00032         Q_OBJECT
00033         friend class AudioOutputDevice;
00034     private slots:
00035         void                startAudio();
00036         void                stopAudio();
00037         void                pauseAudio();
00038         QAudio::State       state();
00039         void                stateChanged(QAudio::State);
00040         void                setInput(AudioIO *input);
00041         void                changeFormat(QAudioFormat);
00042 
00043     private:
00044         AudioOutputDeviceThread(QAudioDeviceInfo device = QAudioDeviceInfo::defaultOutputDevice());
00045         ~AudioOutputDeviceThread();
00046 
00047         void                startThread();
00048         bool                isStarted();
00049 
00050         void                run();
00051 
00052         QAudioFormat        _format;
00053         QAudioOutput*       audioOutput;
00054         bool                _isStarted;
00055         QAudioDeviceInfo    _audioDevice;
00056         AudioIO             *input;
00057     };
00058 }
00059 
00060 #endif // AUDIO_OUTPUT_DEVICE_THREAD_HPP