RLBoxSoundTouchFactory.cpp (1785B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "RLBoxSoundTouchFactory.h" 8 9 // Exposed C API that is used by RLBox 10 11 using namespace soundtouch; 12 13 extern "C" { 14 15 void SetSampleRate(SoundTouch* mTimeStretcher, uint srate) { 16 mTimeStretcher->setSampleRate(srate); 17 } 18 19 void SetChannels(SoundTouch* mTimeStretcher, uint numChannels) { 20 mTimeStretcher->setChannels(numChannels); 21 } 22 23 void SetPitch(SoundTouch* mTimeStretcher, double newPitch) { 24 mTimeStretcher->setPitch(newPitch); 25 } 26 27 void SetSetting(SoundTouch* mTimeStretcher, int settingId, int value) { 28 mTimeStretcher->setSetting(settingId, value); 29 } 30 31 void SetTempo(SoundTouch* mTimeStretcher, double newTempo) { 32 mTimeStretcher->setTempo(newTempo); 33 } 34 35 void SetRate(SoundTouch* mTimeStretcher, double newRate) { 36 mTimeStretcher->setRate(newRate); 37 } 38 39 uint NumChannels(SoundTouch* mTimeStretcher) { 40 return mTimeStretcher->numChannels(); 41 } 42 43 uint NumSamples(SoundTouch* mTimeStretcher) { 44 return mTimeStretcher->numSamples(); 45 } 46 47 uint NumUnprocessedSamples(SoundTouch* mTimeStretcher) { 48 return mTimeStretcher->numUnprocessedSamples(); 49 } 50 51 void PutSamples(SoundTouch* mTimeStretcher, const SAMPLETYPE* samples, 52 uint numSamples) { 53 mTimeStretcher->putSamples(samples, numSamples); 54 } 55 56 uint ReceiveSamples(SoundTouch* mTimeStretcher, SAMPLETYPE* output, 57 uint maxSamples) { 58 return mTimeStretcher->receiveSamples(output, maxSamples); 59 } 60 61 void Flush(SoundTouch* mTimeStretcher) { return mTimeStretcher->flush(); } 62 }