From 2cdaa88eae964cc9acfa43162594cd6996a47515 Mon Sep 17 00:00:00 2001 From: Hiroyuki Adachi Date: Thu, 17 Mar 2022 19:41:06 +0900 Subject: [PATCH] refactor: #13 keeping codes clean. --- MidiPlayer.Droid/MainActivity.Component.cs | 16 +++ MidiPlayer.Droid/MainActivity.cs | 14 +- MidiPlayer.FluidSynth/Synth.cs | 19 +-- MidiPlayer/Mixer.cs | 154 ++++++++++++++++++--- 4 files changed, 164 insertions(+), 39 deletions(-) diff --git a/MidiPlayer.Droid/MainActivity.Component.cs b/MidiPlayer.Droid/MainActivity.Component.cs index bdf8d5f..a412f87 100644 --- a/MidiPlayer.Droid/MainActivity.Component.cs +++ b/MidiPlayer.Droid/MainActivity.Component.cs @@ -68,15 +68,31 @@ void initializeComponent() { _numberPickerProg = FindViewById(Resource.Id.number_picker_prog); _numberPickerProg.MinValue = 1; _numberPickerProg.MaxValue = 128; + _numberPickerProg.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) => { + var fader = Mixer.GetCurrent(); + fader.Program = _numberPickerProg.Value; + }; _numberPickerPan = FindViewById(Resource.Id.number_picker_pan); _numberPickerPan.MinValue = 1; _numberPickerPan.MaxValue = 128; _numberPickerPan.Value = 65; + _numberPickerPan.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) => { + var fader = Mixer.GetCurrent(); + fader.Pan = _numberPickerPan.Value; + }; _numberPickerVol = FindViewById(Resource.Id.number_picker_vol); _numberPickerVol.MinValue = 1; _numberPickerVol.MaxValue = 128; _numberPickerVol.Value = 104; + _numberPickerVol.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) => { + var fader = Mixer.GetCurrent(); + fader.Volume = _numberPickerVol.Value; + }; _checkBoxMute = FindViewById(Resource.Id.check_box_mute); + _checkBoxMute.CheckedChange += (object sender, CheckBox.CheckedChangeEventArgs e) => { + var fader = Mixer.GetCurrent(); + fader.Sounds = !_checkBoxMute.Checked; + }; _buttonSendSynth = FindViewById