Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
        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;
                }
            }
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
 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;
     }
 }
Esempio n. 7
0
        //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();
        }
Esempio n. 8
0
 private void DisconnectOutStream()
 {
     MidiPlay.CloseMidi(clsMidiInOut.eType.OutStream, false);
     ShowCurrentConnections();
 }
Esempio n. 9
0
 private void DisconnectInKB()
 {
     MidiPlay.CloseMidi(clsMidiInOut.eType.InKB, false);
     P.frmSC.Refresh(); //PCKB or MidiIn
     ShowCurrentConnections();
 }