aflibAudioSampleRateCvt.h

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 
00023 #ifndef _AFLIBAUDIOSAMPLERATECVT_H_
00024 #define _AFLIBAUDIOSAMPLERATECVT_H_
00025 
00026 #ifdef HAVE_CONFIG_H
00027 #include <config.h>
00028 #endif
00029 
00030 
00031 #include "aflibAudio.h"
00032 #include "aflibConverter.h"
00033 
00034 
00047 class aflibAudioSampleRateCvt : public aflibAudio {
00048 
00049 public:
00050 
00051    // Available contructors and destructors
00052    aflibAudioSampleRateCvt(
00053       aflibAudio& audio, 
00054       double factor,
00055       bool  linear_interpolation = FALSE,
00056       bool  high_quality = FALSE,
00057       bool  filter_interpolation = FALSE);
00058 
00059    ~aflibAudioSampleRateCvt();
00060 
00061    void
00062    setFactor(
00063       double factor,
00064       double volume = 1.0);
00065 
00066    void
00067    setInputConfig(const aflibConfig& cfg);
00068 
00070    const char *
00071    getName() const { return "aflibAudioSampleRateCvt";};
00072 
00073    aflibStatus
00074    compute_segment(
00075       list<aflibData*>& data,
00076       long long position = -1) ;
00077 
00078    aflibData *
00079    process(
00080       aflibStatus& ret_status,
00081       long long position,
00082       int& num_samples,
00083       bool free_memory = TRUE) ;
00084 
00085    bool
00086    isDataSizeSupported(aflib_data_size size);
00087 
00088     bool
00089     isChannelsSupported(int& channels);
00090 
00091 private:
00092 
00093    aflibAudioSampleRateCvt();
00094 
00095    aflibAudioSampleRateCvt(const aflibAudioSampleRateCvt& op);
00096 
00097    const aflibAudioSampleRateCvt&
00098    operator=(const aflibAudioSampleRateCvt& op);
00099 
00100 
00101 int     _extra_sample;
00102 int     _output_samples;
00103 int     _requested_samples;
00104 aflibConverter  * _converter;
00105 double  _factor;
00106 bool    _initial;
00107 int     _init_chan;
00108 short  *_in_array;
00109 int     _in_array_size;
00110 short  *_out_array;
00111 int     _out_array_size;
00112 double  _vol;
00113 
00114 // These factors are used for buffering audio data so that we can get
00115 // the audio data as a stream from the parent
00116 long long _next_output_position;
00117 long long _next_input_position;
00118 int       _save_samples;
00119 int       _prev_in_count;
00120 
00121 
00122 
00123 };
00124 
00125 
00126 #endif

Generated on Tue Jan 16 12:42:55 2007 for Open Source Audio Library Project by  doxygen 1.4.6