From 38164ba66acc0cad9b19f879cba73006ca687647 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 6 Nov 2011 14:19:17 +0100 Subject: AUDIO: Simplify RawStream code. This drops the (unused) ability to play based on a list of input blocks. This was formely only used by the NDS specific VOC streaming code, which has been removed in 9fa9f68789ef51e078cb8631e06bead13cae13f2. --- test/audio/helper.h | 57 +++++++---------------------------------------------- 1 file changed, 7 insertions(+), 50 deletions(-) (limited to 'test/audio/helper.h') diff --git a/test/audio/helper.h b/test/audio/helper.h index 5080c79eef..77dc63b619 100644 --- a/test/audio/helper.h +++ b/test/audio/helper.h @@ -24,40 +24,7 @@ static T *createSine(const int sampleRate, const int time) { } template -static Common::SeekableReadStream *createPartitionStream(T *sine, const int samples, Audio::RawStreamBlockList &blockList) { - const int block1Len = samples / 2; - const int block1Size = block1Len * sizeof(T); - const int block2Len = samples - block1Len; - const int block2Size = block2Len * sizeof(T); - - const int bufferLen = samples * 2; - const int bufferSize = bufferLen * sizeof(T); - T *partition = (T *)calloc(1, bufferSize); - - Audio::RawStreamBlock block; - - // The will layout the buffer like the following: - // [Zero], [Part2], [Zero], [Part1] - - // The first part of the stream is at the end of the memory buffer - block.pos = bufferSize - block1Size; - block.len = block1Len; - memcpy(partition + bufferLen - block1Len, sine, block1Size); - blockList.push_back(block); - - // The second part of the stream is near the beginning of the memory buffer - block.pos = block2Size; - block.len = block2Len; - memcpy(partition + block2Len, sine + block1Len, block2Size); - blockList.push_back(block); - - free(sine); - - return new Common::MemoryReadStream((const byte *)partition, bufferSize, DisposeAfterUse::YES); -} - -template -static Audio::SeekableAudioStream *createSineStream(const int sampleRate, const int time, int16 **comp, bool le, bool isStereo, bool makePartition = false) { +static Audio::SeekableAudioStream *createSineStream(const int sampleRate, const int time, int16 **comp, bool le, bool isStereo) { T *sine = createSine(sampleRate, time * (isStereo ? 2 : 1)); const bool isUnsigned = !std::numeric_limits::is_signed; @@ -88,22 +55,12 @@ static Audio::SeekableAudioStream *createSineStream(const int sampleRate, const } Audio::SeekableAudioStream *s = 0; - if (makePartition) { - Audio::RawStreamBlockList blockList; - Common::SeekableReadStream *sD = createPartitionStream(sine, samples, blockList); - s = Audio::makeRawStream(sD, blockList, sampleRate, - (is16Bits ? Audio::FLAG_16BITS : 0) - | (isUnsigned ? Audio::FLAG_UNSIGNED : 0) - | (le ? Audio::FLAG_LITTLE_ENDIAN : 0) - | (isStereo ? Audio::FLAG_STEREO : 0)); - } else { - Common::SeekableReadStream *sD = new Common::MemoryReadStream((const byte *)sine, sizeof(T) * samples, DisposeAfterUse::YES); - s = Audio::makeRawStream(sD, sampleRate, - (is16Bits ? Audio::FLAG_16BITS : 0) - | (isUnsigned ? Audio::FLAG_UNSIGNED : 0) - | (le ? Audio::FLAG_LITTLE_ENDIAN : 0) - | (isStereo ? Audio::FLAG_STEREO : 0)); - } + Common::SeekableReadStream *sD = new Common::MemoryReadStream((const byte *)sine, sizeof(T) * samples, DisposeAfterUse::YES); + s = Audio::makeRawStream(sD, sampleRate, + (is16Bits ? Audio::FLAG_16BITS : 0) + | (isUnsigned ? Audio::FLAG_UNSIGNED : 0) + | (le ? Audio::FLAG_LITTLE_ENDIAN : 0) + | (isStereo ? Audio::FLAG_STEREO : 0)); return s; } -- cgit v1.2.3