Some improvements to Qt Audio.

This commit is contained in:
Sacha committed 2013-12-06 13:06:04 +10:00
1 parent b83fea1b6b
commit 26dfe75882
2 files changed
+4 -3

No files matched your search

+3 -3
View File
@@ -233,10 +233,10 @@ public slots:
fmt.setSampleSize(AUDIO_SAMPLESIZE);
fmt.setByteOrder(QAudioFormat::LittleEndian);
fmt.setSampleType(QAudioFormat::SignedInt);
mixlen = 5*2*AUDIO_CHANNELS*AUDIO_SAMPLES;
mixlen = 2*AUDIO_CHANNELS*AUDIO_SAMPLES;
mixbuf = (char*)malloc(mixlen);
output = new QAudioOutput(fmt);
output->setBufferSize(mixlen);
output->setBufferSize(mixlen*10);
feed = output->start();
if (feed != NULL)
timer = startTimer(1000*AUDIO_SAMPLES / AUDIO_FREQ);
@@ -245,7 +245,7 @@ public slots:
protected:
void timerEvent(QTimerEvent *) {
memset(mixbuf, 0, mixlen);
size_t frames = NativeMix((short *)mixbuf, 5*AUDIO_SAMPLES);
size_t frames = NativeMix((short *)mixbuf, AUDIO_SAMPLES);
if (frames > 0)
feed->write(mixbuf, sizeof(short) * 2 * frames);
}
+1
View File
@@ -33,6 +33,7 @@
* SUCH DAMAGE.
*/
#include "config.h"
#ifndef HAVE_MKSTEMP
#include <sys/types.h>
#include <sys/stat.h>