summaryrefslogtreecommitdiffstats
path: root/media/libsoundtouch/src/RLBoxSoundTouchFactory.cpp
blob: 5e2fbca8d92df469b87656917c05f7aaf5a129d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "RLBoxSoundTouchFactory.h"

// Exposed C API that is used by RLBox

using namespace soundtouch;

extern "C" {

void SetSampleRate(SoundTouch* mTimeStretcher, uint srate) {
  mTimeStretcher->setSampleRate(srate);
}

void SetChannels(SoundTouch* mTimeStretcher, uint numChannels) {
  mTimeStretcher->setChannels(numChannels);
}

void SetPitch(SoundTouch* mTimeStretcher, double newPitch) {
  mTimeStretcher->setPitch(newPitch);
}

void SetSetting(SoundTouch* mTimeStretcher, int settingId, int value) {
  mTimeStretcher->setSetting(settingId, value);
}

void SetTempo(SoundTouch* mTimeStretcher, double newTempo) {
  mTimeStretcher->setTempo(newTempo);
}

void SetRate(SoundTouch* mTimeStretcher, double newRate) {
  mTimeStretcher->setRate(newRate);
}

uint NumChannels(SoundTouch* mTimeStretcher) {
  return mTimeStretcher->numChannels();
}

uint NumSamples(SoundTouch* mTimeStretcher) {
  return mTimeStretcher->numSamples();
}

uint NumUnprocessedSamples(SoundTouch* mTimeStretcher) {
  return mTimeStretcher->numUnprocessedSamples();
}

void PutSamples(SoundTouch* mTimeStretcher, const SAMPLETYPE* samples,
                uint numSamples) {
  mTimeStretcher->putSamples(samples, numSamples);
}

uint ReceiveSamples(SoundTouch* mTimeStretcher, SAMPLETYPE* output,
                    uint maxSamples) {
  return mTimeStretcher->receiveSamples(output, maxSamples);
}

void Flush(SoundTouch* mTimeStretcher) { return mTimeStretcher->flush(); }
}