summaryrefslogtreecommitdiff
path: root/src/music
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-05-02 16:14:23 +0000
committerrubidium <rubidium@openttd.org>2011-05-02 16:14:23 +0000
commit4d5dbf51707c42c24eeafdb65016b079c54adcf2 (patch)
tree0197dcc17f4a8411ecea2223f356019c902fe7b9 /src/music
parente9837ff1ec1326aec622366ae29ff1aa81581daf (diff)
downloadopenttd-4d5dbf51707c42c24eeafdb65016b079c54adcf2.tar.xz
(svn r22410) -Document: some more bits ;)
Diffstat (limited to 'src/music')
-rw-r--r--src/music/allegro_m.h2
-rw-r--r--src/music/bemidi.cpp2
-rw-r--r--src/music/bemidi.h2
-rw-r--r--src/music/dmusic.h2
-rw-r--r--src/music/extmidi.cpp2
-rw-r--r--src/music/libtimidity.cpp4
-rw-r--r--src/music/libtimidity.h2
-rw-r--r--src/music/music_driver.hpp21
-rw-r--r--src/music/null_m.cpp2
-rw-r--r--src/music/null_m.h2
-rw-r--r--src/music/os2_m.cpp6
-rw-r--r--src/music/os2_m.h2
-rw-r--r--src/music/win32_m.h2
13 files changed, 49 insertions, 2 deletions
diff --git a/src/music/allegro_m.h b/src/music/allegro_m.h
index 1d61b30f8..2160c396e 100644
--- a/src/music/allegro_m.h
+++ b/src/music/allegro_m.h
@@ -14,6 +14,7 @@
#include "music_driver.hpp"
+/** Allegro's music player. */
class MusicDriver_Allegro: public MusicDriver {
public:
/* virtual */ const char *Start(const char * const *param);
@@ -30,6 +31,7 @@ public:
/* virtual */ const char *GetName() const { return "allegro"; }
};
+/** Factory for allegro's music player. */
class FMusicDriver_Allegro: public MusicDriverFactory<FMusicDriver_Allegro> {
public:
#if !defined(WITH_SDL) && defined(WITH_ALLEGRO)
diff --git a/src/music/bemidi.cpp b/src/music/bemidi.cpp
index 070e55819..5ee62dfe5 100644
--- a/src/music/bemidi.cpp
+++ b/src/music/bemidi.cpp
@@ -16,8 +16,10 @@
/* BeOS System Includes */
#include <MidiSynthFile.h>
+/** The file we're playing. */
static BMidiSynthFile midiSynthFile;
+/** Factory for BeOS' midi player. */
static FMusicDriver_BeMidi iFMusicDriver_BeMidi;
const char *MusicDriver_BeMidi::Start(const char * const *parm)
diff --git a/src/music/bemidi.h b/src/music/bemidi.h
index 07b275f95..1b280e667 100644
--- a/src/music/bemidi.h
+++ b/src/music/bemidi.h
@@ -14,6 +14,7 @@
#include "music_driver.hpp"
+/** The midi player for BeOS. */
class MusicDriver_BeMidi: public MusicDriver {
public:
/* virtual */ const char *Start(const char * const *param);
@@ -30,6 +31,7 @@ public:
/* virtual */ const char *GetName() const { return "bemidi"; }
};
+/** Factory for the BeOS midi player. */
class FMusicDriver_BeMidi: public MusicDriverFactory<FMusicDriver_BeMidi> {
public:
static const int priority = 10;
diff --git a/src/music/dmusic.h b/src/music/dmusic.h
index 74368de23..b3fc99610 100644
--- a/src/music/dmusic.h
+++ b/src/music/dmusic.h
@@ -14,6 +14,7 @@
#include "music_driver.hpp"
+/** Music player making use of DirectX. */
class MusicDriver_DMusic: public MusicDriver {
public:
/* virtual */ const char *Start(const char * const *param);
@@ -30,6 +31,7 @@ public:
/* virtual */ const char *GetName() const { return "dmusic"; }
};
+/** Factory for the DirectX music player. */
class FMusicDriver_DMusic: public MusicDriverFactory<FMusicDriver_DMusic> {
public:
static const int priority = 10;
diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp
index 6c8ee8d69..93492aa99 100644
--- a/src/music/extmidi.cpp
+++ b/src/music/extmidi.cpp
@@ -26,9 +26,11 @@
#include <errno.h>
#ifndef EXTERNAL_PLAYER
+/** The default external midi player. */
#define EXTERNAL_PLAYER "timidity"
#endif
+/** Factory for the midi player that uses external players. */
static FMusicDriver_ExtMidi iFMusicDriver_ExtMidi;
const char *MusicDriver_ExtMidi::Start(const char * const * parm)
diff --git a/src/music/libtimidity.cpp b/src/music/libtimidity.cpp
index 82f011c23..92f17212c 100644
--- a/src/music/libtimidity.cpp
+++ b/src/music/libtimidity.cpp
@@ -26,6 +26,7 @@
#include <pspaudiolib.h>
#endif /* PSP */
+/** The state of playing. */
enum MidiState {
MIDI_STOPPED = 0,
MIDI_PLAYING = 1,
@@ -39,7 +40,7 @@ static struct {
MidiState status;
uint32 song_length;
uint32 song_position;
-} _midi;
+} _midi; ///< Metadata about the midi we're playing.
#if defined(PSP)
static void AudioOutCallback(void *buf, unsigned int _reqn, void *userdata)
@@ -51,6 +52,7 @@ static void AudioOutCallback(void *buf, unsigned int _reqn, void *userdata)
}
#endif /* PSP */
+/** Factory for the libtimidity driver. */
static FMusicDriver_LibTimidity iFMusicDriver_LibTimidity;
const char *MusicDriver_LibTimidity::Start(const char * const *param)
diff --git a/src/music/libtimidity.h b/src/music/libtimidity.h
index 7839462dd..4f9343619 100644
--- a/src/music/libtimidity.h
+++ b/src/music/libtimidity.h
@@ -14,6 +14,7 @@
#include "music_driver.hpp"
+/** Music driver making use of libtimidity. */
class MusicDriver_LibTimidity: public MusicDriver {
public:
/* virtual */ const char *Start(const char * const *param);
@@ -30,6 +31,7 @@ public:
/* virtual */ const char *GetName() const { return "libtimidity"; }
};
+/** Factory for the libtimidity driver. */
class FMusicDriver_LibTimidity: public MusicDriverFactory<FMusicDriver_LibTimidity> {
public:
static const int priority = 5;
diff --git a/src/music/music_driver.hpp b/src/music/music_driver.hpp
index c3f565866..70a1e37a5 100644
--- a/src/music/music_driver.hpp
+++ b/src/music/music_driver.hpp
@@ -14,20 +14,41 @@
#include "../driver.h"
+/** Driver for all music playback. */
class MusicDriver: public Driver {
public:
+ /**
+ * Play a particular song.
+ * @param filename The name of file with the song to play.
+ */
virtual void PlaySong(const char *filename) = 0;
+ /**
+ * Stop playing the current song.
+ */
virtual void StopSong() = 0;
+ /**
+ * Are we currently playing a song?
+ * @return True if a song is being played.
+ */
virtual bool IsSongPlaying() = 0;
+ /**
+ * Set the volume, if possible.
+ * @param vol The new volume.
+ */
virtual void SetVolume(byte vol) = 0;
};
+/** Base of the factory for the music drivers. */
class MusicDriverFactoryBase: public DriverFactoryBase {
};
+/**
+ * Factory for the music drivers.
+ * @tparam T The type of the music factory to register.
+ */
template <class T>
class MusicDriverFactory: public MusicDriverFactoryBase {
public:
diff --git a/src/music/null_m.cpp b/src/music/null_m.cpp
index fa46d5efb..cb42a906a 100644
--- a/src/music/null_m.cpp
+++ b/src/music/null_m.cpp
@@ -12,5 +12,5 @@
#include "../stdafx.h"
#include "null_m.h"
+/** The factory for the music player that does nothing. */
static FMusicDriver_Null iFMusicDriver_Null;
-
diff --git a/src/music/null_m.h b/src/music/null_m.h
index 16137356c..babfd3775 100644
--- a/src/music/null_m.h
+++ b/src/music/null_m.h
@@ -14,6 +14,7 @@
#include "music_driver.hpp"
+/** The music player that does nothing. */
class MusicDriver_Null: public MusicDriver {
public:
/* virtual */ const char *Start(const char * const *param) { return NULL; }
@@ -30,6 +31,7 @@ public:
/* virtual */ const char *GetName() const { return "null"; }
};
+/** Factory for the null music player. */
class FMusicDriver_Null: public MusicDriverFactory<FMusicDriver_Null> {
public:
static const int priority = 1;
diff --git a/src/music/os2_m.cpp b/src/music/os2_m.cpp
index d9fb06138..ec1fca264 100644
--- a/src/music/os2_m.cpp
+++ b/src/music/os2_m.cpp
@@ -29,6 +29,11 @@
* eh? Anyone would think they both came from the same place originally! ;)
*/
+/**
+ * Send a midi command.
+ * @param cmd The command to send.
+ * @return The result of sending it.
+ */
static long CDECL MidiSendCommand(const char *cmd, ...)
{
va_list va;
@@ -39,6 +44,7 @@ static long CDECL MidiSendCommand(const char *cmd, ...)
return mciSendString(buf, NULL, 0, NULL, 0);
}
+/** OS/2's music player's factory. */
static FMusicDriver_OS2 iFMusicDriver_OS2;
void MusicDriver_OS2::PlaySong(const char *filename)
diff --git a/src/music/os2_m.h b/src/music/os2_m.h
index 87c45873c..054526e59 100644
--- a/src/music/os2_m.h
+++ b/src/music/os2_m.h
@@ -14,6 +14,7 @@
#include "music_driver.hpp"
+/** OS/2's music player. */
class MusicDriver_OS2: public MusicDriver {
public:
/* virtual */ const char *Start(const char * const *param);
@@ -30,6 +31,7 @@ public:
/* virtual */ const char *GetName() const { return "os2"; }
};
+/** Factory for OS/2's music player. */
class FMusicDriver_OS2: public MusicDriverFactory<FMusicDriver_OS2> {
public:
static const int priority = 10;
diff --git a/src/music/win32_m.h b/src/music/win32_m.h
index d596d3a9f..cf46fbc15 100644
--- a/src/music/win32_m.h
+++ b/src/music/win32_m.h
@@ -14,6 +14,7 @@
#include "music_driver.hpp"
+/** The Windows music player. */
class MusicDriver_Win32: public MusicDriver {
public:
/* virtual */ const char *Start(const char * const *param);
@@ -30,6 +31,7 @@ public:
/* virtual */ const char *GetName() const { return "win32"; }
};
+/** Factory for Windows' music player. */
class FMusicDriver_Win32: public MusicDriverFactory<FMusicDriver_Win32> {
public:
static const int priority = 5;