2 * Copyright (C) 2011-2012 Juho Vähä-Herttua
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
21 #include <QAudioFormat>
22 #include <QAudioDeviceInfo>
23 #include <QAudioOutput>
26 class AudioOutput
: public QIODevice
30 explicit AudioOutput(QObject
*parent
= 0);
31 bool init(int bits
, int channels
, int samplerate
);
32 bool setDevice(QAudioDeviceInfo deviceInfo
);
35 void setVolume(float volume
);
36 void output(const QByteArray
& data
);
40 qint64
readData(char *data
, qint64 maxlen
);
41 qint64
writeData(const char *data
, qint64 len
);
42 qint64
bytesAvailable() const;
43 bool isSequential() const;
51 QAudioFormat m_format
;
52 QAudioDeviceInfo m_deviceInfo
;
53 QAudioOutput
* m_output
;
62 void stateChanged(QAudio::State state
);
65 #endif // AUDIOOUTPUT_H