diff options
author | peter1138 <peter1138@openttd.org> | 2007-07-05 12:23:54 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-07-05 12:23:54 +0000 |
commit | 5e85e8c5e03105e43cf9f2216e993c0596d7dfec (patch) | |
tree | 52e0cc5b1e4eb6cf9aed8556873ee6833662e11f /src/music/music_driver.hpp | |
parent | 7884a07b43fd293a2ca5b39b64df98b700959874 (diff) | |
download | openttd-5e85e8c5e03105e43cf9f2216e993c0596d7dfec.tar.xz |
(svn r10444) -Codechange: switch to c++ classes and inheritance for sound/music/video drivers, using self-registration based on the blitter-model.
Diffstat (limited to 'src/music/music_driver.hpp')
-rw-r--r-- | src/music/music_driver.hpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/music/music_driver.hpp b/src/music/music_driver.hpp new file mode 100644 index 000000000..b4486ef94 --- /dev/null +++ b/src/music/music_driver.hpp @@ -0,0 +1,35 @@ +/* $Id$ */ + +#ifndef MUSIC_MUSIC_DRIVER_HPP +#define MUSIC_MUSIC_DRIVER_HPP + +#include "../driver.h" + +class MusicDriver: public Driver { +public: + virtual void PlaySong(const char *filename) = 0; + + virtual void StopSong() = 0; + + virtual bool IsSongPlaying() = 0; + + virtual void SetVolume(byte vol) = 0; +}; + +class MusicDriverFactoryBase: public DriverFactoryBase { +}; + +template <class T> +class MusicDriverFactory: public MusicDriverFactoryBase { +public: + MusicDriverFactory() { this->RegisterDriver(((T *)this)->GetName(), Driver::DT_MUSIC); } + + /** + * Get the long, human readable, name for the Driver-class. + */ + const char *GetName(); +}; + +extern MusicDriver *_music_driver; + +#endif /* MUSIC_MUSIC_DRIVER_HPP */ |