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