KDEGames

audio/kgsound.h
1 /***************************************************************************
2  * Copyright 2010 Stefan Majewsky <[email protected]> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU Library General Public License *
6  * version 2 as published by the Free Software Foundation *
7  * *
8  * This program is distributed in the hope that it will be useful, *
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11  * GNU Library General Public License for more details. *
12  * *
13  * You should have received a copy of the GNU Library General Public *
14  * License along with this program; if not, write to the *
15  * Free Software Foundation, Inc., *
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
17  ***************************************************************************/
18 
19 #ifndef KGSOUND_H
20 #define KGSOUND_H
21 
22 #include <QObject>
23 #include <QPointF>
24 
25 #include <libkdegames_export.h>
26 
27 class PlaybackEvent;
28 
46 class KDEGAMES_EXPORT KgSound : public QObject
47 {
48  Q_OBJECT
50  Q_PROPERTY(KgSound::PlaybackType playbackType READ playbackType WRITE setPlaybackType NOTIFY playbackTypeChanged)
51  Q_PROPERTY(QPointF pos READ pos WRITE setPos NOTIFY posChanged)
52  Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged)
53  public:
56  {
60  AmbientPlayback = 1,
71  RelativePlayback
72  };
73 
83  explicit KgSound(const QString& file, QObject* parent = nullptr);
85  virtual ~KgSound();
86 
88  bool isValid() const;
90  KgSound::PlaybackType playbackType() const;
97  void setPlaybackType(KgSound::PlaybackType type);
99  QPointF pos() const;
107  void setPos(const QPointF& pos);
109  qreal volume() const;
123  void setVolume(qreal volume);
124 
129  bool hasError() const;
130  public Q_SLOTS:
133  void start();
138  void start(const QPointF& pos);
140  void stop();
141  Q_SIGNALS:
142  void playbackTypeChanged(KgSound::PlaybackType type);
143  void posChanged(const QPointF& pos);
144  void volumeChanged(qreal volume);
145  private:
146  friend class KgPlaybackEvent;
147  class Private;
148  Private* const d;
149 };
150 
151 #endif // KGSOUND_H
PlaybackType
This enumeration describes how a sound can be played back.
Definition: audio/kgsound.h:55
Positional playback enabled.
Definition: audio/kgsound.h:65
This class models a sound file.
Definition: audio/kgsound.h:46
Q_PROPERTY(...)
Q_DISABLE_COPY(Class)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Nov 26 2020 22:36:18 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.