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