I want to read in from an 16bit integer wave audio file with qt.
char tempbytes[3]; ///
´ QFile file(QString::fromStdString(sourcepath));
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning() << "Audio::readsamples: Cannot open File" << QString::fromStdString(source);
return;
}
file.seek(120);
file.read(tempbytes, 2);
now i have a char array but i want to cast it to an 16 bit signed integer value. The byte order in wave files is littleendian.
I already tried:
sample = qFromLittleEndian<qint16>((uchar*)tempsamples);
This worked for some samples but some were misinterpreted!
Can you help me how to do this?
Aucun commentaire:
Enregistrer un commentaire