summaryrefslogtreecommitdiffstats
path: root/src/gui/embedded
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-05-20 16:43:10 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-05-20 16:43:10 (GMT)
commitbfde87dcc8d0f363ecf1da59482c15445b00484c (patch)
tree0d0c01b1611caf91ba900bd2b67a8806590254cc /src/gui/embedded
parent27fadaa7eb2d58b47e7f0f508e3402e7a8de3894 (diff)
parentf9d26f0bebd5bcc32d15c4a627251c44cf78389e (diff)
downloadQt-bfde87dcc8d0f363ecf1da59482c15445b00484c.zip
Qt-bfde87dcc8d0f363ecf1da59482c15445b00484c.tar.gz
Qt-bfde87dcc8d0f363ecf1da59482c15445b00484c.tar.bz2
Merge commit 'qt/master'
Diffstat (limited to 'src/gui/embedded')
-rw-r--r--src/gui/embedded/qscreen_qws.cpp2
-rw-r--r--src/gui/embedded/qsoundqss_qws.cpp40
2 files changed, 34 insertions, 8 deletions
diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp
index a82edbb..91121e7 100644
--- a/src/gui/embedded/qscreen_qws.cpp
+++ b/src/gui/embedded/qscreen_qws.cpp
@@ -1397,7 +1397,7 @@ QImage::Format QScreenPrivate::preferredImageFormat() const
altered. Note that the default implementations of these functions
do nothing.
- Reimplement the the mapFromDevice() and mapToDevice() functions to
+ Reimplement the mapFromDevice() and mapToDevice() functions to
map objects from the framebuffer coordinate system to the
coordinate space used by the application, and vice versa. Be aware
that the default implementations simply return the given objects
diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp
index c72ea91..283bbd3 100644
--- a/src/gui/embedded/qsoundqss_qws.cpp
+++ b/src/gui/embedded/qsoundqss_qws.cpp
@@ -52,6 +52,7 @@
#include <qalgorithms.h>
#include <qtimer.h>
#include <qpointer.h>
+#include <qendian.h>
#include <unistd.h>
#include <stdlib.h>
@@ -335,7 +336,13 @@ public:
virtual int readySamples(int) = 0;
int getSample(int off, int bps) {
- return (bps == 1) ? (data[out+off] - 128) * 128 : ((short*)data)[(out/2)+off];
+
+ //
+ // 16-bit audio data is converted to native endian so that it can be scaled
+ // Yes, this is ugly on a BigEndian machine
+ // Perhaps it shouldn't be scaled at all
+ //
+ return (bps == 1) ? (data[out+off] - 128) * 128 : qToLittleEndian(((short*)data)[(out/2)+off]);
}
int add(int* mixl, int* mixr, int count)
@@ -547,7 +554,7 @@ public:
wavedata_remaining = 0;
mFinishedRead = true;
} else if ( qstrncmp(chunk.id,"data",4) == 0 ) {
- wavedata_remaining = chunk.size;
+ wavedata_remaining = qToLittleEndian( chunk.size );
//out = max = sound_buffer_size;
@@ -572,10 +579,23 @@ public:
//qDebug("couldn't ready chunkdata");
mFinishedRead = true;
}
+
#define WAVE_FORMAT_PCM 1
- else if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) {
- //qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag);
- mFinishedRead = true;
+ else
+ {
+ /*
+ ** Endian Fix the chuck data
+ */
+ chunkdata.formatTag = qToLittleEndian( chunkdata.formatTag );
+ chunkdata.channels = qToLittleEndian( chunkdata.channels );
+ chunkdata.samplesPerSec = qToLittleEndian( chunkdata.samplesPerSec );
+ chunkdata.avgBytesPerSec = qToLittleEndian( chunkdata.avgBytesPerSec );
+ chunkdata.blockAlign = qToLittleEndian( chunkdata.blockAlign );
+ chunkdata.wBitsPerSample = qToLittleEndian( chunkdata.wBitsPerSample );
+ if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) {
+ qWarning("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag);
+ mFinishedRead = true;
+ }
}
} else {
// ignored chunk
@@ -1166,9 +1186,15 @@ bool QWSSoundServerPrivate::openDevice()
if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &v))
qWarning("Could not set fragments to %08x",v);
#ifdef QT_QWS_SOUND_16BIT
- v=AFMT_S16_LE; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v))
+ //
+ // Use native endian
+ // Since we have manipulated the data volume the data
+ // is now in native format, even though its stored
+ // as little endian in the WAV file
+ //
+ v=AFMT_S16_NE; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v))
qWarning("Could not set format %d",v);
- if (AFMT_S16_LE != v)
+ if (AFMT_S16_NE != v)
qDebug("Want format %d got %d", AFMT_S16_LE, v);
#else
v=AFMT_U8; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v))