19 const char *
GetDriverParam(
const char *
const *parm,
const char *name);
31 virtual const char *
Start(
const char *
const *parm) = 0;
36 virtual void Stop() = 0;
53 virtual const char *
GetName()
const = 0;
71 typedef std::map<const char *, DriverFactoryBase *, StringCompare>
Drivers;
78 static Drivers &s_drivers = *
new Drivers();
89 static Driver *s_driver[3] = { NULL, NULL, NULL };
90 return &s_driver[type];
100 static const char *
const driver_type_name[] = {
"music",
"sound",
"video" };
101 return driver_type_name[type];
104 static bool SelectDriverImpl(
const char *name,
Driver::Type type);
107 DriverFactoryBase(
Driver::Type type,
int priority,
const char *name,
const char *description);
109 virtual ~DriverFactoryBase();
118 Driver *driver = *GetActiveDriver(dt);
119 if (driver != NULL) driver->
Stop();
123 static void SelectDriver(
const char *name,
Driver::Type type);
124 static char *GetDriversInfo(
char *p,
const char *last);
132 return this->description;
139 virtual Driver *CreateInstance()
const = 0;
static Drivers & GetDrivers()
Get the map with drivers.
static Driver ** GetActiveDriver(Driver::Type type)
Get the active driver for the given type.
int GetDriverParamInt(const char *const *parm, const char *name, int def)
Get an integer parameter the list of parameters.
static const char * GetDriverTypeName(Driver::Type type)
Get the driver type name.
static void ShutdownDrivers()
Shuts down all active drivers.
Base for all sound drivers.
Type (helpers) for enums.
int priority
The priority of this factory.
A music driver, needs to be before sound to properly shut down extmidi forked music players...
const char * description
The description of this driver.
virtual void Stop()=0
Stop this driver.
virtual const char * Start(const char *const *parm)=0
Start this driver.
Driver::Type type
The type of driver.
Base for all driver factories.
bool GetDriverParamBool(const char *const *parm, const char *name)
Get a boolean parameter the list of parameters.
virtual const char * GetName() const =0
Get the name of this driver.
const char * GetDriverParam(const char *const *parm, const char *name)
Get a string parameter the list of parameters.
A driver for communicating with the user.
Comparator class for "const char *" so it can be used as a key for std::map.
The base of all video drivers.
const char * GetDescription() const
Get a nice description of the driver-class.
#define DECLARE_POSTFIX_INCREMENT(type)
Some enums need to have allowed incrementing (i.e.
std::map< const char *, DriverFactoryBase *, StringCompare > Drivers
Type for a map of drivers.
Driver for all music playback.
const char * name
The name of the drivers of this factory.