btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / mediaplayer / media_node_framework / audio / AudioResampler.h
blob2b9821b6e0fa8f294645129e0f3018b9f9d413c8
1 /*
2 * Copyright 2000-2006 Ingo Weinhold <ingo_weinhold@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT licensce.
4 */
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
12 (time scale = -2).
16 #include "AudioReader.h"
19 class AudioResampler : public AudioReader {
20 public:
21 AudioResampler();
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;
45 private:
46 status_t _ReadLinear(void* buffer, int64 pos,
47 int64 frames);
49 private:
50 AudioReader* fSource;
51 float fTimeScale; // speed
52 int64 fInOffset;
55 #endif // AUDIO_RESAMPLER_H