diff options
Diffstat (limited to 'libs/audiographer/audiographer/types.h')
-rw-r--r-- | libs/audiographer/audiographer/types.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libs/audiographer/audiographer/types.h b/libs/audiographer/audiographer/types.h new file mode 100644 index 0000000000..f48f8f807a --- /dev/null +++ b/libs/audiographer/audiographer/types.h @@ -0,0 +1,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__
\ No newline at end of file |