All pastes #437494 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-13 02:06 UTC
rendered paste body
#ifndef MyProcessing_hxx
#define MyProcessing_hxx

#include <CLAM/InPort.hxx>
#include <CLAM/OutPort.hxx>
#include <CLAM/Processing.hxx>
#include <CLAM/NullProcessingConfig.hxx>

// Those two configuration types could be the ones you choose.
// Your own ones or any type already in CLAM.
#include "MonoAudioFileReader.hxx"
#include "AudioSink.hxx"

class MyProcessing : public CLAM::Processing
{ 
	CLAM::InPort<CLAM::MonoAudioFileReader> mIn;
	CLAM::OutPort<CLAM::AudioSink> mOut;
	typedef CLAM::NullProcessingConfig Config;
public:
	const char* GetClassName() const { return "MyProcessing"; }
	MyProcessing(const Config & config=Config()) 
		: mIn("CLAM::MonoAudioFileReader", this)
		, mOut("CLAM::AudioSink", this) 
	{
		Configure( config );
	}
 
	~MyProcessing() {}

	// Configuration to the minimal expression
	bool ConcreteConfigure(const CLAM::ProcessingConfig&)
	{
		return true; // I got proper configuration
	}
	const CLAM::ProcessingConfig& GetConfig() const
	{
		static Config config;
		return config;
	}
	
	bool Do()
	{
		bool result = Do(mIn.GetData(), mOut.GetData()); 
		// Tell the ports this is done
		mIn.Consume();
		mOut.Produce();
		return result;
	}

	bool Do(const CLAM::MonoAudioFileReader& in, CLAM::AudioSink& out)
	{
		// Your implementation
	}
};
#endif // MyProcessing_hxx