view sv/filter/RealTimeFilterFactory.cpp @ 79:afcf540ae3a2

add the real time filter stack to manage real time filters and their attributes
author lbajardsilogic
date Tue, 19 Jun 2007 15:15:12 +0000
parents
children 8ebc85f6ce4e
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */

/*	Sound Access	
		EASAIER client application.	
		Silogic 2007. Laure Bajard. 
	
	This program is free software; you can redistribute it and/or    
	modify it under the terms of the GNU General Public License as    
	published by the Free Software Foundation; either version 2 of the    
	License, or (at your option) any later version.  See the file    
	COPYING included with this distribution for more information.
*/
 
#include "RealTimeFilterFactory.h"

#include "TimeStretchFilter.h"

#include <iostream>

RealTimeFilterFactory * RealTimeFilterFactory::m_instance = new RealTimeFilterFactory;

RealTimeFilterFactory * RealTimeFilterFactory::getInstance()
{
    return m_instance;
}

RealTimeFilterFactory::RealTimeFilterFactory() 
{}

RealTimeFilterFactory::~RealTimeFilterFactory()
{}

RealTimeFilterFactory::FilterTypeSet RealTimeFilterFactory::getFilterTypes()
{
	FilterTypeSet types;

	types.insert(TimeStretch);
	
	return types;
}

QString RealTimeFilterFactory::getFilterLabel(FilterType type)
{
	switch (type) {
		case TimeStretch: return "Time Stretching";
		default: return "unknown";
    }
}

RealTimeFilterFactory::FilterType RealTimeFilterFactory::getFilterType(QString strType)
{
	if (strType == "Time Stretching") {
		return TimeStretch;
    }
	else
	{
		return UnknownFilter;
	}
}

Filter * RealTimeFilterFactory::createFilter(FilterType type)
{
    Filter *filter = 0;

    switch (type) {

		case TimeStretch:
		filter = new TimeStretchFilter;
		break;

	    default: break;
    }

    if (!filter) {
		std::cerr << "RealTimeFilterFactory::createFilter: Unknown filter type " << type << std::endl;
    } else {
		filter->setObjectName(getFilterLabel(type));
    }

    return filter;
}