[31] | 1 | /****************************************************************************
|
---|
| 2 | ** $Id: qsound.h 35 2005-12-11 15:03:18Z dmik $
|
---|
| 3 | **
|
---|
| 4 | ** Definition of QSound class and QAuServer internal class
|
---|
| 5 | **
|
---|
| 6 | ** Created : 000117
|
---|
| 7 | **
|
---|
| 8 | ** Copyright (C) 1999-2000 Trolltech AS. All rights reserved.
|
---|
| 9 | **
|
---|
| 10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
| 11 | **
|
---|
| 12 | ** This file may be distributed under the terms of the Q Public License
|
---|
| 13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
| 14 | ** LICENSE.QPL included in the packaging of this file.
|
---|
| 15 | **
|
---|
| 16 | ** This file may be distributed and/or modified under the terms of the
|
---|
| 17 | ** GNU General Public License version 2 as published by the Free Software
|
---|
| 18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 19 | ** packaging of this file.
|
---|
| 20 | **
|
---|
| 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
| 22 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
| 23 | ** Agreement provided with the Software.
|
---|
| 24 | **
|
---|
| 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 27 | **
|
---|
| 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 29 | ** information about Qt Commercial License Agreements.
|
---|
| 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
| 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
| 32 | **
|
---|
| 33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 34 | ** not clear to you.
|
---|
| 35 | **
|
---|
| 36 | **********************************************************************/
|
---|
| 37 | #ifndef QSOUND_H
|
---|
| 38 | #define QSOUND_H
|
---|
| 39 |
|
---|
| 40 | #ifndef QT_H
|
---|
| 41 | #include "qobject.h"
|
---|
| 42 | #endif // QT_H
|
---|
| 43 |
|
---|
| 44 | #ifndef QT_NO_SOUND
|
---|
| 45 |
|
---|
| 46 | class QSoundData;
|
---|
| 47 |
|
---|
| 48 | class Q_EXPORT QSound : public QObject {
|
---|
| 49 | Q_OBJECT
|
---|
| 50 | public:
|
---|
| 51 | static bool isAvailable();
|
---|
| 52 | static void play(const QString& filename);
|
---|
| 53 |
|
---|
| 54 | QSound(const QString& filename, QObject* parent=0, const char* name=0);
|
---|
| 55 | ~QSound();
|
---|
| 56 |
|
---|
| 57 | /* Coming soon...
|
---|
| 58 | ?
|
---|
| 59 | QSound(int hertz, Type type=Mono);
|
---|
| 60 | int play(const ushort* data, int samples);
|
---|
| 61 | bool full();
|
---|
| 62 | signal void notFull();
|
---|
| 63 | ?
|
---|
| 64 | */
|
---|
| 65 |
|
---|
| 66 | #ifndef QT_NO_COMPAT
|
---|
| 67 | static bool available() { return isAvailable(); }
|
---|
| 68 | #endif
|
---|
| 69 |
|
---|
| 70 | int loops() const;
|
---|
| 71 | int loopsRemaining() const;
|
---|
| 72 | void setLoops(int);
|
---|
| 73 | QString fileName() const;
|
---|
| 74 |
|
---|
| 75 | bool isFinished() const;
|
---|
| 76 |
|
---|
| 77 | public slots:
|
---|
| 78 | void play();
|
---|
| 79 | void stop();
|
---|
| 80 |
|
---|
| 81 | private:
|
---|
| 82 | QSoundData* d;
|
---|
| 83 | friend class QAuServer;
|
---|
| 84 | };
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | /*
|
---|
| 88 | QAuServer is an INTERNAL class. If you wish to provide support for
|
---|
| 89 | additional audio servers, you can make a subclass of QAuServer to do
|
---|
| 90 | so, HOWEVER, your class may need to be re-engineered to some degree
|
---|
| 91 | with each new Qt release, including minor releases.
|
---|
| 92 |
|
---|
| 93 | QAuBucket is whatever you want.
|
---|
| 94 | */
|
---|
| 95 |
|
---|
| 96 | class QAuBucket {
|
---|
| 97 | public:
|
---|
| 98 | virtual ~QAuBucket();
|
---|
| 99 | };
|
---|
| 100 |
|
---|
| 101 | class QAuServer : public QObject {
|
---|
| 102 | Q_OBJECT
|
---|
| 103 |
|
---|
| 104 | public:
|
---|
| 105 | QAuServer(QObject* parent, const char* name);
|
---|
| 106 | ~QAuServer();
|
---|
| 107 |
|
---|
| 108 | virtual void init(QSound*);
|
---|
| 109 | virtual void play(const QString& filename);
|
---|
| 110 | virtual void play(QSound*)=0;
|
---|
| 111 | virtual void stop(QSound*)=0;
|
---|
| 112 | virtual bool okay()=0;
|
---|
| 113 |
|
---|
| 114 | protected:
|
---|
| 115 | void setBucket(QSound*, QAuBucket*);
|
---|
| 116 | QAuBucket* bucket(QSound*);
|
---|
| 117 | int decLoop(QSound*);
|
---|
| 118 | };
|
---|
| 119 |
|
---|
| 120 | #endif // QT_NO_SOUND
|
---|
| 121 |
|
---|
| 122 | #endif
|
---|