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