Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qsound.h 3.3.8 edited Jan 11 14:46 $ 00003 ** 00004 ** Definition of QSound class and QAuServer internal class 00005 ** 00006 ** Created : 000117 00007 ** 00008 ** Copyright (C) 1999-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the kernel module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 #ifndef QSOUND_H 00038 #define QSOUND_H 00039 00040 #ifndef QT_H 00041 #include "qobject.h" 00042 #endif // QT_H 00043 00044 #ifndef QT_NO_SOUND 00045 00046 class QSoundData; 00047 00048 class Q_EXPORT QSound : public QObject { 00049 Q_OBJECT 00050 public: 00051 static bool isAvailable(); 00052 static void play(const QString& filename); 00053 00054 QSound(const QString& filename, QObject* parent=0, const char* name=0); 00055 ~QSound(); 00056 00057 /* Coming soon... 00058 ? 00059 QSound(int hertz, Type type=Mono); 00060 int play(const ushort* data, int samples); 00061 bool full(); 00062 signal void notFull(); 00063 ? 00064 */ 00065 00066 #ifndef QT_NO_COMPAT 00067 static bool available() { return isAvailable(); } 00068 #endif 00069 00070 int loops() const; 00071 int loopsRemaining() const; 00072 void setLoops(int); 00073 QString fileName() const; 00074 00075 bool isFinished() const; 00076 00077 public slots: 00078 void play(); 00079 void stop(); 00080 00081 private: 00082 QSoundData* d; 00083 friend class QAuServer; 00084 }; 00085 00086 00087 /* 00088 QAuServer is an INTERNAL class. If you wish to provide support for 00089 additional audio servers, you can make a subclass of QAuServer to do 00090 so, HOWEVER, your class may need to be re-engineered to some degree 00091 with each new Qt release, including minor releases. 00092 00093 QAuBucket is whatever you want. 00094 */ 00095 00096 class QAuBucket { 00097 public: 00098 virtual ~QAuBucket(); 00099 }; 00100 00101 class QAuServer : public QObject { 00102 Q_OBJECT 00103 00104 public: 00105 QAuServer(QObject* parent, const char* name); 00106 ~QAuServer(); 00107 00108 virtual void init(QSound*); 00109 virtual void play(const QString& filename); 00110 virtual void play(QSound*)=0; 00111 virtual void stop(QSound*)=0; 00112 virtual bool okay()=0; 00113 00114 protected: 00115 void setBucket(QSound*, QAuBucket*); 00116 QAuBucket* bucket(QSound*); 00117 int decLoop(QSound*); 00118 }; 00119 00120 #endif // QT_NO_SOUND 00121 00122 #endif