author | William Roberts <williamr@symbian.org> |
Mon, 18 Oct 2010 17:18:49 +0100 | |
changeset 136 | 4c8d6b2fb1da |
permissions | -rw-r--r-- |
136
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
1 |
/**************************************************************************** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
2 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
4 |
** All rights reserved. |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
6 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
8 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
10 |
** No Commercial Usage |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
11 |
** This file contains pre-release code and may not be distributed. |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
12 |
** You may use this file in accordance with the terms and conditions |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
13 |
** contained in the Technology Preview License Agreement accompanying |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
14 |
** this package. |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
15 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
16 |
** GNU Lesser General Public License Usage |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
18 |
** General Public License version 2.1 as published by the Free Software |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
20 |
** packaging of this file. Please review the following information to |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
23 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
27 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
28 |
** If you have questions regarding the use of this file, please contact |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
29 |
** Nokia at qt-info@nokia.com. |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
30 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
31 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
32 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
33 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
34 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
35 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
36 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
37 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
38 |
** $QT_END_LICENSE$ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
39 |
** |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
40 |
****************************************************************************/ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
41 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
42 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
43 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
44 |
#ifndef QT_NO_SOUND |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
45 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
46 |
#include "qdir.h" |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
47 |
#include "qapplication.h" |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
48 |
#include "qsound.h" |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
49 |
#include "qsound_p.h" |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
50 |
#include "qfileinfo.h" |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
51 |
#include <private/qcore_symbian_p.h> |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
52 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
53 |
#include <e32std.h> |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
54 |
#include <mdaaudiosampleplayer.h> |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
55 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
56 |
QT_BEGIN_NAMESPACE |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
57 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
58 |
class QAuServerS60; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
59 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
60 |
class QAuBucketS60 : public QAuBucket, public MMdaAudioPlayerCallback |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
61 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
62 |
public: |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
63 |
QAuBucketS60(QAuServerS60 *server, QSound *sound); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
64 |
~QAuBucketS60(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
65 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
66 |
void play(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
67 |
void stop(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
68 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
69 |
inline QSound *sound() const { return m_sound; } |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
70 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
71 |
public: // from MMdaAudioPlayerCallback |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
72 |
void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
73 |
void MapcPlayComplete(TInt aError); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
74 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
75 |
private: |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
76 |
QSound *m_sound; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
77 |
QAuServerS60 *m_server; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
78 |
bool m_prepared; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
79 |
bool m_playCalled; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
80 |
CMdaAudioPlayerUtility *m_playUtility; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
81 |
}; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
82 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
83 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
84 |
class QAuServerS60 : public QAuServer |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
85 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
86 |
public: |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
87 |
QAuServerS60(QObject *parent); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
88 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
89 |
void init(QSound *s) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
90 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
91 |
QAuBucketS60 *bucket = new QAuBucketS60(this, s); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
92 |
setBucket(s, bucket); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
93 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
94 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
95 |
void play(QSound *s) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
96 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
97 |
bucket(s)->play(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
98 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
99 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
100 |
void stop(QSound *s) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
101 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
102 |
bucket(s)->stop(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
103 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
104 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
105 |
bool okay() { return true; } |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
106 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
107 |
void play(const QString& filename); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
108 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
109 |
protected: |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
110 |
void playCompleted(QAuBucketS60 *bucket, int error); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
111 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
112 |
protected: |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
113 |
QAuBucketS60 *bucket(QSound *s) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
114 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
115 |
return (QAuBucketS60 *)QAuServer::bucket( s ); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
116 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
117 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
118 |
friend class QAuBucketS60; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
119 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
120 |
// static QSound::play(filename) cannot be stopped, meaning that playCompleted |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
121 |
// will get always called and QSound gets removed form this list. |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
122 |
QList<QSound *> staticPlayingSounds; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
123 |
}; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
124 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
125 |
QAuServerS60::QAuServerS60(QObject *parent) : |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
126 |
QAuServer(parent) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
127 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
128 |
setObjectName(QLatin1String("QAuServerS60")); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
129 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
130 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
131 |
void QAuServerS60::play(const QString& filename) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
132 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
133 |
QSound *s = new QSound(filename); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
134 |
staticPlayingSounds.append(s); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
135 |
play(s); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
136 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
137 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
138 |
void QAuServerS60::playCompleted(QAuBucketS60 *bucket, int error) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
139 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
140 |
QSound *sound = bucket->sound(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
141 |
if (!error) { |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
142 |
// We need to handle repeats by ourselves, since with Symbian API we don't |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
143 |
// know how many loops have been played when user asks it |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
144 |
if (decLoop(sound)) { |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
145 |
play(sound); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
146 |
} else { |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
147 |
if (staticPlayingSounds.removeAll(sound)) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
148 |
delete sound; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
149 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
150 |
} else { |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
151 |
// We don't have a way to inform about errors -> just decrement loops |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
152 |
// in order that QSound::isFinished will return true; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
153 |
while (decLoop(sound)) {} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
154 |
if (staticPlayingSounds.removeAll(sound)) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
155 |
delete sound; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
156 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
157 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
158 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
159 |
QAuServer *qt_new_audio_server() |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
160 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
161 |
return new QAuServerS60(qApp); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
162 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
163 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
164 |
QAuBucketS60::QAuBucketS60(QAuServerS60 *server, QSound *sound) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
165 |
: m_sound(sound), m_server(server), m_prepared(false), m_playCalled(false) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
166 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
167 |
QString filepath = QFileInfo(m_sound->fileName()).absoluteFilePath(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
168 |
filepath = QDir::toNativeSeparators(filepath); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
169 |
TPtrC filepathPtr(qt_QString2TPtrC(filepath)); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
170 |
TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
171 |
m_playUtility->OpenFileL(filepathPtr)); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
172 |
if (err) { |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
173 |
m_server->playCompleted(this, err); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
174 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
175 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
176 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
177 |
void QAuBucketS60::play() |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
178 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
179 |
if (m_prepared) { |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
180 |
// OpenFileL call is completed we can start playing immediately |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
181 |
m_playUtility->Play(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
182 |
} else { |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
183 |
m_playCalled = true; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
184 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
185 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
186 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
187 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
188 |
void QAuBucketS60::stop() |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
189 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
190 |
m_playCalled = false; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
191 |
m_playUtility->Stop(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
192 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
193 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
194 |
void QAuBucketS60::MapcPlayComplete(TInt aError) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
195 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
196 |
m_server->playCompleted(this, aError); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
197 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
198 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
199 |
void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
200 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
201 |
if (aError) { |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
202 |
m_server->playCompleted(this, aError); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
203 |
} else { |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
204 |
m_prepared = true; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
205 |
if (m_playCalled){ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
206 |
play(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
207 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
208 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
209 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
210 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
211 |
QAuBucketS60::~QAuBucketS60() |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
212 |
{ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
213 |
if (m_playUtility){ |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
214 |
m_playUtility->Stop(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
215 |
m_playUtility->Close(); |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
216 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
217 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
218 |
delete m_playUtility; |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
219 |
} |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
220 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
221 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
222 |
#endif // QT_NO_SOUND |
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
223 |
|
4c8d6b2fb1da
First stab at stem_QtGui.dll - nasty, nasty, nasty
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
224 |
QT_END_NAMESPACE |