|
From: Tapio V. <aa...@us...> - 2010-08-21 14:03:29
|
Module: performous
Branch: pass-through
Commit: 4a3e5511507c0be47d43d01ae5e759dd96268272
Author: Tapio Vierros <tap...@gm...>
Date: Fri Aug 20 00:41:21 2010 +0300
Clean libda headers meta.
---
game/libda/fft.hpp | 18 ++++++------------
game/libda/mixer.hpp | 26 ++++++++++----------------
game/libda/portaudio.hpp | 7 ++++++-
game/libda/sample.hpp | 16 +++++-----------
4 files changed, 27 insertions(+), 40 deletions(-)
diff --git a/game/libda/fft.hpp b/game/libda/fft.hpp
index 700cdb0..55b6013 100644
--- a/game/libda/fft.hpp
+++ b/game/libda/fft.hpp
@@ -1,11 +1,8 @@
-#ifndef AUDIO_FFT_HPP_INCLUDED
-#define AUDIO_FFT_HPP_INCLUDED
+#pragma once
/**
-@file fft.hpp FFT and related facilities.
-
-Header only, no need to link with libda.
-**/
+ * @file fft.hpp FFT and related facilities.
+ */
#include <complex>
#include <cstddef>
@@ -21,7 +18,7 @@ namespace da {
/** Calculate the square of val. **/
static inline double sqr(double val) { return val * val; }
-
+
template <unsigned M, unsigned N, unsigned B, unsigned A> struct SinCosSeries {
static double value() {
return 1 - sqr(A * M_PI / B) / M / (M+1) * SinCosSeries<M + 2, N, B, A>::value();
@@ -38,14 +35,14 @@ namespace da {
template <unsigned A, unsigned B> struct Cos {
static double value() { return SinCosSeries<1, 33, B, A>::value(); }
};
-
+
/** Calculate sin(2 pi A / B). **/
template <unsigned A, unsigned B> double sin() { return Sin<A, B>::value(); }
/** Calculate cos(2 pi A / B). **/
template <unsigned A, unsigned B> double cos() { return Cos<A, B>::value(); }
}
-
+
namespace fourier {
// Based on the description of Volodymyr Myrnyy in
// http://www.dspdesignline.com/showArticle.jhtml?printableArticle=true&articleId=199903272
@@ -106,6 +103,3 @@ namespace da {
}
}
-
-#endif
-
diff --git a/game/libda/mixer.hpp b/game/libda/mixer.hpp
index 29ae38e..cfc820a 100644
--- a/game/libda/mixer.hpp
+++ b/game/libda/mixer.hpp
@@ -1,14 +1,11 @@
-#ifndef LIBDA_MIXER_HPP_INCLUDED
-#define LIBDA_MIXER_HPP_INCLUDED
+#pragma once
/**
-@file mixer.hpp LibDA mixer interface, version 1.
-
-This appears to be too complex and will probably be removed in later release in
-favor of something easier and faster.
-
-Link with libda when you use this.
-**/
+ * @file mixer.hpp LibDA mixer interface, version 1.
+ *
+ * This appears to be too complex and will probably be removed in later release in
+ * favor of something easier and faster. Actually it is not even used currently.
+ */
#include "audio.hpp"
#include <boost/scoped_ptr.hpp>
@@ -39,7 +36,7 @@ namespace da {
return shared_reference_wrapper<T>(ptr);
}
-
+
class chain: boost::noncopyable {
public:
typedef std::vector<callback_t> streams_t;
@@ -173,7 +170,7 @@ namespace da {
public:
template <typename T> scoped_lock(T& obj): boost::recursive_mutex::scoped_lock(obj.m_mutex) {}
};
-
+
class mutex_stream: boost::noncopyable {
public:
mutex_stream(callback_t const& stream): m_stream(stream) {}
@@ -191,7 +188,7 @@ namespace da {
mutable boost::recursive_mutex m_mutex;
friend class scoped_lock;
};
-
+
typedef std::auto_ptr<scoped_lock> lock_holder;
template <typename Key> class select {
@@ -215,7 +212,7 @@ namespace da {
Key m_key;
callback_t m_stream;
};
-
+
class mixer {
public:
mixer(): m_mutex(boost::ref(m_select)) { init(); }
@@ -304,6 +301,3 @@ namespace da {
boost::scoped_ptr<playback> m_playback;
};
}
-
-#endif
-
diff --git a/game/libda/portaudio.hpp b/game/libda/portaudio.hpp
index 4211545..36fb82a 100644
--- a/game/libda/portaudio.hpp
+++ b/game/libda/portaudio.hpp
@@ -1,3 +1,9 @@
+#pragma once
+
+/**
+ * @file portaudio.hpp OOP / RAII wrappers & utilities for PortAudio library.
+ */
+
#include <portaudio.h>
#include <cstdlib>
#include <stdexcept>
@@ -87,4 +93,3 @@ namespace portaudio {
};
}
-
diff --git a/game/libda/sample.hpp b/game/libda/sample.hpp
index 29383e7..f785347 100644
--- a/game/libda/sample.hpp
+++ b/game/libda/sample.hpp
@@ -1,17 +1,14 @@
-#ifndef LIBDA_SAMPLE_HPP_INCLUDED
-#define LIBDA_SAMPLE_HPP_INCLUDED
+#pragma once
/**
-@file sample.hpp Sample format definition and format conversions.
-
-Header-only, no need to link to LibDA.
-**/
+ * @file sample.hpp Sample format definition and format conversions.
+ */
namespace da {
// Implement mathematical rounding (which C++ unfortunately currently lacks)
template <typename T> T round(T val) { return static_cast<T>(static_cast<int>(val + (val >= 0 ? 0.5 : -0.5))); }
-
+
// WARNING: changing this breaks binary compatibility on the library!
typedef float sample_t;
@@ -21,7 +18,7 @@ namespace da {
if (val > max) val = max;
return val;
}
-
+
const sample_t max_s16 = 32767.0f, min_s16 = -max_s16 - 1.0f;
const sample_t max_s24 = 8388607.0f, min_s24 = -max_s24 - 1.0f;
const sample_t max_s32 = 2147483647.0f, min_s32= -max_s32 - 1.0f;
@@ -66,6 +63,3 @@ namespace da {
typedef step_iterator<sample_t> sample_iterator;
typedef step_iterator<sample_t const> sample_const_iterator;
}
-
-#endif
-
|