Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QSOUNDQSS_QWS_H
00043 #define QSOUNDQSS_QWS_H
00044
00045 #include <QtCore/qglobal.h>
00046
00047 #ifndef QT_NO_SOUND
00048
00049 #include <QtNetwork/qtcpserver.h>
00050 #include <QtNetwork/qtcpsocket.h>
00051 #include <QtGui/qwssocket_qws.h>
00052
00053 QT_BEGIN_HEADER
00054
00055 QT_BEGIN_NAMESPACE
00056
00057 QT_MODULE(Gui)
00058
00059 #if defined(QT_NO_NETWORK) || defined(QT_NO_DNS)
00060 #define QT_NO_QWS_SOUNDSERVER
00061 #endif
00062
00063 #ifndef Q_OS_MAC
00064
00065 class QWSSoundServerPrivate;
00066
00067 class Q_GUI_EXPORT QWSSoundServer : public QObject {
00068 Q_OBJECT
00069 public:
00070 explicit QWSSoundServer(QObject *parent=0);
00071 ~QWSSoundServer();
00072 void playFile( int id, const QString& filename );
00073 void stopFile( int id );
00074 void pauseFile( int id );
00075 void resumeFile( int id );
00076
00077 Q_SIGNALS:
00078 void soundCompleted( int );
00079
00080 private Q_SLOTS:
00081 void translateSoundCompleted( int, int );
00082
00083 private:
00084 QWSSoundServerPrivate* d;
00085 };
00086
00087 #ifndef QT_NO_QWS_SOUNDSERVER
00088 class Q_GUI_EXPORT QWSSoundClient : public QWSSocket {
00089 Q_OBJECT
00090 public:
00091
00092 enum SoundFlags {
00093 Priority = 0x01,
00094 Streaming = 0x02
00095 };
00096 enum DeviceErrors {
00097 ErrOpeningAudioDevice = 0x01,
00098 ErrOpeningFile = 0x02,
00099 ErrReadingFile = 0x04
00100 };
00101 explicit QWSSoundClient(QObject* parent=0);
00102 ~QWSSoundClient( );
00103 void reconnect();
00104 void play( int id, const QString& filename );
00105 void play( int id, const QString& filename, int volume, int flags = 0 );
00106 void playRaw( int id, const QString&, int, int, int, int flags = 0 );
00107
00108 void pause( int id );
00109 void stop( int id );
00110 void resume( int id );
00111 void setVolume( int id, int left, int right );
00112 void setMute( int id, bool m );
00113
00114
00115 void playPriorityOnly(bool);
00116
00117
00118
00119 void setSilent(bool);
00120
00121 Q_SIGNALS:
00122 void soundCompleted(int);
00123 void deviceReady(int id);
00124 void deviceError(int id, QWSSoundClient::DeviceErrors);
00125
00126 private Q_SLOTS:
00127 void tryReadCommand();
00128 void emitConnectionRefused();
00129
00130 private:
00131 void sendServerMessage(QString msg);
00132 };
00133
00134 class QWSSoundServerSocket : public QWSServerSocket {
00135 Q_OBJECT
00136
00137 public:
00138 explicit QWSSoundServerSocket(QObject *parent=0);
00139 public Q_SLOTS:
00140 void newConnection();
00141
00142 #ifdef QT3_SUPPORT
00143 public:
00144 QT3_SUPPORT_CONSTRUCTOR QWSSoundServerSocket(QObject *parent, const char *name);
00145 #endif
00146
00147 Q_SIGNALS:
00148 void playFile(int, int, const QString&);
00149 void playFile(int, int, const QString&, int, int);
00150 void playRawFile(int, int, const QString&, int, int, int, int);
00151 void pauseFile(int, int);
00152 void stopFile(int, int);
00153 void resumeFile(int, int);
00154 void setVolume(int, int, int, int);
00155 void setMute(int, int, bool);
00156
00157 void stopAll(int);
00158
00159 void playPriorityOnly(bool);
00160
00161 void setSilent(bool);
00162
00163 void soundFileCompleted(int, int);
00164 void deviceReady(int, int);
00165 void deviceError(int, int, int);
00166 };
00167 #endif
00168
00169 #endif // Q_OS_MAC
00170
00171 QT_END_NAMESPACE
00172
00173 QT_END_HEADER
00174
00175 #endif // QT_NO_SOUND
00176
00177 #endif // QSOUNDQSS_QWS_H