Chris@13
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@13
|
2
|
Chris@13
|
3 /*
|
Chris@13
|
4 Rubber Band Library
|
Chris@13
|
5 An audio time-stretching and pitch-shifting library.
|
Chris@13
|
6 Copyright 2007-2012 Particular Programs Ltd.
|
Chris@13
|
7
|
Chris@13
|
8 This program is free software; you can redistribute it and/or
|
Chris@13
|
9 modify it under the terms of the GNU General Public License as
|
Chris@13
|
10 published by the Free Software Foundation; either version 2 of the
|
Chris@13
|
11 License, or (at your option) any later version. See the file
|
Chris@13
|
12 COPYING included with this distribution for more information.
|
Chris@13
|
13
|
Chris@13
|
14 Alternatively, if you have a valid commercial licence for the
|
Chris@13
|
15 Rubber Band Library obtained by agreement with the copyright
|
Chris@13
|
16 holders, you may redistribute and/or modify it under the terms
|
Chris@13
|
17 described in that licence.
|
Chris@13
|
18
|
Chris@13
|
19 If you wish to distribute code using the Rubber Band Library
|
Chris@13
|
20 under terms other than those of the GNU General Public License,
|
Chris@13
|
21 you must obtain a valid commercial licence before doing so.
|
Chris@13
|
22 */
|
Chris@13
|
23
|
Chris@13
|
24 #ifndef _RUBBERBAND_C_API_H_
|
Chris@13
|
25 #define _RUBBERBAND_C_API_H_
|
Chris@13
|
26
|
Chris@13
|
27 #ifdef __cplusplus
|
Chris@13
|
28 extern "C" {
|
Chris@13
|
29 #endif
|
Chris@13
|
30
|
Chris@13
|
31 #define RUBBERBAND_VERSION "1.8.1"
|
Chris@13
|
32 #define RUBBERBAND_API_MAJOR_VERSION 2
|
Chris@13
|
33 #define RUBBERBAND_API_MINOR_VERSION 5
|
Chris@13
|
34
|
Chris@13
|
35 /**
|
Chris@13
|
36 * This is a C-linkage interface to the Rubber Band time stretcher.
|
Chris@13
|
37 *
|
Chris@13
|
38 * This is a wrapper interface: the primary interface is in C++ and is
|
Chris@13
|
39 * defined and documented in RubberBandStretcher.h. The library
|
Chris@13
|
40 * itself is implemented in C++, and requires C++ standard library
|
Chris@13
|
41 * support even when using the C-linkage API.
|
Chris@13
|
42 *
|
Chris@13
|
43 * Please see RubberBandStretcher.h for documentation.
|
Chris@13
|
44 *
|
Chris@13
|
45 * If you are writing to the C++ API, do not include this header.
|
Chris@13
|
46 */
|
Chris@13
|
47
|
Chris@13
|
48 enum RubberBandOption {
|
Chris@13
|
49
|
Chris@13
|
50 RubberBandOptionProcessOffline = 0x00000000,
|
Chris@13
|
51 RubberBandOptionProcessRealTime = 0x00000001,
|
Chris@13
|
52
|
Chris@13
|
53 RubberBandOptionStretchElastic = 0x00000000,
|
Chris@13
|
54 RubberBandOptionStretchPrecise = 0x00000010,
|
Chris@13
|
55
|
Chris@13
|
56 RubberBandOptionTransientsCrisp = 0x00000000,
|
Chris@13
|
57 RubberBandOptionTransientsMixed = 0x00000100,
|
Chris@13
|
58 RubberBandOptionTransientsSmooth = 0x00000200,
|
Chris@13
|
59
|
Chris@13
|
60 RubberBandOptionDetectorCompound = 0x00000000,
|
Chris@13
|
61 RubberBandOptionDetectorPercussive = 0x00000400,
|
Chris@13
|
62 RubberBandOptionDetectorSoft = 0x00000800,
|
Chris@13
|
63
|
Chris@13
|
64 RubberBandOptionPhaseLaminar = 0x00000000,
|
Chris@13
|
65 RubberBandOptionPhaseIndependent = 0x00002000,
|
Chris@13
|
66
|
Chris@13
|
67 RubberBandOptionThreadingAuto = 0x00000000,
|
Chris@13
|
68 RubberBandOptionThreadingNever = 0x00010000,
|
Chris@13
|
69 RubberBandOptionThreadingAlways = 0x00020000,
|
Chris@13
|
70
|
Chris@13
|
71 RubberBandOptionWindowStandard = 0x00000000,
|
Chris@13
|
72 RubberBandOptionWindowShort = 0x00100000,
|
Chris@13
|
73 RubberBandOptionWindowLong = 0x00200000,
|
Chris@13
|
74
|
Chris@13
|
75 RubberBandOptionSmoothingOff = 0x00000000,
|
Chris@13
|
76 RubberBandOptionSmoothingOn = 0x00800000,
|
Chris@13
|
77
|
Chris@13
|
78 RubberBandOptionFormantShifted = 0x00000000,
|
Chris@13
|
79 RubberBandOptionFormantPreserved = 0x01000000,
|
Chris@13
|
80
|
Chris@13
|
81 RubberBandOptionPitchHighQuality = 0x00000000,
|
Chris@13
|
82 RubberBandOptionPitchHighSpeed = 0x02000000,
|
Chris@13
|
83 RubberBandOptionPitchHighConsistency = 0x04000000,
|
Chris@13
|
84
|
Chris@13
|
85 RubberBandOptionChannelsApart = 0x00000000,
|
Chris@13
|
86 RubberBandOptionChannelsTogether = 0x10000000,
|
Chris@13
|
87 };
|
Chris@13
|
88
|
Chris@13
|
89 typedef int RubberBandOptions;
|
Chris@13
|
90
|
Chris@13
|
91 struct RubberBandState_;
|
Chris@13
|
92 typedef struct RubberBandState_ *RubberBandState;
|
Chris@13
|
93
|
Chris@13
|
94 extern RubberBandState rubberband_new(unsigned int sampleRate,
|
Chris@13
|
95 unsigned int channels,
|
Chris@13
|
96 RubberBandOptions options,
|
Chris@13
|
97 double initialTimeRatio,
|
Chris@13
|
98 double initialPitchScale);
|
Chris@13
|
99
|
Chris@13
|
100 extern void rubberband_delete(RubberBandState);
|
Chris@13
|
101
|
Chris@13
|
102 extern void rubberband_reset(RubberBandState);
|
Chris@13
|
103
|
Chris@13
|
104 extern void rubberband_set_time_ratio(RubberBandState, double ratio);
|
Chris@13
|
105 extern void rubberband_set_pitch_scale(RubberBandState, double scale);
|
Chris@13
|
106
|
Chris@13
|
107 extern double rubberband_get_time_ratio(const RubberBandState);
|
Chris@13
|
108 extern double rubberband_get_pitch_scale(const RubberBandState);
|
Chris@13
|
109
|
Chris@13
|
110 extern unsigned int rubberband_get_latency(const RubberBandState);
|
Chris@13
|
111
|
Chris@13
|
112 extern void rubberband_set_transients_option(RubberBandState, RubberBandOptions options);
|
Chris@13
|
113 extern void rubberband_set_detector_option(RubberBandState, RubberBandOptions options);
|
Chris@13
|
114 extern void rubberband_set_phase_option(RubberBandState, RubberBandOptions options);
|
Chris@13
|
115 extern void rubberband_set_formant_option(RubberBandState, RubberBandOptions options);
|
Chris@13
|
116 extern void rubberband_set_pitch_option(RubberBandState, RubberBandOptions options);
|
Chris@13
|
117
|
Chris@13
|
118 extern void rubberband_set_expected_input_duration(RubberBandState, unsigned int samples);
|
Chris@13
|
119
|
Chris@13
|
120 extern unsigned int rubberband_get_samples_required(const RubberBandState);
|
Chris@13
|
121
|
Chris@13
|
122 extern void rubberband_set_max_process_size(RubberBandState, unsigned int samples);
|
Chris@13
|
123 extern void rubberband_set_key_frame_map(RubberBandState, unsigned int keyframecount, unsigned int *from, unsigned int *to);
|
Chris@13
|
124
|
Chris@13
|
125 extern void rubberband_study(RubberBandState, const float *const *input, unsigned int samples, int final);
|
Chris@13
|
126 extern void rubberband_process(RubberBandState, const float *const *input, unsigned int samples, int final);
|
Chris@13
|
127
|
Chris@13
|
128 extern int rubberband_available(const RubberBandState);
|
Chris@13
|
129 extern unsigned int rubberband_retrieve(const RubberBandState, float *const *output, unsigned int samples);
|
Chris@13
|
130
|
Chris@13
|
131 extern unsigned int rubberband_get_channel_count(const RubberBandState);
|
Chris@13
|
132
|
Chris@13
|
133 extern void rubberband_calculate_stretch(RubberBandState);
|
Chris@13
|
134
|
Chris@13
|
135 extern void rubberband_set_debug_level(RubberBandState, int level);
|
Chris@13
|
136 extern void rubberband_set_default_debug_level(int level);
|
Chris@13
|
137
|
Chris@13
|
138 #ifdef __cplusplus
|
Chris@13
|
139 }
|
Chris@13
|
140 #endif
|
Chris@13
|
141
|
Chris@13
|
142 #endif
|