/usr/include/phonon4qt5/phonon/experimental/audiodataoutput.h is in libphonon4qt5experimental-dev 4:4.8.3-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | /* This file is part of the KDE project
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), Nokia Corporation
(or its successors, if any) and the KDE Free Qt Foundation, which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef Phonon_AUDIODATAOUTPUT_H
#define Phonon_AUDIODATAOUTPUT_H
#include "export.h"
#include "../abstractaudiooutput.h"
#include "../phonondefs.h"
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template<typename T> class QVector;
template<typename Key, typename T> class QMap;
#endif
namespace Phonon
{
namespace Experimental
{
class AudioDataOutputPrivate;
/**
* \short This class gives you the audio data (for visualizations).
*
* This class implements a special AbstractAudioOutput that gives your
* application the audio data. Don't expect realtime performance. But
* the latencies should be low enough to use the audio data for
* visualizations. You can also use the audio data for further processing
* (e.g. encoding and saving to a file).
*
* The class supports different data formats. One of the most common formats
* is to read vectors of integers (which will only use 16 Bit), but you can
* also request floats which some backends use internally.
*
* \author Matthias Kretz <kretz@kde.org>
*/
class PHONONEXPERIMENTAL_EXPORT AudioDataOutput : public AbstractAudioOutput
{
Q_OBJECT
P_DECLARE_PRIVATE(AudioDataOutput)
Q_ENUMS(Channel Format)
Q_PROPERTY(Format format READ format WRITE setFormat)
Q_PROPERTY(int dataSize READ dataSize WRITE setDataSize)
PHONON_HEIR(AudioDataOutput)
public:
/**
* Specifies the channel the audio data belongs to.
*/
enum Channel
{
LeftChannel,
RightChannel,
CenterChannel,
LeftSurroundChannel,
RightSurroundChannel,
SubwooferChannel
};
/**
* Used for telling the object whether you want 16 bit Integers or
* 32 bit floats.
*
* \see requestFormat
*/
enum Format
{
/**
* Requests 16 bit signed integers.
*
* \see dataReady(const QVector<qint16> &)
*/
IntegerFormat = 1,
/**
* Requests 32 bit floating point: signed, zero centered, and
* normalized to the unit value (-1.0 to 1.0).
*
* \see dataReady(const QVector<float> &)
*/
FloatFormat = 2
};
/**
* Returns the currently used format.
*
* \see setFormat
*/
Format format() const;
/**
* Returns the currently used number of samples passed through
* the signal.
*
* \see setDataSize
*/
int dataSize() const;
/**
* Returns the sample rate in Hz. Common sample rates are 44100 Hz
* and 48000 Hz. AudioDataOutput will not do any sample rate
* conversion for you. If you need to convert the sample rate you
* might want to take a look at libsamplerate. For visualizations it
* is often enough to do simple interpolation or even drop/duplicate
* samples.
*
* \return The sample rate as reported by the backend. If the
* backend is unavailable -1 is returned.
*/
int sampleRate() const;
public Q_SLOTS:
/**
* Requests the dataformat you'd like to receive. Only one of the
* signals of this class will be emitted when new data is ready.
*
* The default format is IntegerFormat.
*
* \see format()
*/
void setFormat(Format format);
/**
* Sets the number of samples to be passed in one signal emission.
*
* Defaults to 512 samples per emitted signal.
*
* \param size the number of samples
*/
void setDataSize(int size);
Q_SIGNALS:
/**
* Emitted whenever another dataSize number of samples are ready and
* format is set to IntegerFormat.
*
* If format is set to FloatFormat the signal is not emitted at all.
*
* \param data A mapping of Channel to a vector holding the audio data.
*/
void dataReady(const QMap<Phonon::Experimental::AudioDataOutput::Channel, QVector<qint16> > &data);
/**
* Emitted whenever another dataSize number of samples are ready and
* format is set to FloatFormat.
*
* If format is set to IntegerFormat the signal is not emitted at all.
*
* \param data A mapping of Channel to a vector holding the audio data.
*/
void dataReady(const QMap<Phonon::Experimental::AudioDataOutput::Channel, QVector<float> > &data);
/**
* This signal is emitted before the last dataReady signal of a
* media is emitted.
*
* If, for example, the playback of a media file has finished and the
* last audio data of that file is going to be passed with the next
* dataReady signal, and only the 28 first samples of the data
* vector are from that media file endOfMedia will be emitted right
* before dataReady with \p remainingSamples = 28.
*
* \param remainingSamples The number of samples in the next
* dataReady vector that belong to the media that was playing to
* this point.
*/
void endOfMedia(int remainingSamples);
};
} // namespace Experimental
} // namespace Phonon
// vim: sw=4 ts=4 tw=80
#endif // Phonon_AUDIODATAOUTPUT_H
|