Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

aflibAudio.h

Go to the documentation of this file.
00001 /*
00002  * Copyright: (C) 1999-2001 Bruce W. Forsberg
00003  *
00004  *   This library is free software; you can redistribute it and/or
00005  *   modify it under the terms of the GNU Lesser General Public
00006  *   License as published by the Free Software Foundation; either
00007  *   version 2.1 of the License, or any later version.
00008  *
00009  *   This library is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *   Lesser General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU Lesser General Public
00015  *   License along with this library; if not, write to the Free Software
00016  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00017  *
00018  *   Bruce Forsberg  forsberg@tns.net
00019  *
00020  */
00021 
00022 #ifndef _AFLIBAUDIO_H
00023 #define _AFLIBAUDIO_H
00024 
00025 #ifdef HAVE_CONFIG_H
00026 #include <config.h>
00027 #endif
00028 
00029 #include "aflib.h"
00030 #include "aflibChain.h"
00031 #include "aflibMemCache.h"
00032 #include "aflibConfig.h"
00033 
00034 #include <list>
00035 
00036 
00074 class aflibData;
00075 class aflibAudioSampleRateCvt;
00076 class aflibAudioMixer;
00077 
00078 
00079 class aflibAudio : public aflibChain, public aflibMemCache {
00080 
00081 public:
00082 
00083    virtual
00084    ~aflibAudio();
00085 
00086    void
00087    enable(bool enable);
00088 
00089    bool
00090    getEnable() const;
00091 
00092    void
00093    enableDataSizeConversion(bool enable);
00094 
00095    void
00096    enableEndianConversion(bool enable);
00097 
00098    void
00099    enableSampleRateConversion(bool enable);
00100 
00101    void
00102    enableChannelsConversion(bool enable);
00103 
00104    virtual void
00105    setInputConfig(const aflibConfig& cfg);
00106 
00107    virtual const aflibConfig&
00108    getInputConfig() const;
00109 
00110    virtual void
00111    setOutputConfig(const aflibConfig& cfg);
00112 
00113    virtual const aflibConfig&
00114    getOutputConfig() const;
00115 
00117    virtual const char *
00118    getName() const { return "aflibAudio";};
00119 
00121    virtual aflibStatus
00122    compute_segment(
00123       list<aflibData *>& ,
00124       long long ){ return AFLIB_SUCCESS;};
00125 
00126    virtual aflibData *
00127    process(
00128       aflibStatus& ret_status,
00129       long long position,
00130       int& num_samples,
00131       bool free_memory = TRUE);
00132 
00133 protected:
00134 
00135    aflibAudio();
00136    aflibAudio(aflibAudio& audio);
00137 
00138    aflibAudio* 
00139    convertSampleRate(aflibAudio&  parent);
00140 
00141    aflibAudio* 
00142    convertChannels(aflibAudio&  parent);
00143 
00144    void
00145    convertData(aflibData& data);
00146 
00147    void
00148    examineChain();
00149 
00150    bool
00151    checkChain(const aflibAudio * audio) const;
00152 
00153    void
00154    preprocessChain(
00155       aflibAudio * audio,
00156       aflibAudio * child);
00157 
00158    // "is" functions that indicate what formats an object supports
00159    virtual bool
00160    isDataSizeSupported(aflib_data_size size);
00161 
00162    virtual bool
00163    isEndianSupported(aflib_data_endian end);
00164 
00165    virtual bool
00166    isSampleRateSupported(int& rate);
00167 
00168    virtual bool
00169    isChannelsSupported(int& channels);
00170 
00171    inline void
00172    incrementLevel() {_level++;};
00173 
00174    inline void
00175    decrementLevel() {_level--;};
00176 
00177 private:
00178 
00179 bool     _enable;
00180 bool     _enable_data_size;
00181 bool     _enable_endian;
00182 bool     _enable_sample_rate;
00183 bool     _enable_channels;
00184 aflibConfig _cfg_input;
00185 aflibConfig _cfg_output;
00186 aflibAudioSampleRateCvt  * _cvt;
00187 aflibAudioMixer  * _mix;
00188 static int  _level;
00189 
00190 };
00191 
00192 
00193 #endif

Generated on Wed May 8 20:51:04 2002 for Open Source Audio Library Project by doxygen1.2.15