aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorPaul McLean <pmclean@google.com>2020-09-21 10:15:49 -0600
committerPaul McLean <pmclean@google.com>2020-09-24 11:33:04 -0600
commit01d2bf79eaf0977ed5bb85925ff11e8bdd3795e8 (patch)
tree4f812460a896e3f9be38bade46c987684c219cbc /samples
parentf6585a6e1e0a2f33e90da7ac910b0fac83aa1141 (diff)
downloadoboe-01d2bf79eaf0977ed5bb85925ff11e8bdd3795e8.tar.gz
Cleaned up README.md file.
removed local "channelCount" variable.
Diffstat (limited to 'samples')
-rw-r--r--samples/drumthumper/README.md10
-rw-r--r--samples/iolib/src/main/cpp/player/SampleBuffer.cpp7
2 files changed, 8 insertions, 9 deletions
diff --git a/samples/drumthumper/README.md b/samples/drumthumper/README.md
index 07f6f06b..a5e2e691 100644
--- a/samples/drumthumper/README.md
+++ b/samples/drumthumper/README.md
@@ -27,13 +27,13 @@ Secondarily, **DrumThumper** demonstrates:
* How to use the Oboe resampler to resample source audio to the device playback rate, and therefore not incur this overhead at playback time.
To keep things simple, **DrumThumper** specifically does not:
-* Does not provide support audio samples in other than 16-bit, mono PCM Samples. It does not support Stereo or different PCM formats.
-* Does not provide support for non-WAV audio data (such as AIFF).
-* Does not provide support for compressed audio data.
+* Does not support audio samples in other than 16-bit, mono PCM Samples. It does not support Stereo or different PCM formats.
+* Does not support for non-WAV audio data (such as AIFF).
+* Does not support for compressed audio data.
-**DrumThumper** does now support different sample rates for the source samples.
+**DrumThumper** now supports different sample rates for the source samples.
-If an one wanted to extend **DrumThumper** to support Stereo samples, one would need to:
+If an one wanted to extend **DrumThumper** to support Stereo samples:
* The SampleSource class would need to be extended to understand Stereo SampleBuffer objects, it currently assumes Mono.
* The OneShotSampleSource.mixAudio() method would need to have separate mixing logic for Stereo and Mono SampleSource.
diff --git a/samples/iolib/src/main/cpp/player/SampleBuffer.cpp b/samples/iolib/src/main/cpp/player/SampleBuffer.cpp
index 23030916..039a24cd 100644
--- a/samples/iolib/src/main/cpp/player/SampleBuffer.cpp
+++ b/samples/iolib/src/main/cpp/player/SampleBuffer.cpp
@@ -64,9 +64,8 @@ void resampleData(const ResampleBlock& input, ResampleBlock* output, int numChan
// so add a few more frames for padding
numOutFrames += 8;
- const int channelCount = numChannels; // 1 for mono, 2 for stereo
MultiChannelResampler *resampler = MultiChannelResampler::make(
- channelCount, // channel count
+ numChannels, // channel count
input.mSampleRate, // input sampleRate
output->mSampleRate, // output sampleRate
MultiChannelResampler::Quality::Medium); // conversion quality
@@ -80,11 +79,11 @@ void resampleData(const ResampleBlock& input, ResampleBlock* output, int numChan
while (inputFramesLeft > 0) {
if(resampler->isWriteNeeded()) {
resampler->writeNextFrame(inputBuffer);
- inputBuffer += channelCount;
+ inputBuffer += numChannels;
inputFramesLeft--;
} else {
resampler->readNextFrame(outputBuffer);
- outputBuffer += channelCount;
+ outputBuffer += numChannels;
numOutputFrames++;
}
}