|
From: knittl <kn...@us...> - 2009-07-19 18:33:22
|
Module: performous
Branch: master
Commit: f38f1dbe91f8ed52a956f351d3e27fd8bc99fdc3
Author: knittl <knittl@kbook.(none)>
Date: Sun Jul 19 20:28:40 2009 +0200
doxygen update
midifile.hh still missing documentation. probably not needed, as there
is a commented private label
---
game/audio.hh | 2 ++
game/glutil.hh | 14 ++++++++++++--
game/joystick.hh | 6 ++++++
game/midifile.cc | 1 +
game/notes.hh | 9 ++++++++-
game/profiler.hh | 3 +++
game/songparser-ini.cc | 3 ++-
game/songparser-txt.cc | 3 ++-
8 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/game/audio.hh b/game/audio.hh
index ca4da4c..93d5917 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -87,6 +87,7 @@ struct Stream {
void fadeout(double time) { fadeSpeed = - 1.0 / (time * srate); }
/// is the stream fading out
bool fadingout() {return fadeSpeed < 0;}
+ /// consume duration seconds of stream
bool consume(double duration) {
std::vector<int16_t> buf;
unsigned int samples = srate * duration;
@@ -132,6 +133,7 @@ class Audio {
* @param startPos starting position
*/
void playMusic(std::string const& filename, bool preview = false, double fadeTime = 0.1, double startPos = 0.0);
+ /// plays a list of songs
void playMusic(std::vector<std::string> const& filenames, bool preview = false, double fadeTime = 0.1, double startPos = 0.0);
/** Play a preview of the song, starting at startPos
* @param filename the track filename
diff --git a/game/glutil.hh b/game/glutil.hh
index e84093a..90a1b09 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -3,20 +3,30 @@
#include <GL/glew.h>
namespace glutil {
+ /// wrapper struct for RAII
struct PushMatrix {
PushMatrix() { glPushMatrix(); }
~PushMatrix() { glPopMatrix(); }
};
+ /// wrapper struct for RAII
struct Begin {
+ /// call glBegin with given mode
Begin(GLint mode) { glBegin(mode); }
~Begin() { glEnd(); }
};
-
+
+ /// struct to store color information
struct Color {
- float r, g, b, a;
+ float r, ///< red component
+ g, ///< green
+ b, ///< blue
+ a; ///< alpha value
+ /// create nec Color object with given channels
Color(float r_, float g_, float b_, float a_ = 1.0): r(r_), g(g_), b(b_), a(a_) {}
+ /// overload float cast
operator float*() { return reinterpret_cast<float*>(this); }
+ /// overload float const cast
operator float const*() const { return reinterpret_cast<float const*>(this); }
};
}
diff --git a/game/joystick.hh b/game/joystick.hh
index 8ec4f61..ea1f4a4 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -12,14 +12,20 @@
void joysticks_init();
+/// joystick class used for dealing with ps3 drumsets
class Joystick {
public:
Joystick() {};
+ /// create joystick object with given id
Joystick(unsigned int _id);
~Joystick();
+ /// get name of joystick
std::string getName() const;
+ /// get longer description of joystick
std::string getDescription() const;
+ /// returns true if the button with _button_id is pressed
bool buttonState(unsigned char _button_id) const;
+ /// hi-hat
unsigned char hat(unsigned char _hat_id) const;
short axe(unsigned char _axe_id) const;
std::pair<int, int> ball(int _ball_id) const;
diff --git a/game/midifile.cc b/game/midifile.cc
index c6eabb7..939fe99 100644
--- a/game/midifile.cc
+++ b/game/midifile.cc
@@ -32,6 +32,7 @@ class MidiStream {
f.exceptions(std::ios::failbit);
}
+ /// read bytes
std::string read_bytes(size_t bytes);
class Riff {
diff --git a/game/notes.hh b/game/notes.hh
index a7ace84..84a81c3 100644
--- a/game/notes.hh
+++ b/game/notes.hh
@@ -29,11 +29,16 @@ class MusicalScale {
double getNoteOffset(double freq) const;
};
+/// stores duration of a note
struct Duration {
- double begin, end; ///< Beginning and ending timestamps is seconds
+ double begin, ///< beginning timestamp in seconds
+ end; ///< ending timestamp in seconds
Duration();
+ /// create a new Duration object and initialize begin and end
Duration(double b, double e): begin(b), end(e) {}
+ /// compares begin timestamps of two Duration structs
static bool ltBegin(Duration const& a, Duration const& b) { return a.begin < b.begin; }
+ /// compares end timestamps of two Duration structs
static bool ltEnd(Duration const& a, Duration const& b) { return a.end < b.end; }
};
@@ -64,7 +69,9 @@ struct Note {
double maxScore() const;
/// score when singing
double score(double freq, double b, double e) const;
+ /// compares begin of two notes
static bool ltBegin(Note const& a, Note const& b) { return a.begin < b.begin; }
+ /// compares end of two notes
static bool ltEnd(Note const& a, Note const& b) { return a.end < b.end; }
private:
double scoreMultiplier(double error) const;
diff --git a/game/profiler.hh b/game/profiler.hh
index 256a2fc..a93f191 100644
--- a/game/profiler.hh
+++ b/game/profiler.hh
@@ -5,12 +5,15 @@
#include <sstream>
#include <string>
+/// easy access for profiling code
class Profiler {
std::ostringstream m_oss;
boost::xtime m_time;
public:
+ /// create a new profiler with a given name
Profiler(std::string const& name): m_time(now()) { m_oss << name << ": "; }
~Profiler() { std::clog << m_oss.str() << std::endl; }
+ /// calling the object as a function will return the time since the start
void operator()(std::string const& tag) {
boost::xtime n = now();
std::swap(n, m_time);
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 15bcad5..e16c343 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -3,7 +3,8 @@
#include <boost/filesystem.hpp>
#include "midifile.hh"
-/// @file Functions used for parsing the UltraStar TXT song format
+/// @file
+/// Functions used for parsing the UltraStar TXT song format
bool SongParser::iniCheck(std::vector<char> const& data) {
static const std::string header = "[song]";
diff --git a/game/songparser-txt.cc b/game/songparser-txt.cc
index 27fe608..3c83b58 100644
--- a/game/songparser-txt.cc
+++ b/game/songparser-txt.cc
@@ -1,6 +1,7 @@
#include "songparser.hh"
-/// @file Functions used for parsing the UltraStar TXT song format
+/// @file
+/// Functions used for parsing the UltraStar TXT song format
namespace {
void assign(int& var, std::string const& str) {
|