> On 25.02.2016|KW8, at 03:43, Ross Bencina <rossb-li...@audiomulch.com> wrote:
> 
>> I'm surprised it's apparently so uncommon to implement a
>> callback interface for providing samples when resampling. It's the
>> really the natural thing to do.
> 

In a C-environment, it’s OK, it’s fast, no overhead, etc. However, in C++ in 
can be a bit clumsy, the syntax is a bit complex, but doable. An alternative in 
C++ is an abstract base class for the data source, an concrete instance is 
passed to the SRC. See below. 

Steffan 


class CSRC_DataSource
{
        public:
  
        virtual  ~CSRC_DataSource(){}
  
        virtual size_t          FillBuffer              (float* pfBuffer, 
size_t iMaxFrames){return 0;}         //      return the number of frames being 
written. 
};



class CSRC
{
        public:
  
        CSRC          ( double fSrcFs,
                        double fDstFs,
                        CSRC_DataSource* aClient);

        // other methods // 


};



_______________________________________________
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Reply via email to