I found a code and tranformed it (hehe) to this:
#include <QFile>
#include <QAudioFormat>
#include <QAudioOutput>
#include <QSound>
int main()
{
inputFile.setFileName("/home/alex/Music/noh.wav");
QAudioFormat format;
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::UnSignedInt);
QAudioOutput *audio = new QAudioOutput( format, 0);
audio->start(&inputFile);
return 0;
}
#include <QFile>
#include <QAudioFormat>
#include <QAudioOutput>
#include <QSound>
int main()
{
QFile inputFile;
inputFile.setFileName("/home/alex/Music/noh.wav");
inputFile.open(QIODevice::ReadOnly);
QAudioFormat format;
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::UnSignedInt);
QAudioOutput *audio = new QAudioOutput( format, 0);
audio->start(&inputFile);
return 0;
}
To copy to clipboard, switch view to plain text mode
but the only output is
QObject::startTimer: QTimer can only be used with threads started with QThread and no sound is heard.. (--_--)
Bookmarks