From f365c237f76e96d3469728cbbf74ac0488385e86 Mon Sep 17 00:00:00 2001 From: Maksim Lin Date: Tue, 27 May 2025 16:58:36 +1000 Subject: [PATCH] add maaster vol level control to mixerview --- sources/Application/Views/MixerView.cpp | 24 ++++++++++++++++++++++-- sources/Application/Views/MixerView.h | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/sources/Application/Views/MixerView.cpp b/sources/Application/Views/MixerView.cpp index ab30abc03..e99054a6b 100644 --- a/sources/Application/Views/MixerView.cpp +++ b/sources/Application/Views/MixerView.cpp @@ -3,13 +3,13 @@ #include "Application/Utils/char.h" #include "Application/Utils/mathutils.h" #include "UIController.h" +#include #include #define CHANNELS_X_OFFSET_ 3 // stride between each channel MixerView::MixerView(GUIWindow &w, ViewData *viewData) - : FieldView(w, viewData), needsPlayTimeUpdate_(false), - needsNotesUpdate_(false) { + : FieldView(w, viewData) { // Initialize the channel volume fields initChannelVolumeFields(); @@ -242,6 +242,17 @@ void MixerView::initChannelVolumeFields() { } } + // Add master volume field to the right of channel volumes + GUIPoint masterPos = position; + // Position to the right of channel volumes + masterPos._x += (SONG_CHANNEL_COUNT * CHANNELS_X_OFFSET_); + + Variable *v = project->FindVariable(FourCC::VarMasterVolume); + if (v) { + masterVolumeField_.emplace_back(masterPos, *v, "%2.2d", 0, 100, 1, 5); + fieldList_.insert(fieldList_.end(), &(*masterVolumeField_.begin())); + } + // Set focus to the first field if we have any fields if (!fieldList_.empty()) { SetFocus(*fieldList_.begin()); @@ -311,6 +322,15 @@ void MixerView::DrawView() { drawNotes(); drawMasterVuMeter(player, props); + // Draw master volume label + GUIPoint labelPos = GetAnchor(); + // Align with master volume control + labelPos._x += (SONG_CHANNEL_COUNT * CHANNELS_X_OFFSET_); + labelPos._y = SCREEN_HEIGHT - 3; // Position below the volume control + SetColor(CD_HILITE2); + DrawString(labelPos._x, labelPos._y, "MB", props); + SetColor(CD_NORMAL); + if (player->IsRunning()) { OnPlayerUpdate(PET_UPDATE); }; diff --git a/sources/Application/Views/MixerView.h b/sources/Application/Views/MixerView.h index f47d33e5b..79418b5e6 100644 --- a/sources/Application/Views/MixerView.h +++ b/sources/Application/Views/MixerView.h @@ -36,6 +36,7 @@ class MixerView : public FieldView { // Channel volume UI fields etl::vector channelVolumeFields_; + etl::vector masterVolumeField_; // Master volume field // Flags to track which UI elements need updating // These prevent core1 from directly updating the UI