diff options
author | peter1138 <peter1138@openttd.org> | 2007-07-07 20:31:23 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-07-07 20:31:23 +0000 |
commit | 2723db28844be0c3413e6e02aa11f0ecc9144ab0 (patch) | |
tree | 0bd6f98a4074b190b9e2d63d8410f76306430377 /src/music | |
parent | 855e9d075101344079a8c7c66cbb25dc63eea7e1 (diff) | |
download | openttd-2723db28844be0c3413e6e02aa11f0ecc9144ab0.tar.xz |
(svn r10471) -Codechange: implement driver probing priority so that 'preferred' drivers are loaded first
Diffstat (limited to 'src/music')
-rw-r--r-- | src/music/bemidi.h | 3 | ||||
-rw-r--r-- | src/music/dmusic.h | 3 | ||||
-rw-r--r-- | src/music/extmidi.h | 3 | ||||
-rw-r--r-- | src/music/libtimidity.h | 3 | ||||
-rw-r--r-- | src/music/music_driver.hpp | 2 | ||||
-rw-r--r-- | src/music/null_m.h | 3 | ||||
-rw-r--r-- | src/music/os2_m.h | 3 | ||||
-rw-r--r-- | src/music/qtmidi.h | 3 | ||||
-rw-r--r-- | src/music/win32_m.h | 3 |
9 files changed, 9 insertions, 17 deletions
diff --git a/src/music/bemidi.h b/src/music/bemidi.h index 623d6398d..096249c24 100644 --- a/src/music/bemidi.h +++ b/src/music/bemidi.h @@ -7,8 +7,6 @@ class MusicDriver_BeMidi: public MusicDriver { public: - /* virtual */ bool CanProbe() { return true; } - /* virtual */ const char *Start(const char * const *param); /* virtual */ void Stop(); @@ -24,6 +22,7 @@ public: class FMusicDriver_BeMidi: public MusicDriverFactory<FMusicDriver_BeMidi> { public: + static const int priority = 10; /* virtual */ const char *GetName() { return "bemidi"; } /* virtual */ const char *GetDescription() { return "BeOS MIDI Driver"; } /* virtual */ Driver *CreateInstance() { return new MusicDriver_BeMidi(); } diff --git a/src/music/dmusic.h b/src/music/dmusic.h index 9bfb1bb1c..6fed3beea 100644 --- a/src/music/dmusic.h +++ b/src/music/dmusic.h @@ -7,8 +7,6 @@ class MusicDriver_DMusic: public MusicDriver { public: - /* virtual */ bool CanProbe() { return true; } - /* virtual */ const char *Start(const char * const *param); /* virtual */ void Stop(); @@ -24,6 +22,7 @@ public: class FMusicDriver_DMusic: public MusicDriverFactory<FMusicDriver_DMusic> { public: + static const int priorty = 10; /* virtual */ const char *GetName() { return "dmusic"; } /* virtual */ const char *GetDescription() { return "DirectMusic MIDI Driver"; } /* virtual */ Driver *CreateInstance() { return new MusicDriver_DMusic(); } diff --git a/src/music/extmidi.h b/src/music/extmidi.h index 4f62641b4..d5fa2ba2f 100644 --- a/src/music/extmidi.h +++ b/src/music/extmidi.h @@ -14,8 +14,6 @@ private: void DoStop(); public: - /* virtual */ bool CanProbe() { return true; } - /* virtual */ const char *Start(const char * const *param); /* virtual */ void Stop(); @@ -31,6 +29,7 @@ public: class FMusicDriver_ExtMidi: public MusicDriverFactory<FMusicDriver_ExtMidi> { public: + static const int priority = 1; /* virtual */ const char *GetName() { return "extmidi"; } /* virtual */ const char *GetDescription() { return "External MIDI Driver"; } /* virtual */ Driver *CreateInstance() { return new MusicDriver_ExtMidi(); } diff --git a/src/music/libtimidity.h b/src/music/libtimidity.h index 2915841f7..965a19573 100644 --- a/src/music/libtimidity.h +++ b/src/music/libtimidity.h @@ -7,8 +7,6 @@ class MusicDriver_LibTimidity: public MusicDriver { public: - /* virtual */ bool CanProbe() { return true; } - /* virtual */ const char *Start(const char * const *param); /* virtual */ void Stop(); @@ -24,6 +22,7 @@ public: class FMusicDriver_LibTimidity: public MusicDriverFactory<FMusicDriver_LibTimidity> { public: + static const int priority = 5; /* virtual */ const char *GetName() { return "libtimidity"; } /* virtual */ const char *GetDescription() { return "LibTimidity MIDI Driver"; } /* virtual */ Driver *CreateInstance() { return new MusicDriver_LibTimidity(); } diff --git a/src/music/music_driver.hpp b/src/music/music_driver.hpp index b4486ef94..b9e0ec065 100644 --- a/src/music/music_driver.hpp +++ b/src/music/music_driver.hpp @@ -22,7 +22,7 @@ class MusicDriverFactoryBase: public DriverFactoryBase { template <class T> class MusicDriverFactory: public MusicDriverFactoryBase { public: - MusicDriverFactory() { this->RegisterDriver(((T *)this)->GetName(), Driver::DT_MUSIC); } + MusicDriverFactory() { this->RegisterDriver(((T *)this)->GetName(), Driver::DT_MUSIC, ((T *)this)->priority); } /** * Get the long, human readable, name for the Driver-class. diff --git a/src/music/null_m.h b/src/music/null_m.h index 2b7be7581..fc5c2bb09 100644 --- a/src/music/null_m.h +++ b/src/music/null_m.h @@ -7,8 +7,6 @@ class MusicDriver_Null: public MusicDriver { public: - /* virtual */ bool CanProbe() { return false; } - /* virtual */ const char *Start(const char * const *param) { return NULL; } /* virtual */ void Stop() { } @@ -24,6 +22,7 @@ public: class FMusicDriver_Null: public MusicDriverFactory<FMusicDriver_Null> { public: + static const int priority = 0; /* virtual */ const char *GetName() { return "null"; } /* virtual */ const char *GetDescription() { return "Null Music Driver"; } /* virtual */ Driver *CreateInstance() { return new MusicDriver_Null(); } diff --git a/src/music/os2_m.h b/src/music/os2_m.h index b0f4d71ce..3ba1b5de6 100644 --- a/src/music/os2_m.h +++ b/src/music/os2_m.h @@ -7,8 +7,6 @@ class MusicDriver_OS2: public MusicDriver { public: - /* virtual */ bool CanProbe() { return true; } - /* virtual */ const char *Start(const char * const *param); /* virtual */ void Stop(); @@ -24,6 +22,7 @@ public: class FMusicDriver_OS2: public MusicDriverFactory<FMusicDriver_OS2> { public: + static const int priority = 10; /* virtual */ const char *GetName() { return "os2"; } /* virtual */ const char *GetDescription() { return "OS/2 Music Driver"; } /* virtual */ Driver *CreateInstance() { return new MusicDriver_OS2(); } diff --git a/src/music/qtmidi.h b/src/music/qtmidi.h index 7ffa02fe0..3aeac8b32 100644 --- a/src/music/qtmidi.h +++ b/src/music/qtmidi.h @@ -7,8 +7,6 @@ class MusicDriver_QtMidi: public MusicDriver { public: - /* virtual */ bool CanProbe() { return true; } - /* virtual */ const char *Start(const char * const *param); /* virtual */ void Stop(); @@ -24,6 +22,7 @@ public: class FMusicDriver_QtMidi: public MusicDriverFactory<FMusicDriver_QtMidi> { public: + static const int priorty = 10; /* virtual */ const char *GetName() { return "qt"; } /* virtual */ const char *GetDescription() { return "QuickTime MIDI Driver"; } /* virtual */ Driver *CreateInstance() { return new MusicDriver_QtMidi(); } diff --git a/src/music/win32_m.h b/src/music/win32_m.h index bef62bd66..35a79c3e7 100644 --- a/src/music/win32_m.h +++ b/src/music/win32_m.h @@ -7,8 +7,6 @@ class MusicDriver_Win32: public MusicDriver { public: - /* virtual */ bool CanProbe() { return true; } - /* virtual */ const char *Start(const char * const *param); /* virtual */ void Stop(); @@ -24,6 +22,7 @@ public: class FMusicDriver_Win32: public MusicDriverFactory<FMusicDriver_Win32> { public: + static const int priorty = 5; /* virtual */ const char *GetName() { return "win32"; } /* virtual */ const char *GetDescription() { return "Win32 Music Driver"; } /* virtual */ Driver *CreateInstance() { return new MusicDriver_Win32(); } |