summaryrefslogtreecommitdiff
path: root/libs/audiographer/audiographer/types.h
blob: f48f8f807a46483b8f63ef6221ec3fbf383e2df2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef AUDIOGRAPHER_TYPES_H
#define AUDIOGRAPHER_TYPES_H

#include <stdint.h>

namespace AudioGrapher {

typedef int64_t nframes_t;
typedef uint8_t ChannelCount;

/** Flag field capable of holding 32 flags.
    Easily grown in size to 64 flags by changing storage_type */
class FlagField {
  public:
	typedef uint8_t  Flag;
	typedef uint32_t storage_type;
	
	FlagField() : _flags (0) {}
	FlagField(FlagField const & other) : _flags (other._flags) {}
	
	inline bool has (Flag flag) const  { return _flags & (1 << flag); }
	inline void set (Flag flag)        { _flags |= (1 << flag); }
	inline void remove (Flag flag)     { _flags &= ~(1 << flag); }
	inline storage_type flags () const { return _flags; }

  private:
	storage_type _flags;
};

} // namespace

#endif // __audiographer_types_h__