Qt 4.8
qaudioformat.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtMultimedia module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #include <QDebug>
42 #include <QtMultimedia/qaudioformat.h>
43 
44 
46 
47 
49 {
50 public:
52  {
53  frequency = -1;
54  channels = -1;
55  sampleSize = -1;
56  byteOrder = QAudioFormat::Endian(QSysInfo::ByteOrder);
58  }
59 
61  QSharedData(other),
62  codec(other.codec),
63  byteOrder(other.byteOrder),
64  sampleType(other.sampleType),
65  frequency(other.frequency),
66  channels(other.channels),
67  sampleSize(other.sampleSize)
68  {
69  }
70 
72  {
73  codec = other.codec;
74  byteOrder = other.byteOrder;
75  sampleType = other.sampleType;
76  frequency = other.frequency;
77  channels = other.channels;
78  sampleSize = other.sampleSize;
79 
80  return *this;
81  }
82 
86  int frequency;
87  int channels;
89 };
90 
160 {
161 }
162 
168  d(other.d)
169 {
170 }
171 
177 {
178 }
179 
185 {
186  d = other.d;
187  return *this;
188 }
189 
197 bool QAudioFormat::operator==(const QAudioFormat &other) const
198 {
199  return d->frequency == other.d->frequency &&
200  d->channels == other.d->channels &&
201  d->sampleSize == other.d->sampleSize &&
202  d->byteOrder == other.d->byteOrder &&
203  d->codec == other.d->codec &&
204  d->sampleType == other.d->sampleType;
205 }
206 
214 bool QAudioFormat::operator!=(const QAudioFormat& other) const
215 {
216  return !(*this == other);
217 }
218 
224 {
225  return d->frequency != -1 && d->channels != -1 && d->sampleSize != -1 &&
227 }
228 
235 void QAudioFormat::setSampleRate(int samplerate)
236 {
237  d->frequency = samplerate;
238 }
239 
250 {
251  d->frequency = frequency;
252 }
253 
261 {
262  return d->frequency;
263 }
264 
275 {
276  return d->frequency;
277 }
278 
286 {
287  d->channels = channels;
288 }
289 
300 {
301  d->channels = channels;
302 }
303 
311 {
312  return d->channels;
313 }
314 
325 {
326  return d->channels;
327 }
328 
334 {
336 }
337 
343 {
344  return d->sampleSize;
345 }
346 
354 {
355  d->codec = codec;
356 }
357 
365 {
366  return d->codec;
367 }
368 
374 {
375  d->byteOrder = byteOrder;
376 }
377 
383 {
384  return d->byteOrder;
385 }
386 
392 {
394 }
395 
401 {
402  return d->sampleType;
403 }
404 
422 
double d
Definition: qnumeric_p.h:62
int channelCount() const
Returns the current channel count value.
int frequency() const
Use sampleRate() instead.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
bool operator==(const QAudioFormat &other) const
Returns true if this QAudioFormat is equal to the other QAudioFormat; otherwise returns false...
~QAudioFormat()
Destroy this audio format.
QAudioFormat()
Construct a new audio format.
void setChannelCount(int channelCount)
Sets the channel count to channels.
QAudioFormat::SampleType sampleType
QAudioFormatPrivate & operator=(const QAudioFormatPrivate &other)
void setSampleType(QAudioFormat::SampleType sampleType)
Sets the sampleType to sampleType.
The QString class provides a Unicode character string.
Definition: qstring.h:83
int sampleSize() const
Returns the current sample size value.
bool operator!=(const QAudioFormat &other) const
Returns true if this QAudioFormat is not equal to the other QAudioFormat; otherwise returns false...
QAudioFormat::Endian byteOrder() const
Returns the current byteOrder value.
QAudioFormat & operator=(const QAudioFormat &other)
Assigns other to this QAudioFormat implementation.
QAudioFormat::SampleType sampleType() const
Returns the current SampleType value.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void setChannels(int channels)
Use setChannelCount() instead.
QString codec() const
Returns the current codec value.
bool isValid() const
Returns true if all of the parameters are valid.
QAudioFormatPrivate(const QAudioFormatPrivate &other)
The QSharedData class is a base class for shared data objects.
Definition: qshareddata.h:56
int sampleRate() const
Returns the current sample rate in Hertz.
void setFrequency(int frequency)
Use setSampleRate() instead.
The QAudioFormat class stores audio parameter information.
Definition: qaudioformat.h:60
void setSampleRate(int sampleRate)
Sets the sample rate to samplerate Hertz.
QSharedDataPointer< QAudioFormatPrivate > d
Definition: qaudioformat.h:99
void setSampleSize(int sampleSize)
Sets the sample size to the sampleSize specified.
QAudioFormat::Endian byteOrder
void setCodec(const QString &codec)
Sets the codec to codec.
void setByteOrder(QAudioFormat::Endian byteOrder)
Sets the byteOrder to byteOrder.
int channels() const
Use channelCount() instead.