Ian Brabham - 2013-04-03

The Avisynth plugin api already supports audio processing with the GetAudio() method of the IClip interface. There is also a standard ConvertAudio inbuilt that will automatically convert any supported input format to a format that the filter can successfully process.

There are existing plugins that can load and run Sox and Bass audio plugins, I see no immediate impediment to writing a similar plugin to support VST plugins.

// instantiable null filter
class GenericVideoFilter : public IClip {
protected:
PClip child;
VideoInfo vi;
public:
GenericVideoFilter(PClip _child) : child(_child) { vi = child->GetVideoInfo(); }
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) { return child->GetFrame(n, env); }

void __stdcall GetAudio(void* buf, __int64 start, __int64 count, IScriptEnvironment* env) { child->GetAudio(buf, start, count, env); }

const VideoInfo& __stdcall GetVideoInfo() { return vi; }
bool __stdcall GetParity(int n) { return child->GetParity(n); }
int __stdcall SetCacheHints(int cachehints,int frame_range) { return 0; };
};

and

class ConvertAudio : public GenericVideoFilter
/**
* Helper class to convert audio to any format
**/
{
public:
ConvertAudio(PClip _clip, int prefered_format);
void __stdcall GetAudio(void* buf, __int64 start, __int64 count, IScriptEnvironment* env);
int __stdcall SetCacheHints(int cachehints,int frame_range); // We do pass cache requests upwards, to the cache!

static PClip Create(PClip clip, int sample_type, int prefered_type);
....