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_ADAPTER_H
6#define AUDIO_ADAPTER_H
7
8
9/*! This AudioReader slaves an AudioConverter and an AudioResampler
10	to convert the source data to a given format.
11	At this time the number of channels cannot be changed and the output
12	format byte order is set to the one of the host.
13	If input and output format are the same, the overhead is quit small.
14*/
15
16
17#include "AudioReader.h"
18
19
20class AudioChannelConverter;
21class AudioFormatConverter;
22class AudioResampler;
23
24
25class AudioAdapter : public AudioReader {
26public:
27								AudioAdapter(AudioReader* source,
28									const media_format& format);
29	virtual						~AudioAdapter();
30
31	virtual bigtime_t			InitialLatency() const;
32	virtual	status_t			Read(void* buffer, int64 pos, int64 frames);
33
34	virtual	status_t			InitCheck() const;
35
36			AudioReader*		Source() const;
37
38protected:
39			void				_ConvertChannels(void* buffer,
40									int64 frames) const;
41
42			AudioReader*		fSource;
43			AudioReader*		fFinalConverter;
44			AudioFormatConverter* fFormatConverter;
45			AudioChannelConverter* fChannelConverter;
46			AudioResampler*		fResampler;
47};
48
49#endif	// AUDIO_ADAPTER_H
50