Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Types.h
Go to the documentation of this file.
1 //
2 // C++ Interface: Audio::Codec
3 //
4 #ifndef __AUDIO_TYPES_H__INCLUDED__
5 #define __AUDIO_TYPES_H__INCLUDED__
6 
7 #include <boost/smart_ptr.hpp>
8 #include <boost/enable_shared_from_this.hpp>
9 
10 // Some compilers don't like template typedefs
11 #define SharedPtr boost::shared_ptr
12 #define WeakPtr boost::weak_ptr
13 #define AutoPtr boost::scoped_ptr
14 #define SharedFromThis boost::enable_shared_from_this
15 
16 #include "Vector.h"
17 #include "Matrix.h"
18 
19 namespace Audio {
20 
22  typedef float Scalar;
23 
25  typedef double LScalar;
26 
28  typedef LScalar Timestamp;
29 
31  typedef Scalar Duration;
32 
35 
38 
41 
44 
46  template<typename T> struct PerFrequency {
47  T lf;
48  T hf;
49 
50  PerFrequency(T _lf, T _hf) : lf(_lf), hf(_hf) {}
51  };
52 
54  template<typename T> struct Range {
55  T min;
56  T max;
57 
58  Range(T mn, T mx) : min(mn), max(mx) {}
59 
60  T span() const { return max-min; }
61  float phase(T x) const {
62  if (min<max) {
63  if (x<=min)
64  return 0.f;
65  else if (x>=max)
66  return 1.f;
67  else
68  return float(x-min) / float(max-min);
69  } else {
70  if (x<=max)
71  return 1.f;
72  else if (x>=min)
73  return 0.f;
74  else
75  return float(x-min) / float(max-min);
76  }
77  }
78  };
79 
81  class UserData {
82  public:
83  virtual ~UserData() {};
84  };
85 
86 };
87 
88 #endif//__AUDIO_TYPES_H__INCLUDED__