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
Audio::Range< T > Struct Template Reference

#include <Types.h>

Public Member Functions

 Range (T mn, T mx)
 
span () const
 
float phase (T x) const
 

Public Attributes

min
 
max
 

Detailed Description

template<typename T>
struct Audio::Range< T >

Range data usually comes in min/max bundles

Definition at line 54 of file Types.h.

Constructor & Destructor Documentation

template<typename T>
Audio::Range< T >::Range ( mn,
mx 
)
inline

Definition at line 58 of file Types.h.

58 : min(mn), max(mx) {}

Member Function Documentation

template<typename T>
float Audio::Range< T >::phase ( x) const
inline

Definition at line 61 of file Types.h.

61  {
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  }
template<typename T>
T Audio::Range< T >::span ( ) const
inline

Definition at line 60 of file Types.h.

60 { return max-min; }

Member Data Documentation


The documentation for this struct was generated from the following file: