56 #include <audio/audiolib.h> 57 #include <audio/soundlib.h> 60 static AuServer *
nas=0;
62 static AuBool
eventPred(AuServer *, AuEvent *e, AuPointer p)
64 if (e && (e->type == AuEventTypeElementNotify)) {
65 if (e->auelementnotify.flow == *((AuFlowID *)p))
78 AuDestroyBucket(
nas,
id, NULL);
81 while (AuScanEvents(
nas, AuEventsQueuedAfterFlush,
true,
eventPred, &
flow, &ev))
102 void play(
const QString& filename);
110 void soundDestroyed(
QObject *o);
123 nas = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL);
125 AuSetCloseDownMode(
nas, AuCloseDownDestroy, NULL);
151 while (inprogress->
remove(so))
160 AuFixedPoint volume=AuFixedPointFromFraction(iv,100);
162 NULL, NULL, NULL, NULL, NULL, NULL);
170 static void callback(AuServer*, AuEventHandlerRec*, AuEvent* e, AuPointer p)
173 if (e->type==AuEventTypeElementNotify &&
174 e->auelementnotify.kind==AuElementNotifyKindState) {
175 if (e->auelementnotify.cur_state == AuStateStop) {
177 if (it != inprogress->
end())
178 (*it)->setDone((
QSound*)p);
192 if (--(
bucket(s)->numplaying) == 0)
210 inprogress->
insert(s,
this);
212 AuFixedPoint volume=AuFixedPointFromFraction(iv,100);
214 AuSoundPlayFromBucket(
nas, b->
id, AuNone, volume,
259 #include "qsound_x11.moc" 296 #endif // QT_NO_SOUND
static void callback(AuServer *, AuEventHandlerRec *, AuEvent *e, AuPointer p)
static AuBool eventPred(AuServer *, AuEvent *e, AuPointer p)
QAuServer * qt_new_audio_server()
void init(QSound *)
Initializes the sound.
QAuBucket * bucket(QSound *)
Returns the internal bucket record of sound s.
#define QT_END_NAMESPACE
This macro expands to.
int remove(const Key &key)
Removes all the items that have the key from the hash.
#define it(className, varName)
void play(const QString &filename)
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
The QHash class is a template class that provides a hash-table-based dictionary.
int decLoop(QSound *)
Decrements the QSound::loopRemaining() value for sound s, returning the result.
The QObject class is the base class of all Qt objects.
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
int loopsRemaining() const
Returns the remaining number of times the sound will loop (this value decreases each time the sound i...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
void setObjectName(const QString &name)
QAuBucketNAS * bucket(QSound *s)
#define QT_BEGIN_NAMESPACE
This macro expands to.
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void setBucket(QSound *, QAuBucket *)
Sets the internal bucket record of sound s to b, deleting any previous setting.
QAuBucketNAS(AuBucketID b, AuFlowID f=0)
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
QAuServerNAS(QObject *parent)
static AuServerHash * inprogress
const char * constData() const
Returns a pointer to the data stored in the byte array.
QAuServerNull(QObject *parent)
QHash< void *, QAuServerNAS * > AuServerHash
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
QObject * parent() const
Returns a pointer to the parent object.
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
void soundDestroyed(QObject *o)
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
QString fileName() const
Returns the filename associated with this QSound object.
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
void play(const QString &)
The QSound class provides access to the platform audio facilities.