Files
librubberband/rubberband/rubberband-c.h

160 lines
6.0 KiB
C
Raw Normal View History

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