private void setupMidi() { manager = (MidiManager)GetSystemService(MidiService); if (manager == null) { Toast.MakeText(this, "MidiManager is null!", ToastLength.Long).Show(); return; } port = new PortEnvoi(manager, this); //Bouton bleu bleu.Click += (sender, e) => { noteOn(1, 50, DEFAULT_VELOCITY); }; //Bouton Vert vert.Click += (sender, e) => { noteOff(1, 50, DEFAULT_VELOCITY); }; //Bouton Rouge rouge.Click += (sender, e) => { noteOn(1, 50, DEFAULT_VELOCITY); Thread.Sleep(1000); noteOff(1, 50, DEFAULT_VELOCITY); }; }
public void Unload() { SaveSettings(); Library.SaveToDatabase(); LoopLibrary.SaveToCache(); BassPlayer.Dispose(); MidiManager.Dispose(); }
private void refreshPorts() { MidiManager.RefreshDevices(); updatePorts(_device); raisePropertyChanged("InPorts"); raisePropertyChanged("InPort"); raisePropertyChanged("OutPorts"); raisePropertyChanged("OutPort"); }
internal void RemoveTrack() { if (!MidiManager.Tracks.Any()) { return; } MidiManager.RemoveTrack(model.SelectedTrack); InitTracks(); }
// Use this for initialization void Start() { midi = GetComponent <MidiManager>(); midi.OnMidiInput += MidiInput; Debug.Log("input device num : " + midi.MidiInGetNumDevs()); Debug.Log("output device num : " + midi.MidiOutGetNumDevs()); midi.MidiInOpen(0); }
private MidiOutPort( string deviceId, MidiDeviceInfo deviceInfo, MidiDeviceInfo.PortInfo portInfo) { _midiManager = ContextHelper.Current.GetSystemService(Context.MidiService).JavaCast <MidiManager>(); DeviceId = deviceId ?? throw new ArgumentNullException(nameof(deviceId)); _deviceInfo = deviceInfo ?? throw new ArgumentNullException(nameof(deviceInfo)); _portInfo = portInfo ?? throw new ArgumentNullException(nameof(portInfo)); }
public void ReloadMidiDevice() { MidiManager.OpenMidiDevice(SelectedMidiInputDevice, SelectedMidiOutputDevice); //DEBUG //MidiManager.OpenMidiDevice(MidiManager.GetMidiInputDevices().Last(), MidiManager.GetMidiOutputDevices().Last()); SettingsManager.Settings.LastMidiInputDevice = SelectedMidiInputDevice.Id; SettingsManager.Settings.LastMidiOutputDevice = SelectedMidiOutputDevice.Id; OnPropertyChanged(nameof(ConnectedMidiInputDevice)); OnPropertyChanged(nameof(ConnectedMidiOutputDevice)); }
public PortEnvoi(MidiManager m, MainActivity act) { manager = m; activity = act; texte = (TextView)activity.FindViewById <TextView>(Resource.Id.textViewDevice); manager.RegisterDeviceCallback(this, new Android.OS.Handler()); MidiDeviceInfo[] infos = manager.GetDevices(); foreach (MidiDeviceInfo info in infos) { onDeviceAdded(info); } manager.OpenDevice(portInfo, this, null); }
public AndroidMidiAccess(Context context) { _midiServiceIntent = new Intent(context, typeof(MidiSynthDeviceService)); //_midiServiceIntent.SetAction("android.media.midi.MidiDeviceService"); context.StartService(_midiServiceIntent); _midiManager = context.GetSystemService(Context.MidiService).JavaCast <MidiManager> (); _midiCallback = new MidiDeviceCallback(); _midiCallback.DeviceAdded += OnMidiDeviceAdded; _midiCallback.DeviceRemoved += OnMidiDeviceRemoved; _midiCallback.DeviceStatusChanged += OnMidiDeviceStatusChanged; UpdateInputDevices(false); UpdateOutputDevices(false); }
void Update() { if (_isInRing && ProgramManager.instance.isUsingMidi && !ProgramManager.instance.isShowingFrequency) { if (MidiManager.GetKeyDown(ProgramManager.pitchMidiDict [GetComponentInChildren <Text> ().text])) { Destroy(gameObject); } if (Input.GetKey(KeyCode.Space)) { Destroy(gameObject); } } if (MidiManager.GetKeyDown(ProgramManager.pitchMidiDict [GetComponentInChildren <Text> ().text])) { Debug.LogWarning("kek"); } }
/// <summary> /// /// </summary> public static void Panic() { for (int i = 0; i < 16; i++) { //All Note Off var me = new ControlChangeEvent((SevenBitNumber)123, (SevenBitNumber)0); me.Channel = (FourBitNumber)i; MidiManager.SendMidiEvent(MidiPort.PortAB, me); //All Sounds Off me = new ControlChangeEvent((SevenBitNumber)120, (SevenBitNumber)0); me.Channel = (FourBitNumber)i; MidiManager.SendMidiEvent(MidiPort.PortAB, me); } foreach (var inst in InstrumentManager.GetAllInstruments()) { inst.AllSoundOff(); } }
// Use this for initialization void Start() { Instance = this; ToonLit = Resources.Load <UnityEngine.Material>("ToonLit"); BlackOcclusion = Resources.Load <UnityEngine.Material>("BlackOcclusion"); Wireframe = Resources.Load <UnityEngine.Material>("Rainbow Wireframe"); Basic = Resources.Load <UnityEngine.Material>("Basic"); Pink = Resources.Load <UnityEngine.Material>("Pink"); LinePattern = Resources.Load <UnityEngine.Material>("LinePattern"); GranOutline = Resources.Load <UnityEngine.Material>("GranOutline"); BlackBlockout = GameObject.Find("BlackBlockout").GetComponent <BlockoutController>(); WhiteBlockout = GameObject.Find("WhiteBlockout").GetComponent <BlockoutController>(); TrackerSceneOutputQuadRenderer = TrackerSceneOutputQuad.GetComponent <Renderer>(); TrackerSceneFlippedOutputQuadRenderer = TrackerSceneFlippedOutputQuad.GetComponent <Renderer>(); ParticleSceneObject = GameObject.Find("ParticleScene"); RainParticlesObject = GameObject.Find("RainParticles"); RainParticleController = GameObject.Find("RainParticleController").GetComponent <RainController>(); foreach (InputDevice inputDevice in InputDevice.InstalledDevices) { if (inputDevice.Name.ToLower().Equals(DeviceName.ToLower())) { InputDevice = inputDevice; break; } } if (InputDevice != null) { InputDevice.Open(); InputDevice.StartReceiving(null); InputDevice.NoteOn += RouteNoteOn; InputDevice.NoteOn += InformationMonitor.Instance.MidiNoteOn; InputDevice.NoteOff += InformationMonitor.Instance.MidiNoteOff; Debug.Log("Opened MIDI Device"); } }
internal void InsertNote(double start, double end, int noteIndex) { if (MidiManager.IsPlaying) { return; } // Generate Midi Note int channel = 0; int velocity = UiManager.plotVelocity; var msgs = MidiManager.CreateNote( channel, noteIndex, model.Track, start, end, velocity); // Draw it on MidiRoll DrawNote(start, end, noteIndex, msgs.Item1, msgs.Item2); }
/// <summary> /// Opens a new settings window or destroys and recreates one if it is already open. /// Additionally we initiallise some of the data required for the bindings in the settings (Populate the midi devices). /// </summary> public void OpenSettingsWindow() { if (settingsWindow?.IsVisible ?? false)//if a settings window is already visible close it and make a new one { settingsWindow.Close(); } settingsWindow = new SettingsWindow(); settingsWindow.DataContext = this; settingsWindow.Show(); //Get available midi devices MidiInputDevices.Clear(); foreach (IMidiPortDetails device in MidiManager.GetMidiInputDevices()) { MidiInputDevices.Add(device); } MidiOutputDevices.Clear(); foreach (IMidiPortDetails device in MidiManager.GetMidiOutputDevices()) { MidiOutputDevices.Add(device); } }
public ShufflerApplication() { BassPlayer = new BassPlayer(); Library = new Library(BassPlayer); CollectionHelper.Library = Library; LoopLibrary = new LoopLibrary(BassPlayer); LoadSettings(); MixLibrary = new MixLibrary(Library.ShufflerFolder); TrackSampleLibrary = new TrackSampleLibrary(BassPlayer, Library); MidiManager = new MidiManager(); MidiMapper = new BassPlayerMidiMapper(BassPlayer, MidiManager); //LoopLibrary = new LoopLibrary(BassPlayer, @"E:\OneDrive\Music\Samples\Hiphop\Future Loops Scratch Anthology"); LoadFromDatabase(); BassPlayer.OnTrackQueued += BassPlayer_OnTrackQueued; }
public void DrawPianoRoll() { view.TrackNotes.Children.Clear(); int noteWithoutOctave; Brush currentColor = Brushes.White; for (int i = 0; i < 128; i++) { // identify note noteWithoutOctave = i % 12; // choose note color switch (noteWithoutOctave) { case 0: currentColor = Brushes.White; break; case 1: currentColor = Brushes.Black; break; case 2: currentColor = Brushes.White; break; case 3: currentColor = Brushes.Black; break; case 4: currentColor = Brushes.White; break; case 5: currentColor = Brushes.White; break; case 6: currentColor = Brushes.Black; break; case 7: currentColor = Brushes.White; break; case 8: currentColor = Brushes.Black; break; case 9: currentColor = Brushes.White; break; case 10: currentColor = Brushes.Black; break; case 11: currentColor = Brushes.White; break; } if (i == 60) { currentColor = Brushes.Yellow; } if (i == 69) { currentColor = Brushes.Cyan; } // make rectangle Rectangle rec = new Rectangle { Width = 15, Height = model.CellHeigth, Fill = currentColor, Stroke = Brushes.Gray, StrokeThickness = .5f }; // place rectangle Canvas.SetLeft(rec, 0); Canvas.SetTop(rec, (127 - i) * model.CellHeigth); // piano toucn on rectangle int j = i; rec.MouseLeftButtonDown += (s, e) => MidiManager.Playback(true, j); rec.MouseLeftButtonUp += (s, e) => MidiManager.Playback(false, j); rec.MouseLeave += (s, e) => MidiManager.Playback(false, j); // add it to the control view.TrackNotes.Children.Add(rec); view.TrackNotes.Height = 127 * model.CellHeigth; view.TrackBody.Height = 127 * model.CellHeigth; } }
public SongEditorMidiSoundPlayAlongThread(Settings settings, SongMeta songMeta, MidiManager midiManager) { this.settings = settings; this.songMeta = songMeta; this.midiManager = midiManager; }
public MidiAccess(Context context) { midi_manager = context.GetSystemService(Context.MidiService).JavaCast <MidiManager> (); }
private void OnGameLaunched(object sender, GameLaunchedEventArgs e) { midiManager = new MidiManager(this.Monitor); }
public void SetUp() { _out = new ConstantSignal <double>(() => 0.0); if (_midiManager != null) { _plugin.MidiProcessor.NoteOff -= _midiManager.NoteOff; _plugin.MidiProcessor.NoteOn -= _midiManager.NoteOn; } _midiManager = new MidiManager(NoteChannels); _plugin.MidiProcessor.NoteOff += _midiManager.NoteOff; _plugin.MidiProcessor.NoteOn += _midiManager.NoteOn; _scratchBuffer1 = new double[this.BlockSize, 1]; _scratchBuffer2 = new double[this.BlockSize, 1]; _scratchBuffer3 = new double[this.BlockSize, 1]; _scratchBuffer4 = new double[this.BlockSize, 1]; _scratchBuffer5 = new double[this.BlockSize, 1]; _scratchBuffer6 = new double[this.BlockSize, 1]; _scratchBufferChannels1 = new double[this.BlockSize, NoteChannels]; _scratchBufferChannels2 = new double[this.BlockSize, NoteChannels]; _scratchBufferChannels3 = new double[this.BlockSize, NoteChannels]; _scratchBufferChannels4 = new double[this.BlockSize, NoteChannels]; _scratchBufferChannels5 = new double[this.BlockSize, NoteChannels]; _scratchBufferChannels6 = new double[this.BlockSize, NoteChannels]; _blockSize = BlockSize; _sampleRate = SampleRate; var sine1 = new Oscillator(NoteChannels, this.SampleRate) { Shape = Oscillator.WaveShape.Sine, Frequency = _midiManager.ChannelFrequencies, OctaveShift = new ConstantSignal <int>(() => _plugin.Model.Path1OctaveShift), Amplitude = new ConstantSignal <double>(() => _plugin.Model.Sine) }; sine1.Out.Buffer = _scratchBufferChannels1; var square1 = new Oscillator(NoteChannels, this.SampleRate) { Shape = Oscillator.WaveShape.Square, Frequency = _midiManager.ChannelFrequencies, OctaveShift = new ConstantSignal <int>(() => _plugin.Model.Path1OctaveShift), Amplitude = new ConstantSignal <double>(() => _plugin.Model.Square) }; square1.Out.Buffer = _scratchBufferChannels2; var triangle1 = new Oscillator(NoteChannels, this.SampleRate) { Shape = Oscillator.WaveShape.Triangle, Frequency = _midiManager.ChannelFrequencies, OctaveShift = new ConstantSignal <int>(() => _plugin.Model.Path1OctaveShift), Amplitude = new ConstantSignal <double>(() => _plugin.Model.Triangle) }; triangle1.Out.Buffer = _scratchBufferChannels3; var sine2 = new Oscillator(NoteChannels, this.SampleRate) { Shape = Oscillator.WaveShape.Sine, Frequency = _midiManager.ChannelFrequencies, OctaveShift = new ConstantSignal <int>(() => _plugin.Model.Path2OctaveShift), Amplitude = new ConstantSignal <double>(() => _plugin.Model.Sine) }; sine2.Out.Buffer = _scratchBufferChannels4; var square2 = new Oscillator(NoteChannels, this.SampleRate) { Shape = Oscillator.WaveShape.Square, Frequency = _midiManager.ChannelFrequencies, OctaveShift = new ConstantSignal <int>(() => _plugin.Model.Path2OctaveShift), Amplitude = new ConstantSignal <double>(() => _plugin.Model.Square) }; square2.Out.Buffer = _scratchBufferChannels5; var triangle2 = new Oscillator(NoteChannels, this.SampleRate) { Shape = Oscillator.WaveShape.Triangle, Frequency = _midiManager.ChannelFrequencies, OctaveShift = new ConstantSignal <int>(() => _plugin.Model.Path2OctaveShift), Amplitude = new ConstantSignal <double>(() => _plugin.Model.Triangle) }; triangle2.Out.Buffer = _scratchBufferChannels6; var sourceSum1 = new Sum("sourceSum"); sourceSum1.Inputs.Add(sine1.Out); sourceSum1.Inputs.Add(square1.Out); sourceSum1.Inputs.Add(triangle1.Out); sourceSum1.Buffer = _scratchBufferChannels1; var sourceSum2 = new Sum("sourceSum2"); sourceSum2.Inputs.Add(sine2.Out); sourceSum2.Inputs.Add(square2.Out); sourceSum2.Inputs.Add(triangle2.Out); sourceSum2.Buffer = _scratchBufferChannels4; var adsr1 = new Adsr(NoteChannels, this.SampleRate) { ReleaseDuration = new ConstantSignal <double>(() => _plugin.Model.ReleaseDuration / 5), AttackDuration = new ConstantSignal <double>(() => _plugin.Model.AttackDuration / 10), DecayDuration = new ConstantSignal <double>(() => _plugin.Model.DecayDuration / 10), Attack = new ConstantSignal <double>(() => _plugin.Model.AttackStrength), Sustain = new ConstantSignal <double>(() => _plugin.Model.SustainStrength), Triggers = _midiManager.ChannelTriggers, Input = sourceSum1 }; adsr1.Out.Buffer = _scratchBufferChannels1; var adsr2 = new Adsr(NoteChannels, this.SampleRate) { ReleaseDuration = new ConstantSignal <double>(() => _plugin.Model.ReleaseDuration / 5), AttackDuration = new ConstantSignal <double>(() => _plugin.Model.AttackDuration / 10), DecayDuration = new ConstantSignal <double>(() => _plugin.Model.DecayDuration / 10), Attack = new ConstantSignal <double>(() => _plugin.Model.AttackStrength), Sustain = new ConstantSignal <double>(() => _plugin.Model.SustainStrength), Triggers = _midiManager.ChannelTriggers, Input = sourceSum2 }; adsr2.Out.Buffer = _scratchBufferChannels4; var delayOsc = new Oscillator(1, SampleRate) { Shape = Oscillator.WaveShape.Triangle, Frequency = new ConstantSignal <double>(() => _plugin.Model.Delay1PlaybackSpeedFreq), Amplitude = new ConstantSignal <double>(() => Math.Pow(_plugin.Model.Delay1PlaybackSpeedMod, 3) / 2), Base = new ConstantSignal <double>(() => 1) }; delayOsc.Out.Buffer = _scratchBuffer1; var delay1 = new Delay() { DelayLength = new ConstantSignal <int>(() => _plugin.Model.Delay1Length), PlaybackSpeed = delayOsc.Out, Gain = new ConstantSignal <double>(() => _plugin.Model.Delay1Gain) }; delay1.Out.Buffer = _scratchBuffer2; var combine1 = new Mix("Combine"); combine1.Inputs.Add(delay1.Out); combine1.Inputs.Add(adsr1.Out.Flat((sum, cur) => sum + cur, 0d)); combine1.Strengths.Add(new ConstantSignal <double>(() => _plugin.Model.Wet1)); combine1.Strengths.Add(new ConstantSignal <double>(() => 1 - _plugin.Model.Wet1)); combine1.Buffer = _scratchBuffer3; var lowPass1 = new LowPass("lowpass1") { Scale = new ConstantSignal <int>(() => _plugin.Model.Filter1), Input = combine1 }; lowPass1.Buffer = _scratchBuffer4; delay1.Input = lowPass1; var combine2 = new Mix("Combine2"); combine2.Inputs.Add(delay1.Out); combine2.Inputs.Add(adsr2.Out.Flat((sum, cur) => sum + cur, 0d)); combine2.Strengths.Add(new ConstantSignal <double>(() => _plugin.Model.Gain1)); combine2.Strengths.Add(new ConstantSignal <double>(() => _plugin.Model.Gain2)); combine2.Buffer = _scratchBuffer6; var softClip = new ApplyFunction(sample => sample / (1 + Math.Abs(sample)), "SoftClip") { Buffer = _scratchBuffer6, Input = combine2 }; _out = softClip; }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { MidiManager.ChangeInstrument(Model.Track, ComboInstruments.SelectedIndex); }
private void ContinueButton_Click(object sender, RoutedEventArgs e) { MidiManager.Continue(); }
private void PianoControl_PianoKeyUp(object sender, PianoKeyEventArgs e) { MidiManager.Playback(false, e.NoteID); }
void Awake() { Instance = this; }
/// <summary> /// /// </summary> public FormFmEditor(InstrumentBase inst, TimbreBase timbre, bool singleSelect) { InitializeComponent(); this.singleSelect = singleSelect; for (int nn = 0; nn < 128; nn++) { toolStripComboBoxNote.Items.Add(MidiManager.GetNoteName((SevenBitNumber)nn) + "(" + nn + ")"); toolStripComboBoxVelo.Items.Add(nn); } toolStripComboBoxNote.SelectedIndex = 60; toolStripComboBoxVelo.SelectedIndex = 127; toolStripComboBoxGate.SelectedIndex = 0; toolStripComboBoxCh.SelectedIndex = 0; toolStripComboBoxCC.SelectedIndex = 0; Settings.Default.SettingsLoaded += Default_SettingsLoaded; toolStripButtonPlay.Checked = Settings.Default.FmPlayOnEdit; toolStripButtonHook.Checked = Settings.Default.FmHook; toolStripComboBoxVelo.SelectedIndex = Settings.Default.FmVelocity; toolStripComboBoxGate.SelectedIndex = Settings.Default.FmGateTime; toolStripComboBoxNote.SelectedIndex = Settings.Default.FmNote; if (singleSelect) { pianoControl1.TargetTimbres = new TimbreBase[] { timbre } } ; this.Timbre = timbre; this.Instrument = inst; ignoreMetroComboBoxTimbres_SelectedIndexChanged = true; for (int i = 0; i < Instrument.BaseTimbres.Length; i++) { metroComboBoxTimbres.Items.Add(new TimbreItem(inst.BaseTimbres[i], i)); if (inst.BaseTimbres[i] == timbre) { TimbreNo = i; } } metroComboBoxTimbres.SelectedIndex = TimbreNo; ignoreMetroComboBoxTimbres_SelectedIndexChanged = false; if (singleSelect) { metroComboBoxTimbres.Enabled = false; metroButtonImportAll.Enabled = false; metroButtonImportAllGit.Enabled = false; } setTitle(); InstrumentManager.InstrumentChanged += InstrumentManager_InstrumentChanged; InstrumentManager.InstrumentRemoved += InstrumentManager_InstrumentRemoved; pianoControl1.NoteOn += PianoControl1_NoteOn; pianoControl1.NoteOff += PianoControl1_NoteOff; pianoControl1.EntryDataChanged += PianoControl1_EntryDataChanged; Midi.MidiManager.MidiEventHooked += MidiManager_MidiEventHooked; }
protected override void Start() { base.Start(); MidiManager.RegisterButton(this); }
private void StopButton_Click(object sender, RoutedEventArgs e) { MidiManager.Stop(); }
public void ResetMidi() { MidiManager.Reset(); }
private void Window_Closing(object sender, CancelEventArgs e) { MidiManager.Stop(); Ctrl.Close(); }
private static void CloseApp(object sender, EventArgs e) { MidiManager.Close(); Running = false; }