cannam@130: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ cannam@130: cannam@130: /* cannam@130: Rubber Band Library cannam@130: An audio time-stretching and pitch-shifting library. cannam@130: Copyright 2007-2015 Particular Programs Ltd. cannam@130: cannam@130: This program is free software; you can redistribute it and/or cannam@130: modify it under the terms of the GNU General Public License as cannam@130: published by the Free Software Foundation; either version 2 of the cannam@130: License, or (at your option) any later version. See the file cannam@130: COPYING included with this distribution for more information. cannam@130: cannam@130: Alternatively, if you have a valid commercial licence for the cannam@130: Rubber Band Library obtained by agreement with the copyright cannam@130: holders, you may redistribute and/or modify it under the terms cannam@130: described in that licence. cannam@130: cannam@130: If you wish to distribute code using the Rubber Band Library cannam@130: under terms other than those of the GNU General Public License, cannam@130: you must obtain a valid commercial licence before doing so. cannam@130: */ cannam@130: cannam@130: #ifndef _RUBBERBAND_C_API_H_ cannam@130: #define _RUBBERBAND_C_API_H_ cannam@130: cannam@130: #ifdef __cplusplus cannam@130: extern "C" { cannam@130: #endif cannam@130: cannam@130: #define RUBBERBAND_VERSION "1.8.2" cannam@130: #define RUBBERBAND_API_MAJOR_VERSION 2 cannam@130: #define RUBBERBAND_API_MINOR_VERSION 5 cannam@130: cannam@130: /** cannam@130: * This is a C-linkage interface to the Rubber Band time stretcher. cannam@130: * cannam@130: * This is a wrapper interface: the primary interface is in C++ and is cannam@130: * defined and documented in RubberBandStretcher.h. The library cannam@130: * itself is implemented in C++, and requires C++ standard library cannam@130: * support even when using the C-linkage API. cannam@130: * cannam@130: * Please see RubberBandStretcher.h for documentation. cannam@130: * cannam@130: * If you are writing to the C++ API, do not include this header. cannam@130: */ cannam@130: cannam@130: enum RubberBandOption { cannam@130: cannam@130: RubberBandOptionProcessOffline = 0x00000000, cannam@130: RubberBandOptionProcessRealTime = 0x00000001, cannam@130: cannam@130: RubberBandOptionStretchElastic = 0x00000000, cannam@130: RubberBandOptionStretchPrecise = 0x00000010, cannam@130: cannam@130: RubberBandOptionTransientsCrisp = 0x00000000, cannam@130: RubberBandOptionTransientsMixed = 0x00000100, cannam@130: RubberBandOptionTransientsSmooth = 0x00000200, cannam@130: cannam@130: RubberBandOptionDetectorCompound = 0x00000000, cannam@130: RubberBandOptionDetectorPercussive = 0x00000400, cannam@130: RubberBandOptionDetectorSoft = 0x00000800, cannam@130: cannam@130: RubberBandOptionPhaseLaminar = 0x00000000, cannam@130: RubberBandOptionPhaseIndependent = 0x00002000, cannam@130: cannam@130: RubberBandOptionThreadingAuto = 0x00000000, cannam@130: RubberBandOptionThreadingNever = 0x00010000, cannam@130: RubberBandOptionThreadingAlways = 0x00020000, cannam@130: cannam@130: RubberBandOptionWindowStandard = 0x00000000, cannam@130: RubberBandOptionWindowShort = 0x00100000, cannam@130: RubberBandOptionWindowLong = 0x00200000, cannam@130: cannam@130: RubberBandOptionSmoothingOff = 0x00000000, cannam@130: RubberBandOptionSmoothingOn = 0x00800000, cannam@130: cannam@130: RubberBandOptionFormantShifted = 0x00000000, cannam@130: RubberBandOptionFormantPreserved = 0x01000000, cannam@130: cannam@130: RubberBandOptionPitchHighQuality = 0x00000000, cannam@130: RubberBandOptionPitchHighSpeed = 0x02000000, cannam@130: RubberBandOptionPitchHighConsistency = 0x04000000, cannam@130: cannam@130: RubberBandOptionChannelsApart = 0x00000000, cannam@130: RubberBandOptionChannelsTogether = 0x10000000, cannam@130: }; cannam@130: cannam@130: typedef int RubberBandOptions; cannam@130: cannam@130: struct RubberBandState_; cannam@130: typedef struct RubberBandState_ *RubberBandState; cannam@130: cannam@130: extern RubberBandState rubberband_new(unsigned int sampleRate, cannam@130: unsigned int channels, cannam@130: RubberBandOptions options, cannam@130: double initialTimeRatio, cannam@130: double initialPitchScale); cannam@130: cannam@130: extern void rubberband_delete(RubberBandState); cannam@130: cannam@130: extern void rubberband_reset(RubberBandState); cannam@130: cannam@130: extern void rubberband_set_time_ratio(RubberBandState, double ratio); cannam@130: extern void rubberband_set_pitch_scale(RubberBandState, double scale); cannam@130: cannam@130: extern double rubberband_get_time_ratio(const RubberBandState); cannam@130: extern double rubberband_get_pitch_scale(const RubberBandState); cannam@130: cannam@130: extern unsigned int rubberband_get_latency(const RubberBandState); cannam@130: cannam@130: extern void rubberband_set_transients_option(RubberBandState, RubberBandOptions options); cannam@130: extern void rubberband_set_detector_option(RubberBandState, RubberBandOptions options); cannam@130: extern void rubberband_set_phase_option(RubberBandState, RubberBandOptions options); cannam@130: extern void rubberband_set_formant_option(RubberBandState, RubberBandOptions options); cannam@130: extern void rubberband_set_pitch_option(RubberBandState, RubberBandOptions options); cannam@130: cannam@130: extern void rubberband_set_expected_input_duration(RubberBandState, unsigned int samples); cannam@130: cannam@130: extern unsigned int rubberband_get_samples_required(const RubberBandState); cannam@130: cannam@130: extern void rubberband_set_max_process_size(RubberBandState, unsigned int samples); cannam@130: extern void rubberband_set_key_frame_map(RubberBandState, unsigned int keyframecount, unsigned int *from, unsigned int *to); cannam@130: cannam@130: extern void rubberband_study(RubberBandState, const float *const *input, unsigned int samples, int final); cannam@130: extern void rubberband_process(RubberBandState, const float *const *input, unsigned int samples, int final); cannam@130: cannam@130: extern int rubberband_available(const RubberBandState); cannam@130: extern unsigned int rubberband_retrieve(const RubberBandState, float *const *output, unsigned int samples); cannam@130: cannam@130: extern unsigned int rubberband_get_channel_count(const RubberBandState); cannam@130: cannam@130: extern void rubberband_calculate_stretch(RubberBandState); cannam@130: cannam@130: extern void rubberband_set_debug_level(RubberBandState, int level); cannam@130: extern void rubberband_set_default_debug_level(int level); cannam@130: cannam@130: #ifdef __cplusplus cannam@130: } cannam@130: #endif cannam@130: cannam@130: #endif