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