//--------------------------------------
//               PowerUI
//
//        For documentation or 
//    if you have any issues, visit
//        powerUI.kulestar.com
//
//    Copyright © 2013 Kulestar Ltd
//          www.kulestar.com
//--------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;


namespace Speech{
	
	/// <summary>
	/// The synthesis engines.
	/// </summary>
	
	public static class SynthEngines{
		
		/// <summary>The available synth engines.</summary>
		public static Dictionary<string,SynthEngine> All;
		
		
		/// <summary>Adds a synthesis engine.</summary>
		public static void Add(SynthEngine engine){
			
			if(All==null){
				All=new Dictionary<string,SynthEngine>();
			}
			
			string[] types=engine.GetTypes();
			
			if(types==null){
				return;
			}
			
			for(int i=0;i<types.Length;i++){
				All[types[i].Trim().ToLower()]=engine;
			}
			
		}
		
		/// <summary>Gets the scripting engine for the given type (e.g. "text/sml").</summary>
		public static SynthEngine Get(string tag){
			
			if(All==null){
				return null;
			}
			
			SynthEngine engine;
			All.TryGetValue(tag.Trim().ToLower(),out engine);
			
			return engine;
			
		}
		
	}
	
}