Skip to content

Commit

Permalink
Rename NoteBitmapDisplay → BitmapDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Nov 2, 2020
1 parent daccfcb commit c6e35b9
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 49 deletions.
12 changes: 6 additions & 6 deletions examples/7.Displays/MCU-OLED-SSD1306-x2/MCU-OLED-SSD1306-x2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -224,34 +224,34 @@ MCU::TimeDisplayDisplay timedisplaydisplay = {
};

// Play / Record
NoteBitmapDisplay<> playDisp = {
BitmapDisplay<> playDisp = {
display_L, play, XBM::play_7, {16 + 64, 0}, WHITE,
};
NoteBitmapDisplay<> recordDisp = {
BitmapDisplay<> recordDisp = {
display_L, record, XBM::record_7, {26 + 64, 0}, WHITE,
};

// Mute
NoteBitmapDisplay<> muteDisp[] = {
BitmapDisplay<> muteDisp[] = {
{display_L, mute[0], XBM::mute_10B, {14, 50}, WHITE},
{display_L, mute[1], XBM::mute_10B, {14 + 64, 50}, WHITE},
{display_R, mute[2], XBM::mute_10B, {14, 50}, WHITE},
{display_R, mute[3], XBM::mute_10B, {14 + 64, 50}, WHITE},
};

// Solo
NoteBitmapDisplay<> soloDisp[] = {
BitmapDisplay<> soloDisp[] = {
{display_L, solo[0], XBM::solo_10B, {14, 50}, WHITE},
{display_L, solo[1], XBM::solo_10B, {14 + 64, 50}, WHITE},
{display_R, solo[2], XBM::solo_10B, {14, 50}, WHITE},
{display_R, solo[3], XBM::solo_10B, {14 + 64, 50}, WHITE},
};

NoteBitmapDisplay<> rudeSoloDisp = {
BitmapDisplay<> rudeSoloDisp = {
display_L, rudeSolo, XBM::solo_7, {36 + 64, 0}, WHITE};

// Record arm / ready
NoteBitmapDisplay<> recrdyDisp[] = {
BitmapDisplay<> recrdyDisp[] = {
{display_L, recrdy[0], XBM::rec_rdy_10B, {14 + 14, 50}, WHITE},
{display_L, recrdy[1], XBM::rec_rdy_10B, {14 + 14 + 64, 50}, WHITE},
{display_R, recrdy[2], XBM::rec_rdy_10B, {14 + 14, 50}, WHITE},
Expand Down
12 changes: 6 additions & 6 deletions examples/7.Displays/MCU-OLED-SSD1306/MCU-OLED-SSD1306.ino
Original file line number Diff line number Diff line change
Expand Up @@ -179,30 +179,30 @@ MCU::TimeDisplayDisplay timedisplaydisplay = {
};

// Play / Record
NoteBitmapDisplay<> playDisp = {
BitmapDisplay<> playDisp = {
display, play, XBM::play_7, {16 + 64, 0}, WHITE,
};
NoteBitmapDisplay<> recordDisp = {
BitmapDisplay<> recordDisp = {
display, record, XBM::record_7, {26 + 64, 0}, WHITE,
};

// Mute
NoteBitmapDisplay<> muteDisp[] = {
BitmapDisplay<> muteDisp[] = {
{display, mute[0], XBM::mute_10B, {14, 50}, WHITE},
{display, mute[1], XBM::mute_10B, {14 + 64, 50}, WHITE},
};

// Solo
NoteBitmapDisplay<> soloDisp[] = {
BitmapDisplay<> soloDisp[] = {
{display, solo[0], XBM::solo_10B, {14, 50}, WHITE},
{display, solo[1], XBM::solo_10B, {14 + 64, 50}, WHITE},
};

NoteBitmapDisplay<> rudeSoloDisp = {
BitmapDisplay<> rudeSoloDisp = {
display, rudeSolo, XBM::solo_7, {36 + 64, 0}, WHITE};

// Record arm / ready
NoteBitmapDisplay<> recrdyDisp[] = {
BitmapDisplay<> recrdyDisp[] = {
{display, recrdy[0], XBM::rec_rdy_10B, {14 + 14, 50}, WHITE},
{display, recrdy[1], XBM::rec_rdy_10B, {14 + 14 + 64, 50}, WHITE},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ MCU::VUDisplay<> vuDisp[8] = {
{display, VUMeters[7], {2 + 16 * 7, 50}, 12, 3, 1, WHITE},
};

NoteBitmapDisplay<> muteDisp[8] = {
BitmapDisplay<> muteDisp[8] = {
// Draw the first mute indicator to the display, at position (4, 54),
// using bitmap icon mute_7 with a white foreground color.
{display, mute[0], XBM::mute_7, {4 + 16 * 0, 54}, WHITE},
Expand All @@ -161,7 +161,7 @@ NoteBitmapDisplay<> muteDisp[8] = {
{display, mute[7], XBM::mute_7, {4 + 16 * 7, 54}, WHITE},
};

NoteBitmapDisplay<> soloDisp[8] = {
BitmapDisplay<> soloDisp[8] = {
// Draw the first solo indicator to the display, at position (4, 54),
// using bitmap icon solo_7 with a white foreground color.
{display, solo[0], XBM::solo_7, {4 + 16 * 0, 54}, WHITE},
Expand Down
2 changes: 1 addition & 1 deletion src/Control_Surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <Display/MCU/TimeDisplayDisplay.hpp>
#include <Display/MCU/VPotDisplay.hpp>
#include <Display/MCU/VUDisplay.hpp>
#include <Display/NoteBitmapDisplay.hpp>
#include <Display/BitmapDisplay.hpp>
#include <Display/SelectorDisplay.hpp>

// ------------------------------ MIDI Outputs ------------------------------ //
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#ifdef TEST_COMPILE_ALL_HEADERS_SEPARATELY
#include "NoteBitmapDisplay.hpp"
#include "BitmapDisplay.hpp"
#endif
42 changes: 42 additions & 0 deletions src/Display/BitmapDisplay.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#pragma once

#include <AH/STL/utility> // std::forward
#include <Display/Bitmaps/XBitmaps.hpp>
#include <Display/DisplayElement.hpp>
#include <MIDI_Inputs/InterfaceMIDIInputElements.hpp>

BEGIN_CS_NAMESPACE

/// A class that displays a bitmap depending on the state of a MIDINote or any
/// other object that has a `getValue()` method that returns true (or anything
/// that evaluates to true) when the bitmap has to be displayed, as wel as a
/// pair of `getDirty()`/`clearDirty()` methods to determine whether the display
/// has to be updated.
template <class Value_t = Interfaces::IValue &>
class BitmapDisplay : public DisplayElement {
public:
BitmapDisplay(DisplayInterface &display, Value_t &&value,
const XBitmap &xbm, PixelLocation loc, uint16_t color)
: DisplayElement(display), value(std::forward<Value_t>(value)),
xbm(xbm), x(loc.x), y(loc.y), color(color) {}

void draw() override {
if (value.getValue())
display.drawXBitmap(x, y, xbm.bits, xbm.width, xbm.height, color);
value.clearDirty();
}

bool getDirty() const override { return value.getDirty(); }

private:
Value_t value;
const XBitmap &xbm;
int16_t x, y;
uint16_t color;
};

template <class Value_t = Interfaces::IValue>
using NoteBitmapDisplay [[deprecated("Use BitmapDisplay instead")]] =
BitmapDisplay<Value_t>;

END_CS_NAMESPACE
33 changes: 0 additions & 33 deletions src/Display/NoteBitmapDisplay.hpp

This file was deleted.

0 comments on commit c6e35b9

Please sign in to comment.