<commit_before>using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Xml;
using System.Text;
using System.ComponentModel;

using Moritz.Globals;
using Moritz.Score.Midi;

namespace Moritz.Score.Midi
{
    /// <summary>
    /// The following classes contain an InputControls field:
    ///     OutputVoice (If the score contains an InputVoice, OutputVoice.InputControls may not be null.)
    ///         Options that affect current OutputChords in this OutputVoice. 
    ///     MidiChordDef (MidiChordDef.InputControls may be null.)
    ///         if non-null, non-null options change the current values in
    ///         the containing OutputVoice.InputControls.  
    /// </summary>
    public class InputControls
    {
        public InputControls(bool nullDefaults)
        {
            if(!nullDefaults)
            {
                this.NoteOnKeyOption = Moritz.Score.Midi.NoteOnKeyOption.ignore;
                this.NoteOnVelocityOption = Moritz.Score.Midi.NoteOnVelocityOption.ignore;
                this.NoteOffOption = Moritz.Score.Midi.NoteOffOption.ignore;
                this.PressureOption = ControllerOption.ignore;
                this.PitchWheelOption = ControllerOption.ignore;
                this.ModWheelOption = ControllerOption.ignore;
            }
        }

        public void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("score", "inputControls", null);

            if(NoteOnKeyOption != null)
                w.WriteAttributeString("noteOnKey", this.NoteOnKeyOption.ToString());
            if(NoteOnVelocityOption != null)
                w.WriteAttributeString("noteOnVel", this.NoteOnVelocityOption.ToString());
            if(NoteOffOption != null)
            {
                w.WriteAttributeString("noteOff", this.NoteOffOption.ToString());
                if(this.NoteOffOption == Moritz.Score.Midi.NoteOffOption.limitedFade)
                {
                    Debug.Assert(NumberOfObjectsInFade != null);
                    w.WriteAttributeString("fixedFade", NumberOfObjectsInFade.ToString());
                }
            }

            bool isControllingVolume = false;
            if(PressureOption != null)
            {
                w.WriteAttributeString("pressure", this.PressureOption.ToString());
                if(this.PressureOption == Moritz.Score.Midi.ControllerOption.volume)
                {
                    Debug.Assert(MinimumVolume != null);
                    w.WriteAttributeString("minVolume", MinimumVolume.ToString());
                    isControllingVolume = true;
                }
            }
            if(PitchWheelOption != null)
            {
                w.WriteAttributeString("pitchWheel", this.PitchWheelOption.ToString());
                if(this.PitchWheelOption == Moritz.Score.Midi.ControllerOption.volume)
                {
                    Debug.Assert(isControllingVolume == false);
                    Debug.Assert(MinimumVolume != null);
                    w.WriteAttributeString("minVolume", MinimumVolume.ToString());
                    isControllingVolume = true;
                }
            }
            if(ModWheelOption != null)
            {
                w.WriteAttributeString("modulation", this.ModWheelOption.ToString());
                if(this.ModWheelOption == Moritz.Score.Midi.ControllerOption.volume)
                {
                    Debug.Assert(isControllingVolume == false);
                    Debug.Assert(MinimumVolume != null);
                    w.WriteAttributeString("minVolume", MinimumVolume.ToString());
                }
            }

            if(MasterVolume != null)
            {
                w.WriteAttributeString("masterVolume", MasterVolume.ToString());
            }
           
            w.WriteEndElement(); // score:inputControls
        }

        public NoteOnKeyOption? NoteOnKeyOption = null; // default will be NoteOnKeyOption.matchExactly;
        public NoteOnVelocityOption? NoteOnVelocityOption = null; // default will be NoteOnVelocityOption.ignore;
        public NoteOffOption? NoteOffOption = null; // default will be NoteOffOption.ignore;

        public ControllerOption? PressureOption = null; // default will be ControllerOption.ignore;
        public ControllerOption? PitchWheelOption = null; // default will be ControllerOption.ignore;
        public ControllerOption? ModWheelOption = null; // default will be ControllerOption.ignore; 

        public int? NumberOfObjectsInFade = null; // default will be 0; // only used in conjunction with NoteOffOption.limitedFade

        public byte? MasterVolume = null; // default is the channel masterVolume; // only used if the performer is controlling the volume
        public byte? MinimumVolume = null; // only used if the performer is controlling the volume
    }

    public enum NoteOnKeyOption
    {
        [Description("ignore")]
        ignore = 0,
        [Description("transpose")]
        transpose = 1,
        [Description("matchExactly")]
        matchExactly = 2
    };
<commit_msg>Improved InputControls Volume options<commit_after>using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Xml;
using System.Text;
using System.ComponentModel;

using Moritz.Globals;
using Moritz.Score.Midi;

