#define BLACKSIZE 25
#include "resample.inc"
-#include "samples.inc"
+#include "samples.h"
#include <stdint.h>
class Resample
// All positions are in file sample rate
// This must reverse the buffer during reverse playback
// so the filter always renders forward.
- virtual int read_samples(Samples *buffer, int64_t start, int64_t len);
+ virtual int read_samples(Samples *buffer,
+ int64_t start, int64_t len, int direction);
// Resample from the file handler and store in *output.
// Returns 1 if the input reader failed.
- int resample(Samples *samples,
- int64_t out_len,
- int in_rate,
- int out_rate,
// Starting sample in output samplerate
// If reverse, the end of the buffer.
- int64_t out_position,
- int direction);
-
- int get_direction();
-
+ int resample(Samples *samples,
+ int64_t out_len, int in_rate, int out_rate,
+ int64_t out_position, int direction);
static void reverse_buffer(double *buffer, int64_t len);
// Reset after seeking
void reset();
private:
- double blackman(int i, double offset, double fcn, int l);
+ void blackman(double fcn, int l);
+ int set_input_position(int64_t in_pos, int in_dir);
// Query output temp
int get_output_size();
// void read_output(Samples *output, int size);
// Resamples input and dumps it to output_temp
- void resample_chunk(Samples *input,
- int64_t in_len,
- int in_rate,
- int out_rate);
- int read_chunk(Samples *input,
- int64_t len);
-
-// History buffer for resampling.
- double *old;
- double itime;
-
-
+ void resample_chunk(Samples *input, int64_t in_len,
+ int in_rate, int out_rate);
+ int direction;
// Unaligned resampled output
double *output_temp;
-
-
// Total samples in unaligned output
int64_t output_size;
-
- int direction;
// Allocation of unaligned output
int64_t output_allocation;
+// History buffer for resampling.
+ Samples old;
// input chunk
Samples *input;
+ double itime;
// Position of source in source sample rate.
int64_t input_position;
int64_t input_size;