예제 #1
0
 private void radioButtonOutFile_Checked(object sender, RoutedEventArgs e)
 {
     if (m_asioStatus != AsioStatus.NotReady)
     {
         asio.Unsetup();
         m_asioStatus = AsioStatus.NotReady;
     }
     if (0 <= m_selectedAsioDeviceIdx)
     {
         asio.DriverUnload();
         m_selectedAsioDeviceIdx = -1;
     }
     m_outputMode = OutputMode.WavFile;
     UpdateUIStatus();
 }
예제 #2
0
        private void buttonLoadDriver_Click(object sender, EventArgs e)
        {
            buttonLoadDriver.Enabled = false;
            bool bRv = asio.DriverLoad(listBoxDrivers.SelectedIndex);

            if (!bRv)
            {
                return;
            }

            int rv = asio.Setup(SAMPLE_RATE);

            if (0 != rv)
            {
                string errStr = string.Empty;
                switch (rv)
                {
                case -5003: errStr = "Device Not Found"; break;

                case -1000: errStr = "hardware input or output is not present or available"; break;

                default: break;
                }
                if (errStr == string.Empty)
                {
                    MessageBox.Show(string.Format("ASIO setup({0}) failed {1:X8}", SAMPLE_RATE, rv));
                }
                else
                {
                    MessageBox.Show(string.Format("ASIO setup({0}) failed {1} ({2:X8})", SAMPLE_RATE, errStr, rv));
                }
                asio.Unsetup();
                asio.DriverUnload();
                buttonLoadDriver.Enabled = true;
                return;
            }

            for (int i = 0; i < asio.InputChannelsNumGet(); ++i)
            {
                listBoxInput.Items.Add(asio.InputChannelNameGet(i));
            }
            if (0 < listBoxInput.Items.Count)
            {
                listBoxInput.SelectedIndex = 0;
            }
            for (int i = 0; i < asio.OutputChannelsNumGet(); ++i)
            {
                listBoxOutput.Items.Add(asio.OutputChannelNameGet(i));
            }
            if (0 < listBoxOutput.Items.Count)
            {
                listBoxOutput.SelectedIndex = 0;
            }

            for (int i = 0; i < asio.ClockSourceNumGet(); ++i)
            {
                listBoxClockSources.Items.Add(asio.ClockSourceNameGet(i));
            }
            if (0 < listBoxOutput.Items.Count)
            {
                listBoxClockSources.SelectedIndex = 0;
            }

            if (0 == rv &&
                0 < listBoxInput.Items.Count &&
                0 < listBoxOutput.Items.Count)
            {
                buttonStart.Enabled = true;
            }
            listBoxDrivers.Enabled     = false;
            buttonControlPanel.Enabled = true;
        }