2 * Copyright 2000-2006 Ingo Weinhold <ingo_weinhold@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT licensce.
5 #ifndef AUDIO_RESAMPLER_H
6 #define AUDIO_RESAMPLER_H
9 /*! This AudioReader does both resampling an audio source to a different
10 sample rate and rescaling the time, e.g. it is possible to convert the
11 source data from 41.1 KHz to 96 KHz played backward twice as fast
16 #include "AudioReader.h"
19 class AudioResampler
: public AudioReader
{
22 AudioResampler(AudioReader
* source
,
23 float frameRate
, float timeScale
= 1.0);
24 virtual ~AudioResampler();
26 virtual bigtime_t
InitialLatency() const;
27 virtual status_t
Read(void* buffer
, int64 pos
, int64 frames
);
29 virtual status_t
InitCheck() const;
31 void SetSource(AudioReader
* source
);
32 void SetFrameRate(float frameRate
);
33 void SetTimeScale(float timeScale
);
35 AudioReader
* Source() const;
36 float FrameRate() const;
37 float TimeScale() const;
39 void SetInOffset(int64 offset
);
40 int64
InOffset() const;
42 int64
ConvertFromSource(int64 pos
) const;
43 int64
ConvertToSource(int64 pos
) const;
46 status_t
_ReadLinear(void* buffer
, int64 pos
,
51 float fTimeScale
; // speed
55 #endif // AUDIO_RESAMPLER_H