30 QFile destinationFile;
44 format.setSampleRate(8000);
50 qWarning() <<
"Default format not supported, trying to use the nearest.";
57 audio->
start(&destinationFile);
66 destinationFile.
close();
119 format.setSampleRate(8000);
120 format.setChannelCount(1);
125 qWarning() <<
"Raw audio format not supported by backend, cannot play audio.";
131 audio->
start(&sourceFile);
164 format.setSampleRate(44100);
void applyVolume(int volumeSliderValue)
[Volume conversion]
void AudioDeviceInfo()
[Audio output state changed]
IOBluetoothDevice * device
void handleStateChanged(QAudio::State newState)
[Audio input state changed]
void setup()
[Audio output setup]
void handleStateChanged(QAudio::State newState)
[Audio output setup]
The QAudioDecoder class implements decoding audio.
void start()
Starts decoding the audio resource.
void setSource(const QUrl &fileName)
Sets the current audio file name to fileName.
void setAudioFormat(const QAudioFormat &format)
Set the desired audio format for decoded samples to format.
void bufferReady()
Signals that a new decoded audio buffer is available to be read.
The QAudioDevice class provides an information about audio devices and their functionality.
The QAudioSink class provides an interface for sending audio data to an audio output device.
void stop()
Stops the audio output, detaching from the system resource.
void stateChanged(QAudio::State state)
This signal is emitted when the device state has changed.
void start(QIODevice *device)
Starts transferring audio data from the device to the system's audio output.
QAudio::Error error() const
Returns the error state.
The QAudioSource class provides an interface for receiving audio data from an audio input device.
QAudio::Error error() const
Returns the error state.
void stop()
Stops the audio input, detaching from the system resource.
void start(QIODevice *device)
Starts transferring audio data from the system's audio input to the device.
void stateChanged(QAudio::State state)
This signal is emitted when the device state has changed.
void close() override
Calls QFileDevice::flush() and closes the file.
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
void setFileName(const QString &name)
Sets the name of the file.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
bool singleShot
whether the timer is a single-shot timer
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
State
\value ActiveState Audio data is being processed, this state is set after start() is called and while...
float convertVolume(float volume, VolumeScale from, VolumeScale to)
Converts an audio volume from a volume scale to another, and returns the result.
int qRound(qfloat16 d) noexcept
GLint GLsizei GLsizei GLenum format
QFileInfo info(fileName)
[8]