1/***************************************************************************
2 copyright : (C) 2008 by Scott Wheeler
3 email : wheeler@kde.org
4***************************************************************************/
5
6/***************************************************************************
7 * This library is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License version *
9 * 2.1 as published by the Free Software Foundation. *
10 * *
11 * This library is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19 * 02110-1301 USA *
20 * *
21 * Alternatively, this file is available under the Mozilla Public *
22 * License Version 1.1. You may obtain a copy of the License at *
23 * http://www.mozilla.org/MPL/ *
24 ***************************************************************************/
25
26#ifndef TAGLIB_WAVPROPERTIES_H
27#define TAGLIB_WAVPROPERTIES_H
28
29#include "taglib.h"
30#include "audioproperties.h"
31
32namespace TagLib {
33
34 class ByteVector;
35
36 namespace RIFF {
37
38 namespace WAV {
39
40 class File;
41
42 //! An implementation of audio property reading for WAV
43
44 /*!
45 * This reads the data from an WAV stream found in the AudioProperties
46 * API.
47 */
48
49 class TAGLIB_EXPORT Properties : public AudioProperties
50 {
51 public:
52 /*!
53 * Create an instance of WAV::Properties with the data read from the
54 * ByteVector \a data.
55 *
56 * \deprecated
57 */
58 Properties(const ByteVector &data, ReadStyle style);
59
60 /*!
61 * Create an instance of WAV::Properties with the data read from the
62 * ByteVector \a data and the length calculated using \a streamLength.
63 *
64 * \deprecated
65 */
66 Properties(const ByteVector &data, unsigned int streamLength, ReadStyle style);
67
68 /*!
69 * Create an instance of WAV::Properties with the data read from the
70 * WAV::File \a file.
71 */
72 Properties(File *file, ReadStyle style);
73
74 /*!
75 * Destroys this WAV::Properties instance.
76 */
77 virtual ~Properties();
78
79 /*!
80 * Returns the length of the file in seconds. The length is rounded down to
81 * the nearest whole second.
82 *
83 * \note This method is just an alias of lengthInSeconds().
84 *
85 * \deprecated
86 */
87 virtual int length() const;
88
89 /*!
90 * Returns the length of the file in seconds. The length is rounded down to
91 * the nearest whole second.
92 *
93 * \see lengthInMilliseconds()
94 */
95 // BIC: make virtual
96 int lengthInSeconds() const;
97
98 /*!
99 * Returns the length of the file in milliseconds.
100 *
101 * \see lengthInSeconds()
102 */
103 // BIC: make virtual
104 int lengthInMilliseconds() const;
105
106 /*!
107 * Returns the average bit rate of the file in kb/s.
108 */
109 virtual int bitrate() const;
110
111 /*!
112 * Returns the sample rate in Hz.
113 */
114 virtual int sampleRate() const;
115
116 /*!
117 * Returns the number of audio channels.
118 */
119 virtual int channels() const;
120
121 /*!
122 * Returns the number of bits per audio sample.
123 */
124 int bitsPerSample() const;
125
126 /*!
127 * Returns the number of bits per audio sample.
128 *
129 * \note This method is just an alias of bitsPerSample().
130 *
131 * \deprecated
132 */
133 int sampleWidth() const;
134
135 /*!
136 * Returns the number of sample frames.
137 */
138 unsigned int sampleFrames() const;
139
140 /*!
141 * Returns the format ID of the file.
142 * 0 for unknown, 1 for PCM, 2 for ADPCM, 3 for 32/64-bit IEEE754, and
143 * so forth.
144 *
145 * \note For further information, refer to the WAVE Form Registration
146 * Numbers in RFC 2361.
147 */
148 int format() const;
149
150 private:
151 Properties(const Properties &);
152 Properties &operator=(const Properties &);
153
154 void read(File *file);
155
156 class PropertiesPrivate;
157 PropertiesPrivate *d;
158 };
159 }
160 }
161}
162
163#endif
164