00001 #include <stdlib.h>
00002 #include <stdio.h>
00003 #include "types.h"
00004
00005 #ifdef DEBUGMODE
00006
00007 #ifndef ASSERT
00008 #include <assert.h>
00009 #define ASSERT(n) assert(n)
00010 #endif
00011 #ifndef TRACE
00012
00013 #define TRACE 1 ? (void)0 : (void)printf
00014 #endif
00015
00016 #else
00017
00018 #ifndef ASSERT
00019 #define ASSERT(n)
00020 #endif
00021 #ifndef TRACE
00022 #define TRACE 1 ? (void)0 : (void)printf
00023 #endif
00024
00025 #endif
00026
00027 typedef audiere::s64 LONG_LONG;
00028
00029
00030 namespace audiere {
00031
00032 typedef int sample_t;
00033
00034 #define DUMB_RQ_ALIASING 0
00035 #define DUMB_RQ_LINEAR 1
00036 #define DUMB_RQ_CUBIC 2
00037 #define DUMB_RQ_N_LEVELS 3
00038 extern int dumb_resampling_quality;
00039
00040 typedef struct DUMB_RESAMPLER DUMB_RESAMPLER;
00041
00042 typedef void (*DUMB_RESAMPLE_PICKUP)(DUMB_RESAMPLER *resampler, void *data);
00043
00044 struct DUMB_RESAMPLER
00045 {
00046 sample_t *src;
00047 long pos;
00048 int subpos;
00049 long start, end;
00050 int dir;
00051 DUMB_RESAMPLE_PICKUP pickup;
00052 void *pickup_data;
00053 int min_quality;
00054 int max_quality;
00055
00056 sample_t x[3];
00057 int overshot;
00058 };
00059
00060 void dumb_reset_resampler(DUMB_RESAMPLER *resampler, sample_t *src, long pos, long start, long end);
00061 DUMB_RESAMPLER *dumb_start_resampler(sample_t *src, long pos, long start, long end);
00062 long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume, float delta);
00063 sample_t dumb_resample_get_current_sample(DUMB_RESAMPLER *resampler, float volume);
00064 void dumb_end_resampler(DUMB_RESAMPLER *resampler);
00065
00066 }