Skip to content

Commit

Permalink
Add low quality mode
Browse files Browse the repository at this point in the history
  • Loading branch information
stengerh committed Jan 7, 2017
1 parent 3aeb92d commit 9363889
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion foo_vis_oscilloscope_d2d/oscilloscope_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "oscilloscope_config.h"

t_uint32 oscilloscope_config::g_get_version() {
return 4;
return 5;
}

oscilloscope_config::oscilloscope_config() {
Expand All @@ -15,6 +15,7 @@ void oscilloscope_config::reset() {
m_downmix_enabled = false;
m_trigger_enabled = false;
m_resample_enabled = false;
m_low_quality_enabled = false;
m_window_duration_millis = 100;
m_zoom_percent = 100;
m_refresh_rate_limit_hz = 20;
Expand All @@ -27,6 +28,9 @@ void oscilloscope_config::parse(ui_element_config_parser & parser) {
t_uint32 version;
parser >> version;
switch (version) {
case 5:
parser >> m_low_quality_enabled;
// fall through
case 4:
parser >> m_resample_enabled;
// fall through
Expand Down Expand Up @@ -55,6 +59,7 @@ void oscilloscope_config::parse(ui_element_config_parser & parser) {

void oscilloscope_config::build(ui_element_config_builder & builder) {
builder << g_get_version();
builder << m_low_quality_enabled;
builder << m_resample_enabled;
builder << m_refresh_rate_limit_hz;
builder << m_trigger_enabled;
Expand Down
1 change: 1 addition & 0 deletions foo_vis_oscilloscope_d2d/oscilloscope_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class oscilloscope_config {
bool m_downmix_enabled;
bool m_trigger_enabled;
bool m_resample_enabled;
bool m_low_quality_enabled;
t_uint32 m_window_duration_millis;
t_uint32 m_zoom_percent;
t_uint32 m_refresh_rate_limit_hz;
Expand Down
5 changes: 5 additions & 0 deletions foo_vis_oscilloscope_d2d/oscilloscope_ui_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ HRESULT oscilloscope_ui_element_instance::Render() {

if (SUCCEEDED(hr)) {
m_pRenderTarget->BeginDraw();
m_pRenderTarget->SetAntialiasMode(m_config.m_low_quality_enabled ? D2D1_ANTIALIAS_MODE_ALIASED : D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);

m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Identity());

Expand Down Expand Up @@ -304,6 +305,7 @@ void oscilloscope_ui_element_instance::OnContextMenu(CWindow wnd, CPoint point)
menu.AppendMenu(MF_STRING, IDM_TOGGLE_FULLSCREEN, TEXT("Toggle Full-Screen Mode"));
menu.AppendMenu(MF_SEPARATOR);
menu.AppendMenu(MF_STRING | (m_config.m_downmix_enabled ? MF_CHECKED : 0), IDM_DOWNMIX_ENABLED, TEXT("Downmix Channels"));
menu.AppendMenu(MF_STRING | (m_config.m_low_quality_enabled ? MF_CHECKED : 0), IDM_LOW_QUALITY_ENABLED, TEXT("Low Quality Mode"));
menu.AppendMenu(MF_STRING | (m_config.m_trigger_enabled ? MF_CHECKED : 0), IDM_TRIGGER_ENABLED, TEXT("Trigger on Zero Crossing"));

CMenu durationMenu;
Expand Down Expand Up @@ -364,6 +366,9 @@ void oscilloscope_ui_element_instance::OnContextMenu(CWindow wnd, CPoint point)
m_config.m_downmix_enabled = !m_config.m_downmix_enabled;
UpdateChannelMode();
break;
case IDM_LOW_QUALITY_ENABLED:
m_config.m_low_quality_enabled = !m_config.m_low_quality_enabled;
break;
case IDM_TRIGGER_ENABLED:
m_config.m_trigger_enabled = !m_config.m_trigger_enabled;
break;
Expand Down
1 change: 1 addition & 0 deletions foo_vis_oscilloscope_d2d/oscilloscope_ui_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class oscilloscope_ui_element_instance : public ui_element_instance, public CWin
IDM_DOWNMIX_ENABLED,
IDM_TRIGGER_ENABLED,
IDM_RESAMPLE_ENABLED,
IDM_LOW_QUALITY_ENABLED,
IDM_WINDOW_DURATION_50,
IDM_WINDOW_DURATION_100,
IDM_WINDOW_DURATION_200,
Expand Down

0 comments on commit 9363889

Please sign in to comment.