-
Notifications
You must be signed in to change notification settings - Fork 6
Meter Anatomy
All meters in PeppyMeter can be divided by their functionality into the following types:
- Linear Stereo. The meters in this group (bar, dash, gas) show volume level for stereo signal using the linear scale.
- Circular Mono. The meters in this group (blue, rainbow, royal) merge stereo signal into mono signal and show volume level using the circular scale.
- Circular Stereo. The meters in this group (vintage, grunge, compass) display volume level using the circular scale for each channel.
Let's use 'bar' meter to demonstrate the configuration settings of the linear meters. Here is the excerpt from the configuration file meters.txt showing the properties of the 'bar' meter:
[bar]
meter.type = linear
channels = 2
ui.refresh.period = 0.033
bgr.filename = bar-bgr.png
indicator.filename = bar-indicator.png
left.x = 130
left.y = 113
right.x = 130
right.y = 178
position.regular = 11
position.overload = 3
step.width.regular = 19
step.width.overload = 25
meter.x = 0
meter.y = 0
screen.bgr =
The property 'meter.type' can be either linear or circular.
The 'channels' property equals to 2 for stereo signal and 1 for mono.
'ui.refresh.period' property defines how often animation thread checks the channel queue for new data. It will update UI only if new value differs from the previous one.
The filename properties define the filenames for images used in the meter. The foreground image is optional. The following image shows how image layers are combined to display the linear meter.
The following image explains the meaning of the coordinate and size properties:
The optional direction property defines an indicator movement direction. The direction left-right will be used by default if the direction property was not defined. The following image illustrates all supported directions:
The optional properties flip.left.x and flip.right.x can be used to flip left and right indicator images respectively:
The property indicator.type can be used for a single linear indicator types. single is the only supported type at the moment:
When a meter is used as a part of a larger screen then such properties as meter.x and meter.y should be used to place a meter in a specific location. The property screen.bgr defines a background image of a larger screen:
Let's use 'vintage' meter to demonstrate the configuration settings of the circular meters. Here is the excerpt from the configuration file meters.txt showing the properties of the 'vintage' meter:
[vintage]
meter.type = circular
channels = 2
ui.refresh.period = 0.033
bgr.filename = vintage-bgr.png
fgr.filename = vintage-fgr.png
indicator.filename = vintage-needle.png
steps.per.degree = 2
start.angle = 45
stop.angle = -45
distance = 54
left.origin.x = 129
left.origin.y = 217
right.origin.x = 349
right.origin.y = 217
meter.x = 0
meter.y = 0
screen.bgr =
Such properties as 'meter.type', 'channels', 'ui.refresh.period' and 'filename' have the same meaning as corresponding properties for the linear meters. The image below shows how image layers are combined to display the circular meter.
Next images show the meaning of the coordinate and size properties for circular meters:
Rotating images with anti-aliasing is very expensive operation on low resources machines especially when large image should be rotated. This is so resource hungry operation in Pygame that using real-time rotations with milliseconds interval was problematic on Raspberry Pi 2. That's why a well-known workaround was in use. All necessary sprites are rotated in advance and then displayed as static images.