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