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