~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to noatun/noatun/library/engine.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _ENGINE_H
 
2
#define _ENGINE_H
 
3
 
 
4
#include <qobject.h>
 
5
#include <kurl.h>
 
6
#include <arts/kmedia2.h>
 
7
 
 
8
class Visualization;
 
9
class PlaylistItem;
 
10
 
 
11
namespace Arts
 
12
{
 
13
        class SoundServerV2;
 
14
 
 
15
        class Synth_AMAN_PLAY;
 
16
}
 
17
 
 
18
namespace Noatun
 
19
{
 
20
        class StereoEffectStack;
 
21
        class StereoVolumeControl;
 
22
        class Equalizer;
 
23
        class Session;
 
24
}
 
25
 
 
26
class NoatunApp;
 
27
 
 
28
/**
 
29
 * Handles all playing, connecting to aRts.
 
30
 * Does almost everything related to multimedia.
 
31
 * Most interfacing should be done with Player
 
32
 **/
 
33
class Engine : public QObject
 
34
{
 
35
Q_OBJECT
 
36
friend class NoatunApp;
 
37
public:
 
38
        Engine(QObject *parent=0);
 
39
        ~Engine();
 
40
        void setInitialized();
 
41
        bool initialized() const;
 
42
        
 
43
public slots:
 
44
        /**
 
45
         * opens the file, use play() to start playing
 
46
         **/
 
47
        bool open(const PlaylistItem *file);
 
48
        /**
 
49
         * Continues playing
 
50
         **/
 
51
        bool play();
 
52
        /**
 
53
         * Terminates playing, does not close the file
 
54
         **/
 
55
        void pause();
 
56
        /**
 
57
         * resets the engine
 
58
         **/
 
59
        void stop();
 
60
        /**
 
61
         * skips to a timecode
 
62
         * unit is milliseconds
 
63
         **/
 
64
        void seek(int msec);
 
65
 
 
66
        void setVolume(int percent);
 
67
 
 
68
signals:
 
69
        void done();
 
70
        /**
 
71
         * emitted when arts dies and noatun has to start 
 
72
         * it again. This is called when the new arts
 
73
         * is already initialized
 
74
         **/
 
75
        void artsError();
 
76
        
 
77
public:
 
78
        int state();
 
79
        int position(); // return position in milliseconds
 
80
        int length(); // return track-length in milliseconds
 
81
        int volume() const;
 
82
 
 
83
private:
 
84
        int openMixerFD();
 
85
        void closeMixerFD(int);
 
86
        void useHardwareMixer(bool);
 
87
        bool initArts();
 
88
 
 
89
public:
 
90
        Arts::SoundServerV2 *server() const;
 
91
        Arts::PlayObject playObject() const;
 
92
        Arts::SoundServerV2 *simpleSoundServer() const;
 
93
        Noatun::StereoEffectStack *effectStack() const;
 
94
        Noatun::Equalizer *equalizer() const;
 
95
        Noatun::StereoEffectStack *visualizationStack() const;
 
96
        Noatun::StereoEffectStack *globalEffectStack() const;
 
97
        Noatun::Session *session() const;
 
98
 
 
99
private:
 
100
        class EnginePrivate;
 
101
        EnginePrivate *d;
 
102
        bool mPlay;
 
103
};
 
104
 
 
105
#endif