| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#ifndef H_FREAC_PLAYER |
| 14 |
#define H_FREAC_PLAYER |
| 15 |
|
| 16 |
#include <smooth.h> |
| 17 |
#include <boca.h> |
| 18 |
|
| 19 |
using namespace smooth; |
| 20 |
|
| 21 |
namespace freac |
| 22 |
{ |
| 23 |
class Decoder; |
| 24 |
class Processor; |
| 25 |
|
| 26 |
class Player |
| 27 |
{ |
| 28 |
private: |
| 29 |
BoCA::AS::OutputComponent *output; |
| 30 |
|
| 31 |
BoCA::Track track; |
| 32 |
|
| 33 |
Bool playing; |
| 34 |
Bool paused; |
| 35 |
|
| 36 |
Bool stop; |
| 37 |
|
| 38 |
Int newPosition; |
| 39 |
|
| 40 |
Int PlayThread(); |
| 41 |
|
| 42 |
Void Loop(Decoder *, Processor *); |
| 43 |
Void Write(Buffer<UnsignedByte> &); |
| 44 |
public: |
| 45 |
Player(); |
| 46 |
~Player(); |
| 47 |
|
| 48 |
Void Play(const BoCA::Track &); |
| 49 |
|
| 50 |
Void Pause(); |
| 51 |
Void Resume(); |
| 52 |
|
| 53 |
Void SetPosition(Int); |
| 54 |
|
| 55 |
Void Stop(); |
| 56 |
accessors: |
| 57 |
Bool IsPlaying() const { return playing; } |
| 58 |
Bool IsPaused() const { return paused; } |
| 59 |
|
| 60 |
const BoCA::Track &GetPlayingTrack() const { return track; } |
| 61 |
signals: |
| 62 |
Signal1<Void, const BoCA::Track &> onPlay; |
| 63 |
Signal1<Void, Int> onProgress; |
| 64 |
Signal1<Void, const BoCA::Track &> onFinish; |
| 65 |
}; |
| 66 |
}; |
| 67 |
|
| 68 |
#endif |