defuze.me  Client
mainplayer.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 MAINPLAYER_HPP
00012 #define MAINPLAYER_HPP
00013 
00014 #include "staticplugin.hpp"
00015 #include "audiodecoder.hpp"
00016 #include "playqueue.hpp"
00017 #include "audiotrack.hpp"
00018 #include "audioplayerwidget.hpp"
00019 #include "audioplayer.hpp"
00020 #include "audiomixer.hpp"
00021 #include "audiooutputdevice.hpp"
00022 
00023 namespace Player
00024 {
00025     class MainPlayerWidget;
00026     class MainPlayer :public QObject, public StaticPlugin
00027     {
00028         Q_OBJECT
00029     public:
00030         MainPlayer(QString playerName);
00031         ~MainPlayer();
00032         void        init();
00033         void        setPlayers(AudioPlayerWidget *A, AudioPlayerWidget *B);
00034         bool        play();
00035         bool        stop();
00036         bool        pause();
00037         bool        isPlaying() const;
00038         AudioPlayer*    firstPlayer();
00039         AudioPlayer*    secondPlayer();
00040     signals:
00041         void        played();
00042         void        paused();
00043         void        stopped();
00044     public slots:
00045         bool        crossfadeNext();
00046     private slots:
00047         void        crossfadeFinished();
00048         bool        loadTracks();
00049         bool        playA();
00050         bool        playB();
00051         void        newElem(Queue::Queueable*elem);
00052         void        removeElem(Queue::Queueable *elem);
00053         void        finished();
00054     private:
00055 
00056         AudioPlayer         *playingPlayer;
00057         AudioPlayerWidget   *playerWidgetA;
00058         AudioPlayerWidget   *playerWidgetB;
00059 
00060         AudioPlayer         *playerA;
00061         AudioPlayer         *playerB;
00062         Audio::AudioMixer   *mixerA;
00063         Audio::AudioMixer   *mixerB;
00064         Audio::AudioDecoder *decoderA;
00065         Audio::AudioDecoder *decoderB;
00066 
00067         QString             _playerName;
00068 
00069         Queue::PlayQueue    *playQueue;
00070         MainPlayerWidget    *widget;
00071 
00072         Gui::Module         *uiModule;
00073 
00074         Audio::AudioOutputDevice* outputDeviceA;
00075         Audio::AudioOutputDevice* outputDeviceB;
00076 
00077         bool                isCrossfading;
00078     };
00079 }
00080 #endif // MAINPLAYER_HPP