namespace Moritz.Score.Midi
{
    /// <summary>
    /// The following classes contain an InputControls field:
    ///     OutputVoice (If the score contains an InputVoice, OutputVoice.InputControls may not be null.)
    ///         Options that affect current OutputChords in this OutputVoice. 
    ///     MidiChordDef (MidiChordDef.InputControls may be null.)
    ///         if non-null, non-null options change the current values in
    ///         the containing OutputVoice.InputControls.  
    /// </summary>
    public class InputControls
    {
        public InputControls(bool nullDefaults)
        {
            if(!nullDefaults)
            {
                this.NoteOnKeyOption = Moritz.Score.Midi.NoteOnKeyOption.ignore;
                this.NoteOnVelocityOption = Moritz.Score.Midi.NoteOnVelocityOption.ignore;
                this.NoteOffOption = Moritz.Score.Midi.NoteOffOption.ignore;
                this.PressureOption = ControllerOption.ignore;
                this.PitchWheelOption = ControllerOption.ignore;
                this.ModWheelOption = ControllerOption.ignore;
            }
        }

        public void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("score", "inputControls", null);

            if(NoteOnKeyOption != null)
                w.WriteAttributeString("noteOnKey", this.NoteOnKeyOption.ToString());
            if(NoteOnVelocityOption != null)
                w.WriteAttributeString("noteOnVel", this.NoteOnVelocityOption.ToString());
            if(NoteOffOption != null)
            {
                w.WriteAttributeString("noteOff", this.NoteOffOption.ToString());
                if(this.NoteOffOption == Moritz.Score.Midi.NoteOffOption.limitedFade)
                {
                    Debug.Assert(NumberOfObjectsInFade != null);
                    w.WriteAttributeString("fixedFade", NumberOfObjectsInFade.ToString());
                }
            }

            bool isControllingVolume = false;
            if(PressureOption != null)
            {
                w.WriteAttributeString("pressure", this.PressureOption.ToString());
                if(this.PressureOption == Moritz.Score.Midi.ControllerOption.volume)
                {
                    Debug.Assert(MaximumVolume != null);
                    Debug.Assert(MinimumVolume != null);
                    w.WriteAttributeString("maxVolume", MaximumVolume.ToString());
                    w.WriteAttributeString("minVolume", MinimumVolume.ToString());
                    isControllingVolume = true;
                }
            }
            if(PitchWheelOption != null)
            {
                w.WriteAttributeString("pitchWheel", this.PitchWheelOption.ToString());
                if(this.PitchWheelOption == Moritz.Score.Midi.ControllerOption.volume)
                {
                    Debug.Assert(isControllingVolume == false);
                    Debug.Assert(MaximumVolume != null);
                    Debug.Assert(MinimumVolume != null);
                    w.WriteAttributeString("maxVolume", MaximumVolume.ToString());
                    w.WriteAttributeString("minVolume", MinimumVolume.ToString());
                    isControllingVolume = true;
                }
            }
            if(ModWheelOption != null)
            {
                w.WriteAttributeString("modulation", this.ModWheelOption.ToString());
                if(this.ModWheelOption == Moritz.Score.Midi.ControllerOption.volume)
                {
                    Debug.Assert(isControllingVolume == false);
                    Debug.Assert(MaximumVolume != null);
                    Debug.Assert(MinimumVolume != null);
                    w.WriteAttributeString("maxVolume", MaximumVolume.ToString());
                    w.WriteAttributeString("minVolume", MinimumVolume.ToString());
                }
            }
           
            w.WriteEndElement(); // score:inputControls
        }

        public NoteOnKeyOption? NoteOnKeyOption = null; // default will be NoteOnKeyOption.matchExactly;
        public NoteOnVelocityOption? NoteOnVelocityOption = null; // default will be NoteOnVelocityOption.ignore;
        public NoteOffOption? NoteOffOption = null; // default will be NoteOffOption.ignore;

        public ControllerOption? PressureOption = null; // default will be ControllerOption.ignore;
        public ControllerOption? PitchWheelOption = null; // default will be ControllerOption.ignore;
        public ControllerOption? ModWheelOption = null; // default will be ControllerOption.ignore; 

        public int? NumberOfObjectsInFade = null; // default will be 0; // only used in conjunction with NoteOffOption.limitedFade

        public byte? MaximumVolume = null; // only used if the performer is controlling the volume (often set to the channel masterVolume)
        public byte? MinimumVolume = null; // only used if the performer is controlling the volume (often set to about 50)
    }

    public enum NoteOnKeyOption
    {
        [Description("ignore")]
        ignore = 0,
        [Description("transpose")]
        transpose = 1,
        [Description("matchExactly")]
        matchExactly = 2
    };

{'fraction_non_alphanumeric': 0.09121171770972038, 'fraction_numerical': 0.0009511128019783146, 'mean_word_length': 2.0154860911958705, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6867845', 'n_tokens_mistral': 2662, 'n_tokens_neox': 2499, 'n_words': 537}