public MidiControlViewModel(IEventAggregator ea, IRegionManager region, IUnityContainer container, MidiIn midiIn, MidiOut midiOut) { _ea = ea; _region = region; _container = container; //Inject midi + event subscriptions _mIn = midiIn; _mOut = midiOut; _mIn.MessageReceived += _mIn_MessageReceived; _mIn.ErrorReceived += _mIn_ErrorReceived; _scopedRegion = _region.CreateRegionManager(); //Initialize midi and scale listings ScaleList = new List <string>(Scales.GetScaleNames()); MidiChannels = Enumerable.Range(1, 16).ToList(); KeyList = Keys.GetKeyNames(); SelectedChannel = MidiChannels.First(); SelectedScale = ScaleList.First(); SelectedKey = KeyList.First(); UserInputMode = false; //Initialize Values LengthList = "500"; //500ms OctaveList = "0"; //Middle-Octave Repeat = 1; //Play Once //Init to Middle-C value to sliders SetNotes(NoteLogic.OctaveC[4], NoteLogic.OctaveC[4], NoteLogic.OctaveC[4], NoteLogic.OctaveC[4]); //Bind Commands to Methods StartInvProgressionCommand = new DelegateCommand(StartInversion); PlayMelody1 = new DelegateCommand(StartMelody1); PlayMelody2 = new DelegateCommand(StartMelody2); PlayMelody3 = new DelegateCommand(StartMelody3); PlayMelody4 = new DelegateCommand(StartMelody4); RollTheDiceCommand = new DelegateCommand(RollTheDice); //Strum begin Strum1BCommand = new DelegateCommand(Strum1B); Strum2BCommand = new DelegateCommand(Strum2B); Strum3BCommand = new DelegateCommand(Strum3B); Strum4BCommand = new DelegateCommand(Strum4B); //Strum end Strum1ECommand = new DelegateCommand(Strum1E); Strum2ECommand = new DelegateCommand(Strum2E); Strum3ECommand = new DelegateCommand(Strum3E); Strum4ECommand = new DelegateCommand(Strum4E); //CC Panel ConfigList = new ObservableCollection <string>(ControlChangeLogic.GetSynthConfigs()); }
/// <summary> /// Creates and initializes a <see cref="KeyAfterTouchMessage"/> from the specified parameters. /// </summary> /// <param name="channel">A <see cref="MidiChannels"/> to associate with the message.</param> /// <param name="pitch">An <see cref="int"/> specifying the pitch value.</param> public KeyAfterTouchMessage(MidiChannels channel, int note, int pressure) : base(ChannelMessageTypes.ProgramChange, channel, note, pressure) { }
/// <summary> /// Creates and initializes a <see cref="ChannelAfterTouchMessage"/> from the specified parameters. /// </summary> /// <param name="channel">A <see cref="MidiChannels"/> to associate with the message.</param> /// <param name="pitch">An <see cref="int"/> specifying the pitch value.</param> public ChannelAfterTouchMessage(MidiChannels channel, int pressure) : base(ChannelMessageTypes.ProgramChange, channel, pressure, 0) { }
/// <summary> /// Creates and initializes a <see cref="PitchBendMessage"/> from the specified parameters. /// </summary> /// <param name="channel">A <see cref="MidiChannels"/> to associate with the message.</param> /// <param name="pitch">An <see cref="int"/> specifying the pitch value.</param> public PitchBendMessage(MidiChannels channel, int pitch) : base(ChannelMessageTypes.ProgramChange, channel, (pitch + 0x2000) & 0x7F, (pitch + 0x2000) >> 7) { }
/// <summary> /// Creates and initializes a <see cref="ControlChangeMessage"/> from the specified parameters. /// </summary> /// <param name="channel">A <see cref="MidiChannels"/> to associate with the message.</param> /// <param name="value">An <see cref="int"/> specifying the controller value.</param> public ProgramChangeMessage(MidiChannels channel, int value) : base(ChannelMessageTypes.ProgramChange, channel, value, 0) { }
/// <summary> /// Creates and initializes a <see cref="ControlChangeMessage"/> from the specified parameters. /// </summary> /// <param name="channel">A <see cref="MidiChannels"/> to associate with the message.</param> /// <param name="controller">An <see cref="int"/> specifying the controller number.</param> /// <param name="value">An <see cref="int"/> specifying the controller value.</param> public ControlChangeMessage(MidiChannels channel, int controller, int value) : base(ChannelMessageTypes.ControlChange, channel, controller, value) { }
/// <summary> /// Creates and initializes a <see cref="NoteOffMessage"/> from the specified parameters. /// </summary> /// <param name="channel">A <see cref="MidiChannels"/> to associate with the message.</param> /// <param name="note">An <see cref="int"/> specifying the note.</param> /// <param name="velocity">An <see cref="int"/> specifying the velocity of the note.</param> public NoteOffMessage(MidiChannels channel, int note, int velocity) : base(ChannelMessageTypes.NoteOff, channel, note, velocity) { }
/// <summary> /// Creates and initializes a <see cref="ChannelMessage"/> from the specified parameters. /// </summary> /// <param name="type">A <see cref="ChannelMessageTypes"/> specifying the type of message.</param> /// <param name="channel">A <see cref="MidiChannels"/> specifying the MIDI channel associated with the message.</param> /// <param name="dataA">An <see cref="int"/> specifying the first data part of the message.</param> /// <param name="dataB">An <see cref="int"/> specifying the second data part of the message.</param> public ChannelMessage(ChannelMessageTypes type, MidiChannels channel, int dataA, int dataB) : base((int)type, dataA, dataB) { this.Channel = channel; }