17 const char *
GetDriverParam(
const char *
const *parm,
const char *name);
29 virtual const char *
Start(
const char *
const *parm) = 0;
34 virtual void Stop() = 0;
51 virtual const char *
GetName()
const = 0;
69 typedef std::map<const char *, DriverFactoryBase *, StringCompare>
Drivers;
76 static Drivers &s_drivers = *
new Drivers();
87 static Driver *s_driver[3] = {
nullptr,
nullptr,
nullptr };
88 return &s_driver[type];
98 static const char *
const driver_type_name[] = {
"music",
"sound",
"video" };
99 return driver_type_name[type];
102 static bool SelectDriverImpl(
const char *name,
Driver::Type type);
105 DriverFactoryBase(
Driver::Type type,
int priority,
const char *name,
const char *description);
107 virtual ~DriverFactoryBase();
116 Driver *driver = *GetActiveDriver(dt);
117 if (driver !=
nullptr) driver->
Stop();
121 static void SelectDriver(
const char *name,
Driver::Type type);
122 static char *GetDriversInfo(
char *p,
const char *last);
130 return this->description;
137 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.
#define DECLARE_POSTFIX_INCREMENT(enum_type)
Some enums need to have allowed incrementing (i.e.
const char * GetDescription() const
Get a nice description of the driver-class.
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.