/[svn]/linuxsampler/trunk/src/drivers/audio/AudioOutputDeviceFactory.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/audio/AudioOutputDeviceFactory.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 200 by schoenebeck, Tue Jul 13 22:04:16 2004 UTC revision 1248 by persson, Fri Jun 22 10:10:06 2007 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6     *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 26  Line 27 
27  #include <map>  #include <map>
28  #include <vector>  #include <vector>
29    
30  #include "../../common/LinuxSamplerException.h"  #include "../../common/Exception.h"
31  #include "../DeviceParameterFactory.h"  #include "../DeviceParameterFactory.h"
32  #include "AudioOutputDevice.h"  #include "AudioOutputDevice.h"
33    
# Line 56  namespace LinuxSampler { Line 57  namespace LinuxSampler {
57            class InnerFactoryRegistrator {            class InnerFactoryRegistrator {
58                public:                public:
59                    InnerFactoryRegistrator() {                    InnerFactoryRegistrator() {
60                        AudioOutputDeviceFactory::InnerFactories[Driver_T::Name()] = new InnerFactoryTemplate<Driver_T>;                        AudioOutputDeviceFactory::InnerFactories[Driver_T::Name()] = new AudioOutputDeviceFactory::InnerFactoryTemplate<Driver_T>;
61                        AudioOutputDeviceFactory::ParameterFactories[Driver_T::Name()] = new DeviceParameterFactory();                        AudioOutputDeviceFactory::ParameterFactories[Driver_T::Name()] = new DeviceParameterFactory();
62                    }                    }
63                      ~InnerFactoryRegistrator() {
64                          std::map<String, InnerFactory*>::iterator iter = AudioOutputDeviceFactory::InnerFactories.find(Driver_T::Name());
65                          delete iter->second;
66                          AudioOutputDeviceFactory::InnerFactories.erase(iter);
67    
68                          std::map<String, DeviceParameterFactory*>::iterator iterpf = AudioOutputDeviceFactory::ParameterFactories.find(Driver_T::Name());
69                          delete iterpf->second;
70                          AudioOutputDeviceFactory::ParameterFactories.erase(iterpf);
71                      }
72            };            };
73    
74            template <class Driver_T, class Parameter_T>            template <class Driver_T, class Parameter_T>
75            class ParameterRegistrator {            class ParameterRegistrator {
76                public:                public:
77                    ParameterRegistrator() {                    ParameterRegistrator() {
78                            DeviceParameterFactory::Register<Parameter_T>(AudioOutputDeviceFactory::ParameterFactories[Driver_T::Name()]);                        DeviceParameterFactory::Register<Parameter_T>(AudioOutputDeviceFactory::ParameterFactories[Driver_T::Name()]);
79                    }                    }
80                      ~ParameterRegistrator() {
81                          DeviceParameterFactory::Unregister<Parameter_T>(AudioOutputDeviceFactory::ParameterFactories[Driver_T::Name()]);
82                      }
83            };            };
84    
85            static AudioOutputDevice*                        Create(String DriverName, std::map<String,String> Parameters) throw (LinuxSamplerException);            static AudioOutputDevice*                        Create(String DriverName, std::map<String,String> Parameters) throw (Exception);
86            static std::vector<String>                       AvailableDrivers();            static std::vector<String>                       AvailableDrivers();
87            static String                                    AvailableDriversAsString();            static String                                    AvailableDriversAsString();
88            static std::map<String,DeviceCreationParameter*> GetAvailableDriverParameters(String DriverName) throw (LinuxSamplerException);            static std::map<String,DeviceCreationParameter*> GetAvailableDriverParameters(String DriverName) throw (Exception);
89            static DeviceCreationParameter*                  GetDriverParameter(String DriverName, String ParameterName) throw (LinuxSamplerException);            static DeviceCreationParameter*                  GetDriverParameter(String DriverName, String ParameterName) throw (Exception);
90            static String                                    GetDriverDescription(String DriverName) throw (LinuxSamplerException);            static String                                    GetDriverDescription(String DriverName) throw (Exception);
91            static String                                    GetDriverVersion(String DriverName) throw (LinuxSamplerException);            static String                                    GetDriverVersion(String DriverName) throw (Exception);
92    
93        protected:  //      protected: /* FIXME: fields below should be protected, causes errors on gcc 2.95 though */
94            static std::map<String, InnerFactory*> InnerFactories;            static std::map<String, InnerFactory*> InnerFactories;
95            static std::map<String, DeviceParameterFactory*> ParameterFactories;            static std::map<String, DeviceParameterFactory*> ParameterFactories;
96    };    };

Legend:
Removed from v.200  
changed lines
  Added in v.1248

  ViewVC Help
Powered by ViewVC