예제 #1
0
 private void btSettings_Click(object sender, EventArgs e)
 {
     if (!BassAsio.BASS_ASIO_ControlPanel())
     {
         MessageBox.Show(this, "Selected ASIO device does not have a Control Panel",
                         "MediaPortal - Setup", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
예제 #2
0
        private void DeviceCP_Click(object sender, EventArgs e)
        {
            Boolean StatusCP = BassAsio.BASS_ASIO_ControlPanel();

            if (!StatusCP && BassAsio.BASS_ASIO_ErrorGetCode() != BASSError.BASS_OK)
            {
                MessageBox.Show(
                    String.Format(
                        "An error has occured while showing the control panel for this device.\nThe button will be disabled.\n\nError: {0}",
                        BassAsio.BASS_ASIO_ErrorGetCode()),
                    "ASIO control panel - ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DeviceCP.Enabled = false;
                return;
            }
            GetASIODeviceInfo();
        }
예제 #3
0
 /// <summary>
 /// Show the ASIO Devices Control Panel
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btAsioDeviceSettings_Click(object sender, EventArgs e)
 {
     // Free ASIO and reinit it again
     BassAsio.BASS_ASIO_Free();
     if (BassAsio.BASS_ASIO_Init(soundDeviceComboBox.SelectedIndex, BASSASIOInit.BASS_ASIO_DEFAULT))
     {
         if (!BassAsio.BASS_ASIO_ControlPanel())
         {
             MessageBox.Show(this, "Selected ASIO device does not have a Control Panel",
                             "MediaPortal - Setup", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show(this, "Error initialising the selected ASIO device",
                         "MediaPortal - Setup", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
예제 #4
0
 private void DeviceCP_Click(object sender, EventArgs e)
 {
     BassAsio.BASS_ASIO_ControlPanel();
 }
예제 #5
0
        public void Evaluate(int SpreadMax)
        {
            try
            {
                #region Channel and device
                if (this.FPinInChannels.PinIsChanged || this.FPinInDevice.PinIsChanged)
                {
                    double dbldevice;
                    this.FPinInDevice.GetValue(0, out dbldevice);

                    this.FDeviceIndex = Convert.ToInt32(dbldevice);
                    if (this.FDeviceIndex != -1)
                    {
                        BassAsio.BASS_ASIO_Init(this.FDeviceIndex);
                        BassAsio.BASS_ASIO_SetDevice(this.FDeviceIndex);
                    }

                    this.FOutputHandled.Clear();
                    BassAsio.BASS_ASIO_Stop();

                    BassAsio.BASS_ASIO_ChannelReset(false, -1, BASSASIOReset.BASS_ASIO_RESET_PAUSE | BASSASIOReset.BASS_ASIO_RESET_JOIN);

                    if (this.FDeviceIndex != -1 && this.FPinInChannels.IsConnected)
                    {
                        int    asiooutindex = 0;
                        double dhandle;
                        for (int i = 0; i < this.FPinInChannels.SliceCount; i++)
                        {
                            this.FPinInChannels.GetValue(i, out dhandle);
                            int handle = Convert.ToInt32(dhandle);

                            if (handle != 0 && handle != -1)
                            {
                                ChannelInfo channel = this.manager.GetChannel(handle);

                                if (channel.BassHandle == null)
                                {
                                    //Initialize channel (in nosound)
                                    channel.Initialize(0);
                                }

                                //Check if the channel has its own handler
                                if (!BassAsioUtils.InputChannels.ContainsKey(handle))
                                {
                                    BASS_CHANNELINFO info = Bass.BASS_ChannelGetInfo(channel.BassHandle.Value);

                                    BassAsio.BASS_ASIO_ChannelEnable(false, asiooutindex, myAsioProc, new IntPtr(handle));
                                    if (info.chans == 1)
                                    {
                                        //No need to join on mono channels
                                        asiooutindex++;
                                    }
                                    else
                                    {
                                        for (int chan = 1; chan < info.chans; chan++)
                                        {
                                            bool join = BassAsio.BASS_ASIO_ChannelJoin(false, asiooutindex + chan, asiooutindex);
                                            if (!join)
                                            {
                                                this.FHost.Log(TLogType.Error, "Error: join failed");
                                                this.FHost.Log(TLogType.Error, BassAsio.BASS_ASIO_ErrorGetCode().ToString());
                                            }
                                        }

                                        BassAsio.BASS_ASIO_ChannelSetFormat(false, asiooutindex, BASSASIOFormat.BASS_ASIO_FORMAT_FLOAT);
                                        BassAsio.BASS_ASIO_ChannelSetRate(false, asiooutindex, (double)info.freq);
                                        BassAsio.BASS_ASIO_SetRate((double)info.freq);

                                        asiooutindex += info.chans;
                                    }
                                }
                                else
                                {
                                    BassAsioHandler handler = BassAsioUtils.InputChannels[handle].Handler;
                                    handler.SetMirror(asiooutindex);
                                    asiooutindex += 2;
                                    this.FOutputHandled.Add(asiooutindex);
                                    this.FOutputHandled.Add(asiooutindex + 1);
                                }
                            }
                        }

                        bool start = BassAsio.BASS_ASIO_Start(0);
                        if (!start)
                        {
                            this.FPinErrorCode.SetString(0, BassAsio.BASS_ASIO_ErrorGetCode().ToString());
                            this.FHost.Log(TLogType.Error, "Error: Start failed");
                            this.FHost.Log(TLogType.Error, BassAsio.BASS_ASIO_ErrorGetCode().ToString());
                        }
                        else
                        {
                            this.FPinErrorCode.SetString(0, "OK");
                        }

                        UpdateChannels();
                    }
                }

                if (FControlPanel.PinIsChanged)
                {
                    double v;
                    FControlPanel.GetValue(0, out v);
                    if (v > 0.5)
                    {
                        BassAsio.BASS_ASIO_ControlPanel();
                    }
                }
                #endregion

                #region Volume
                if (this.FPinInVolumeOutput.PinIsChanged)
                {
                    if (this.FDeviceIndex != -1 || this.FPinInVolumeOutput.SliceCount > 0)
                    {
                        BASS_ASIO_INFO deviceinfo = BassAsio.BASS_ASIO_GetInfo();

                        int current = 0;
                        for (int i = 0; i < deviceinfo.outputs; i++)
                        {
                            double vol;

                            this.FPinInVolumeOutput.GetValue(current, out vol);
                            BassAsio.BASS_ASIO_ChannelSetVolume(false, i, (float)vol);

                            //Bin for the channels
                            current++;
                            if (current == this.FPinInVolumeOutput.SliceCount)
                            {
                                current = 0;
                            }
                        }
                    }
                }
                #endregion

                #region Is Active Pin
                if (this.FPinInActive.PinIsChanged)
                {
                    UpdateChannels();
                }
                #endregion
            }
            catch (Exception ex)
            {
                this.FHost.Log(TLogType.Error, ex.Message);
                this.FHost.Log(TLogType.Error, ex.StackTrace);
            }
        }
예제 #6
0
 private void asio_control_btn_Click(object sender, EventArgs e)
 {
     BassAsio.BASS_ASIO_ControlPanel();
 }