blip  0.1
LEDArray.hpp
Go to the documentation of this file.
1 #ifndef __blip_LEDArray_hpp
2 #define __blip_LEDArray_hpp
3 
4 #include <blip/Blip.hpp>
6 
7 #include <commonc++/ScopedPtr.h++>
8 
9 namespace blip {
10 
11 class AudioContext;
12 class AudioEngine;
13 class Color;
14 
23 class LEDArray
24 {
25  friend class AudioEngine;
26 
27  public:
28 
30  ~LEDArray();
31 
33  inline uint_t getCount() const
34  { return(_count); }
35 
37  uint_t getPrimaryIndex() const
38  { return(_primaryIndex); }
39 
43  inline uint32_t getColorSupportMask() const
44  { return(_colorMask); }
45 
47  bool supportsColor(uint_t index) const;
48 
56  void setActivated(uint_t index, bool activated);
57 
65  bool isActivated(uint_t index);
66 
73  void setActivatedMask(uint32_t mask);
74 
82  uint32_t getActivatedMask();
83 
91  void setColor(uint_t index, const Color& color);
92 
99  Color getColor(uint_t index);
100 
101  private:
102 
103  LEDArray(AudioContext* context, uint32_t deviceID);
104  void init();
105  void checkResult(uint32_t result, const char* call);
106 
107  struct Private;
108 
109  ccxx::ScopedPtr<Private> _private;
110  AudioContext* _context;
111  uint32_t _deviceID;
112  uint_t _count;
113  uint_t _primaryIndex;
114  uint32_t _colorMask;
115 
116  CCXX_COPY_DECLS(LEDArray);
117 };
118 
119 } // namespace blip
120 
121 #endif // __blip_LEDArray_hpp
uint32_t getActivatedMask()
Get a bitmask which indicates which LEDs are activated and which are deactivated. ...
Definition: LEDArray.cpp:136
A color with red, green, blue, and alpha components.
Definition: Color.hpp:14
void setActivated(uint_t index, bool activated)
Activate or deactivate the LED with the given index.
Definition: LEDArray.cpp:95
Color getColor(uint_t index)
Get the color of the LED with the given index.
Definition: LEDArray.cpp:172
uint_t getPrimaryIndex() const
Get the index of the primary LED.
Definition: LEDArray.hpp:37
WAV file format details at: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
Definition: AccelerometerSensorEvent.cpp:3
bool isActivated(uint_t index)
Test if the LED with the given index is activated.
Definition: LEDArray.cpp:113
bool supportsColor(uint_t index) const
Test if the LED with the given index supports changing of its color.
Definition: LEDArray.cpp:84
void setColor(uint_t index, const Color &color)
Set the color of the LED with the given index.
Definition: LEDArray.cpp:150
An audio playback engine.
Definition: AudioEngine.hpp:30
uint_t getCount() const
Get the number of LEDs in the LED array.
Definition: LEDArray.hpp:33
A class representing an LED array.
Definition: LEDArray.hpp:23
uint32_t getColorSupportMask() const
Get a bitmask that indicates which LEDs support changing of their colors.
Definition: LEDArray.hpp:43
void setActivatedMask(uint32_t mask)
Specify which LEDs should be enabled and disabled via a bitmask.
Definition: LEDArray.cpp:125
~LEDArray()
Destructor.
Definition: LEDArray.cpp:41