~ubuntu-branches/ubuntu/precise/stellarium/precise

« back to all changes in this revision

Viewing changes to src/core/Audio.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Cédric Delfosse
  • Date: 2009-03-13 20:07:22 UTC
  • mfrom: (1.1.8 upstream) (4.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090313200722-l66s4zy2s3e8up0s
Tags: 0.10.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Stellarium
3
 
 * This file Copyright (C) 2005 Robert Spearman
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU General Public License
7
 
 * as published by the Free Software Foundation; either version 2
8
 
 * of the License, or (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
 */
19
 
 
20
 
// manage an audio track
21
 
 
22
 
#ifndef _AUDIO_HPP_
23
 
#define _AUDIO_HPP_
24
 
 
25
 
#include <config.h>
26
 
#include <QString>
27
 
 
28
 
#ifdef HAVE_SDL_SDL_MIXER_H
29
 
#include <SDL/SDL_mixer.h>
30
 
 
31
 
class Audio
32
 
{
33
 
public:
34
 
        Audio(const QString& filename, const QString& name, long int outputRate);
35
 
        virtual ~Audio();
36
 
        void play(bool loop);
37
 
        void sync();  // reset audio track time offset to elapsed time
38
 
        void pause();
39
 
        void resume();
40
 
        void stop();
41
 
        void setVolume(float _volume);
42
 
        void incrementVolume();
43
 
        void decrementVolume();
44
 
        QString getName() { return trackName; }
45
 
        void update(double deltaTime);
46
 
 
47
 
private:
48
 
        Mix_Music *track;
49
 
        QString trackName;
50
 
        bool isPlaying;
51
 
        static float masterVolume;  // audio level
52
 
        double elapsedSeconds;      // current offset into the track
53
 
};
54
 
#else
55
 
// SDL_mixer is not available - no audio
56
 
class Audio
57
 
{
58
 
public:
59
 
        Audio(const QString& filename, const QString& name) {}
60
 
        virtual ~Audio() {}
61
 
        void play(bool loop) {}
62
 
        void pause() {}
63
 
        void sync() {}
64
 
        void resume() {}
65
 
        void stop() {}
66
 
        void setVolume(float _volume) {}
67
 
        void incrementVolume() {}
68
 
        void decrementVolume() {}
69
 
        QString getName() { return "Compiled with no Audio!"; }
70
 
        void update(double deltaTime) {}
71
 
 
72
 
private:
73
 
};
74
 
#endif
75
 
 
76
 
#endif // _AUDIO_HPP_