C++ (Qt) bArray = &buffer.buffer(); // get pointer to QByteArray// ...... audioInput = new QAudioInput(settings, reinterpret_cast<QObject*>(this)); //audioInput->start(&outFile); audioInput->start( &buffer);
C++ (Qt)bArray->append();bArray->remove();
C++ (Qt) stream = new QDataStream (&buffer); //( bArray, QIODevice::ReadWrite);// ....... union { // wtf, I'd want better way short val; char ch[2]; }; ch[0] << stream->readRawData(&ch[0], 2); // ch[1] << stream; qDebug() << val;
C++ (Qt) inSignal = new QAudioInput(format, reinterpret_cast<QObject*>(this)); inSignal->start(&outFile);
C++ (Qt) qDebug() << "buffer1: " << buffer.size(); union { // wtf, I'd want better way // short sample; qint16 sample; char ch[2]; }; for (int i=0;i<16;i++) { stream->readRawData(&ch[0], 2); qDebug() << sample; buffer.getChar( &ch[0]); buffer.getChar( &ch[1]); qDebug() << sample; } qDebug() << "buffer2: " << buffer.size();
C++ (Qt) union { // wtf, I'd want better way // short sample; qint16 sample; char ch[2]; }; for (int i=0;i<16;i++) { buffer.getChar( &ch[0]); buffer.getChar( &ch[1]); qDebug() << sample; bArray->remove(0, 2); } qDebug() << "buffer2: " << buffer.size() << bArray->size();
buffer: 16000 16000 -8 20 -33 ... мыши погрызли293 307 buffer2: 15968 15968
C++ (Qt) bArray->remove(0, 2);