summaryrefslogtreecommitdiff
path: root/src/sound
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-07-07 20:31:23 +0000
committerpeter1138 <peter1138@openttd.org>2007-07-07 20:31:23 +0000
commit2723db28844be0c3413e6e02aa11f0ecc9144ab0 (patch)
tree0bd6f98a4074b190b9e2d63d8410f76306430377 /src/sound
parent855e9d075101344079a8c7c66cbb25dc63eea7e1 (diff)
downloadopenttd-2723db28844be0c3413e6e02aa11f0ecc9144ab0.tar.xz
(svn r10471) -Codechange: implement driver probing priority so that 'preferred' drivers are loaded first
Diffstat (limited to 'src/sound')
-rw-r--r--src/sound/cocoa_s.h3
-rw-r--r--src/sound/null_s.h3
-rw-r--r--src/sound/sdl_s.h3
-rw-r--r--src/sound/sound_driver.hpp2
-rw-r--r--src/sound/win32_s.h3
5 files changed, 5 insertions, 9 deletions
diff --git a/src/sound/cocoa_s.h b/src/sound/cocoa_s.h
index 96e24522f..9ec6ac5cb 100644
--- a/src/sound/cocoa_s.h
+++ b/src/sound/cocoa_s.h
@@ -7,8 +7,6 @@
class SoundDriver_Cocoa: public SoundDriver {
public:
- /* virtual */ bool CanProbe() { return true; }
-
/* virtual */ const char *Start(const char * const *param);
/* virtual */ void Stop();
@@ -16,6 +14,7 @@ public:
class FSoundDriver_Cocoa: public SoundDriverFactory<FSoundDriver_Cocoa> {
public:
+ static const int priority = 10;
/* virtual */ const char *GetName() { return "cocoa"; }
/* virtual */ const char *GetDescription() { return "Cocoa Sound Driver"; }
/* virtual */ Driver *CreateInstance() { return new SoundDriver_Cocoa(); }
diff --git a/src/sound/null_s.h b/src/sound/null_s.h
index 2f5c79841..27b8d8980 100644
--- a/src/sound/null_s.h
+++ b/src/sound/null_s.h
@@ -7,8 +7,6 @@
class SoundDriver_Null: public SoundDriver {
public:
- /* virtual */ bool CanProbe() { return false; }
-
/* virtual */ const char *Start(const char * const *param) { return NULL; }
/* virtual */ void Stop() { }
@@ -16,6 +14,7 @@ public:
class FSoundDriver_Null: public SoundDriverFactory<FSoundDriver_Null> {
public:
+ static const int priority = 0;
/* virtual */ const char *GetName() { return "null"; }
/* virtual */ const char *GetDescription() { return "Null Sound Driver"; }
/* virtual */ Driver *CreateInstance() { return new SoundDriver_Null(); }
diff --git a/src/sound/sdl_s.h b/src/sound/sdl_s.h
index 97a9036eb..83edccc99 100644
--- a/src/sound/sdl_s.h
+++ b/src/sound/sdl_s.h
@@ -7,8 +7,6 @@
class SoundDriver_SDL: public SoundDriver {
public:
- /* virtual */ bool CanProbe() { return true; }
-
/* virtual */ const char *Start(const char * const *param);
/* virtual */ void Stop();
@@ -16,6 +14,7 @@ public:
class FSoundDriver_SDL: public SoundDriverFactory<FSoundDriver_SDL> {
public:
+ static const int priority = 5;
/* virtual */ const char *GetName() { return "sdl"; }
/* virtual */ const char *GetDescription() { return "SDL Sound Driver"; }
/* virtual */ Driver *CreateInstance() { return new SoundDriver_SDL(); }
diff --git a/src/sound/sound_driver.hpp b/src/sound/sound_driver.hpp
index de1a19ac8..04c9e9224 100644
--- a/src/sound/sound_driver.hpp
+++ b/src/sound/sound_driver.hpp
@@ -14,7 +14,7 @@ class SoundDriverFactoryBase: public DriverFactoryBase {
template <class T>
class SoundDriverFactory: public SoundDriverFactoryBase {
public:
- SoundDriverFactory() { this->RegisterDriver(((T *)this)->GetName(), Driver::DT_SOUND); }
+ SoundDriverFactory() { this->RegisterDriver(((T *)this)->GetName(), Driver::DT_SOUND, ((T *)this)->priority); }
/**
* Get the long, human readable, name for the Driver-class.
diff --git a/src/sound/win32_s.h b/src/sound/win32_s.h
index 820e6c74e..8fbd8b0c1 100644
--- a/src/sound/win32_s.h
+++ b/src/sound/win32_s.h
@@ -7,8 +7,6 @@
class SoundDriver_Win32: public SoundDriver {
public:
- /* virtual */ bool CanProbe() { return true; }
-
/* virtual */ const char *Start(const char * const *param);
/* virtual */ void Stop();
@@ -16,6 +14,7 @@ public:
class FSoundDriver_Win32: public SoundDriverFactory<FSoundDriver_Win32> {
public:
+ static const int priority = 10;
/* virtual */ const char *GetName() { return "win32"; }
/* virtual */ const char *GetDescription() { return "Win32 WaveOut Driver"; }
/* virtual */ Driver *CreateInstance() { return new SoundDriver_Win32(); }