private void HideShowFontFXControls() { if (cmbOutStream.SelectedItem != null && MidiPlay.IsBuiltIn((string)cmbOutStream.SelectedItem)) { lblcmbFontStream.Show(); cmbFontStream.Show(); cmdFXStream.Show(); PopulateCmbFonts(cmbFontStream, Cfg.SoundFontStream, clsBassMidiInOut.eType.OutStream); } else { lblcmbFontStream.Hide(); cmbFontStream.Hide(); cmdFXStream.Hide(); } if (cmbOutKB.SelectedItem != null && MidiPlay.IsBuiltIn((string)cmbOutKB.SelectedItem)) { lblcmbFontKB.Show(); cmbFontKB.Show(); cmdFXKB.Show(); PopulateCmbFonts(cmbFontKB, Cfg.SoundFontKB, clsBassMidiInOut.eType.OutKB); //if (MidiPlay.OutMKB != null) trkMidiOutKBVol.Value = MidiPlay.OutMKB.GetStreamVol(); } else { lblcmbFontKB.Hide(); cmbFontKB.Hide(); cmdFXKB.Hide(); } }
private void cmdConnectAll_Click(object sender, EventArgs e) { using (new clsWaitCursor()) { clsBASSOutDev.Disconnected = false; CloseAllStreams(); Interface.Apply(); OpenAllStreams(); try { MidiPlay.OpenMidiDevs(bassonly: true); } catch (AudioIOException exc) { MessageBox.Show("Audio IO Exception: " + exc.Message); return; } catch (MidiIOException exc) { MessageBox.Show("Midi IO Exception: " + exc.Message); return; } SetStates(); ShowCurrentConnection(); PlayableForms.CmdState_Set(); } }
internal static void CloseAllStreams() { if (P.F != null && P.F.AudioSync != null && P.F.AudioSync.MP3Player != null) { if (P.F.AudioSync.MP3Player is clsMP3Bass) { P.F.AudioSync.MP3Player.Free(); //should also stop play } } MidiPlay.CloseAllMidi(true); //if (MidiPlay.OutMStream is clsBassOutMidi) { // MidiPlay.OutMStream.Close(); // MidiPlay.OutMStream = new clsBassMidiOutNull(); //} //if (MidiPlay.OutMKB is clsBassOutMidi) { // MidiPlay.OutMKB.Close(); //MidiPlay.OutMKB may be null!!! // MidiPlay.OutMKB = new clsBassMidiOutNull(); //} if (P.BASSOutDev != null) { P.BASSOutDev.Close(); P.BASSOutDev = null; } }
private void PopulateCmbMidi(ComboBox cmb, clsMDevs devs, clsBassMidiInOut midi) { cmb.Items.Clear(); string[] devnames; try { devnames = devs.GetDevs(); } catch (MidiIOException) { return; } clsMidiInOut.eType type; if (cmb == cmbOutStream) { type = clsMidiInOut.eType.OutStream; } else if (cmb == cmbOutKB) { type = clsMidiInOut.eType.OutKB; } else if (cmb == cmbInKB) { type = clsMidiInOut.eType.InKB; } else { type = clsMidiInOut.eType.InSync; } foreach (string name in devnames) { if (cmb == cmbOutKB && name == "BuiltIn Synth (Stream)") { continue; } if (cmb == cmbOutStream && name == "BuiltIn Synth (KB)") { continue; } cmb.Items.Add(name); if (midi == null) { if (MidiPlay.IsBuiltIn(name)) { cmb.SelectedItem = clsMidiInOut.GetMidiDevName(type); } else { //cmb.SelectedItem = "None"; cmb.SelectedIndex = (cmb.Items.Count > 0) ? 0 : -1; } } else if (name == midi.MidiDevName) { cmb.SelectedItem = name; } } }
private void ConnectOutStream() { //* assumes device already closed if (cmbOutStream.SelectedIndex < 0) { MessageBox.Show("Error: OutStream device not selected"); return; } if (cmbFontStream.Enabled) { Cfg.SoundFontStream = (string)cmbFontStream.SelectedItem; } if (Cfg.SoundFontStream == null) { Cfg.SoundFontStream = ""; } string devnameoutstream = GetSelectedDevName(cmbOutStream); try { MidiPlay.OpenMidiDev(clsMidiInOut.eType.OutStream, devnameoutstream, false); } catch (AudioIOException exc) { MessageBox.Show("Audio IO Exception: " + exc.Message); return; } catch (MidiIOException exc) { MessageBox.Show("Midi IO Exception: " + exc.Message); return; } if (P.BASSOutDev == null && devnameoutstream == "BuiltIn Synth (Stream)") { MidiPlay.OpenAudioDevs(); } if (MidiPlay.OutMStream != null) { MidiPlay.OutMStream.SetFineTuning(trkMidiStreamFineTuning.Value); } Cfg.MidiOutStream = GetSelectedDevName(cmbOutStream); PostApply(); }
internal void OpenAllStreams() //called from Apply() { try { MidiPlay.OpenAudioDevs(); if (P.F != null && P.F.AudioSync != null && P.F.AudioSync.MP3Player != null) { if (P.F.AudioSync.MP3Player is clsMP3Bass) { P.BASSOutDev.ConnectFile((clsMP3Bass)P.F.AudioSync.MP3Player); P.F.AudioSync.MP3Player.Vol = P.frmSC.trkAudioVol.Value; } } //MidiPlay.OpenMidiDevs(true); //non-audio already open } catch (AudioIOException exc) { MessageBox.Show("Audio IO Exception: " + exc.Message); return; } catch (MidiIOException exc) { MessageBox.Show("Midi IO Exception: " + exc.Message); return; } }
//private void cmdDisconnect_Click(object sender, EventArgs e) { // using (new clsWaitCursor()) { // MidiPlay.CloseAllMidi(); // ShowCurrentConnection(); // } // SetStates(); //} //private void cmdApply_Click(object sender, EventArgs e) { // using (new clsWaitCursor()) { // Apply(); // //PlayableForms.CmdState_Set(); // } // SetStates(); //} private void ConnectInKB() { //* assumes device already closed if (cmbInKB.SelectedIndex < 0) { MessageBox.Show("Error: InMidiKB device not selected"); return; } string devnameinkb = GetSelectedDevName(cmbInKB); try { MidiPlay.OpenMidiDev(clsMidiInOut.eType.InKB, devnameinkb, false); } catch (AudioIOException exc) { MessageBox.Show("Audio IO Exception: " + exc.Message); return; } catch (MidiIOException exc) { MessageBox.Show("Midi IO Exception: " + exc.Message); return; } Cfg.MidiInKB = GetSelectedDevName(cmbInKB); PostApply(); }
private void DisconnectOutStream() { MidiPlay.CloseMidi(clsMidiInOut.eType.OutStream, false); ShowCurrentConnections(); }
private void DisconnectInKB() { MidiPlay.CloseMidi(clsMidiInOut.eType.InKB, false); P.frmSC.Refresh(); //PCKB or MidiIn ShowCurrentConnections(); }