change design for how certain region list items operate if there are multiple regions...
[ardour.git] / libs / rubberband / rubberband / rubberband-c.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2
3 /*
4     Rubber Band
5     An audio time-stretching and pitch-shifting library.
6     Copyright 2007-2008 Chris Cannam.
7     
8     This program is free software; you can redistribute it and/or
9     modify it under the terms of the GNU General Public License as
10     published by the Free Software Foundation; either version 2 of the
11     License, or (at your option) any later version.  See the file
12     COPYING included with this distribution for more information.
13 */
14
15 #ifndef _RUBBERBAND_C_API_H_
16 #define _RUBBERBAND_C_API_H_
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 #define RUBBERBAND_VERSION "1.2.0-gpl"    
23 #define RUBBERBAND_API_MAJOR_VERSION 2
24 #define RUBBERBAND_API_MINOR_VERSION 0
25
26 /**
27  * This is a C-linkage interface to the Rubber Band time stretcher.
28  * 
29  * This is a wrapper interface: the primary interface is in C++ and is
30  * defined and documented in RubberBandStretcher.h.  The library
31  * itself is implemented in C++, and requires C++ standard library
32  * support even when using the C-linkage API.
33  *
34  * Please see RubberBandStretcher.h for documentation.
35  *
36  * If you are writing to the C++ API, do not include this header.
37  */
38
39 enum RubberBandOption {
40
41     RubberBandOptionProcessOffline       = 0x00000000,
42     RubberBandOptionProcessRealTime      = 0x00000001,
43
44     RubberBandOptionStretchElastic       = 0x00000000,
45     RubberBandOptionStretchPrecise       = 0x00000010,
46     
47     RubberBandOptionTransientsCrisp      = 0x00000000,
48     RubberBandOptionTransientsMixed      = 0x00000100,
49     RubberBandOptionTransientsSmooth     = 0x00000200,
50
51     RubberBandOptionPhaseLaminar         = 0x00000000,
52     RubberBandOptionPhaseIndependent     = 0x00002000,
53     
54     RubberBandOptionThreadingAuto        = 0x00000000,
55     RubberBandOptionThreadingNever       = 0x00010000,
56     RubberBandOptionThreadingAlways      = 0x00020000,
57
58     RubberBandOptionWindowStandard       = 0x00000000,
59     RubberBandOptionWindowShort          = 0x00100000,
60     RubberBandOptionWindowLong           = 0x00200000,
61
62     RubberBandOptionFormantShifted       = 0x00000000,
63     RubberBandOptionFormantPreserved     = 0x01000000,
64
65     RubberBandOptionPitchHighQuality     = 0x00000000,
66     RubberBandOptionPitchHighSpeed       = 0x02000000,
67     RubberBandOptionPitchHighConsistency = 0x04000000
68 };
69
70 typedef int RubberBandOptions;
71
72 struct RubberBandState_;
73 typedef struct RubberBandState_ *RubberBandState;
74
75 extern RubberBandState rubberband_new(unsigned int sampleRate,
76                                       unsigned int channels,
77                                       RubberBandOptions options,
78                                       double initialTimeRatio,
79                                       double initialPitchScale);
80
81 extern void rubberband_delete(RubberBandState);
82
83 extern void rubberband_reset(RubberBandState);
84
85 extern void rubberband_set_time_ratio(RubberBandState, double ratio);
86 extern void rubberband_set_pitch_scale(RubberBandState, double scale);
87
88 extern double rubberband_get_time_ratio(const RubberBandState);
89 extern double rubberband_get_pitch_scale(const RubberBandState);
90
91 extern unsigned int rubberband_get_latency(const RubberBandState);
92
93 extern void rubberband_set_transients_option(RubberBandState, RubberBandOptions options);
94 extern void rubberband_set_phase_option(RubberBandState, RubberBandOptions options);
95 extern void rubberband_set_formant_option(RubberBandState, RubberBandOptions options);
96 extern void rubberband_set_pitch_option(RubberBandState, RubberBandOptions options);
97
98 extern void rubberband_set_expected_input_duration(RubberBandState, unsigned int samples);
99
100 extern unsigned int rubberband_get_samples_required(const RubberBandState);
101
102 extern void rubberband_set_max_process_size(RubberBandState, unsigned int samples);
103
104 extern void rubberband_study(RubberBandState, const float *const *input, unsigned int samples, int final);
105 extern void rubberband_process(RubberBandState, const float *const *input, unsigned int samples, int final);
106
107 extern int rubberband_available(const RubberBandState);
108 extern unsigned int rubberband_retrieve(const RubberBandState, float *const *output, unsigned int samples);
109
110 extern unsigned int rubberband_get_channel_count(const RubberBandState);
111
112 extern void rubberband_calculate_stretch(RubberBandState);
113
114 extern void rubberband_set_debug_level(RubberBandState, int level);
115 extern void rubberband_set_default_debug_level(int level);
116
117 #ifdef __cplusplus
118 }
119 #endif
120
121 #endif