player.h 1.92 KB
Newer Older
1 2 3 4 5
/***************************************************************************
                          player.h  -  description
                             -------------------
    begin                : Sun Feb 17 2002
    copyright            : (C) 2002 by Scott Wheeler
6
    email                : wheeler@kde.org
7
***************************************************************************/
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef PLAYER_H
#define PLAYER_H

#include <qstring.h>
#include <soundserver.h>
#include <arts/artsflow.h>

using namespace Arts;

27
class Player
28 29
{
public:
30
    Player();
31 32
    Player(const QString &fileName);
    virtual ~Player();
33

34
    void play(const QString &fileName, float volume = 1.0);
35 36 37 38 39
    void play(float volume = 1.0);
    void pause();
    void stop();

    void setVolume(float volume = 1.0);
40
    float getVolume() const;
41

42 43 44 45 46 47
    bool playing() const;
    bool paused() const;

    long totalTime() const;
    long currentTime() const;
    int position() const; // in this case not really the percent
48 49 50

    void seek(long seekTime);
    void seekPosition(int position);
51 52

private:
53 54
    void setupPlayer();
    void setupVolumeControl();
55
    bool serverRunning() const;
56 57 58 59 60

    Dispatcher *dispatcher;
    SimpleSoundServer *server;
    PlayObject *media;
    StereoVolumeControl *volumeControl;
61

62 63
    QString currentFile;
    float currentVolume;
64 65 66
};

#endif