00001 #ifndef TIMESTRETCHENGINE_H 00002 #define TIMESTRETCHENGINE_H 00003 00004 00005 #include <stdint.h> 00006 00007 00008 class TimeStretchEngine 00009 { 00010 public: 00011 // scale = out length / in length 00012 TimeStretchEngine(double scale, int sample_rate); 00013 ~TimeStretchEngine(); 00014 00015 void overlay(double *out, double *in, int size, int skirt); 00016 // Returns the number of samples in the output buffer 00017 int process(double *in_buffer, int in_size); 00018 // Return the output buffer 00019 double* get_samples(); 00020 // Increment output buffer counters and shift output 00021 void read_output(double *buffer, int size); 00022 00023 private: 00024 // ms length of average window 00025 int window_time; 00026 int sample_rate; 00027 int window_size; 00028 // Queer eye for the straight buffer 00029 int window_skirt; 00030 double *output; 00031 int output_allocation; 00032 int output_size; 00033 // Sample at beginning of output buffer 00034 int64_t output_sample; 00035 double *input; 00036 int input_allocation; 00037 int input_size; 00038 // Sample at beginning of input buffer 00039 int64_t input_sample; 00040 double scale; 00041 }; 00042 00043 00044 00045 00046 00047 #endif 00048 00049 00050
1.5.5