private int apiSelect()
        {
            int selectedHostApi = PortAudio.Pa_GetDefaultHostApi();
            int apiCount        = PortAudio.Pa_GetHostApiCount();

            for (int i = 0; i < apiCount; i++)
            {
                PortAudio.PaHostApiInfo apiInfo = PortAudio.Pa_GetHostApiInfo(i);
                if ((apiInfo.type == PortAudio.PaHostApiTypeId.paDirectSound) ||
                    (apiInfo.type == PortAudio.PaHostApiTypeId.paOSS))
                {
                    selectedHostApi = i;
                }
            }
            return(selectedHostApi);
        }
Beispiel #2
0
        /// <summary>
        ///     Selects the most appropriate host api
        /// </summary>
        /// <returns>The most appropriate host api</returns>
        public int GetHostApi()
        {
            if (_Disposed)
            {
                throw new ObjectDisposedException("PortAudioHandle already disposed");
            }

            int selectedHostApi = PortAudio.Pa_GetDefaultHostApi();
            int apiCount        = PortAudio.Pa_GetHostApiCount();

            for (int i = 0; i < apiCount; i++)
            {
                PortAudio.PaHostApiInfo apiInfo = PortAudio.Pa_GetHostApiInfo(i);
                if ((apiInfo.type == PortAudio.PaHostApiTypeId.paDirectSound) ||
                    (apiInfo.type == PortAudio.PaHostApiTypeId.paALSA))
                {
                    selectedHostApi = i;
                }
            }
            return(selectedHostApi);
        }
Beispiel #3
0
        void AudioSettingsControlLoad(object sender, EventArgs e)
        {
            driverTypeComboBox.Items.Clear();
            int hostApiCount = PortAudio.Pa_GetHostApiCount();

            for (int i = 0; i < hostApiCount; i++)
            {
                PortAudio.PaHostApiInfo hostApiInfo = PortAudio.Pa_GetHostApiInfo(i);
                if (hostApiInfo.type != PortAudio.PaHostApiTypeId.paInDevelopment)
                {
                    driverTypeComboBox.Items.Add(new HostApiItem(hostApiInfo));
                }
            }
            driverTypeComboBox.SelectedIndex = PortAudio.Pa_GetDefaultHostApi();

            sampleRateComboBox.Items.Clear();
            sampleRateComboBox.Items.Add(192000);
            sampleRateComboBox.Items.Add(176400);
            sampleRateComboBox.Items.Add(96000);
            sampleRateComboBox.Items.Add(88200);
            sampleRateComboBox.Items.Add(48000);
            sampleRateComboBox.Items.Add(44100);
            sampleRateComboBox.Items.Add(38400);
            sampleRateComboBox.Items.Add(37800);
            sampleRateComboBox.Items.Add(32000);
            sampleRateComboBox.Items.Add(24000);
            sampleRateComboBox.Items.Add(22050);
            sampleRateComboBox.Items.Add(19200);
            sampleRateComboBox.Items.Add(18900);
            sampleRateComboBox.Items.Add(16000);
            sampleRateComboBox.Items.Add(12000);
            sampleRateComboBox.Items.Add(11025);
            sampleRateComboBox.Items.Add(9600);
            sampleRateComboBox.Items.Add(8000);
            sampleRateComboBox.SelectedIndex = 5;
        }