Exemple #1
0
        } // end enumerateDevices

        private void startButton_Click(object sender, EventArgs e)
        {
            List <string> inputStrings = inputsBox.CheckedItems.OfType <String>().ToList <String>();

            int sampleRate = Convert.ToInt32(sampleBox.SelectedItem as String);

            string selectedOutput = outputBox.SelectedItem as String;

            RtAudio.Api api = (RtAudio.Api)apiBox.SelectedIndex;

            Console.WriteLine("Selected API: {0}", api.ToString());
            // Try to get the global instance. If we fail, make our own.
            try
            {
                manager = RtAudioManager.GetInstance();
            }
            catch (RtAudioManagerApiException)
            {
                manager = new RtAudioManager();
            } // end try/catch

            mixer = manager.CreateMixer(inputStrings, selectedOutput, sampleRate);
            mixer.Start();

            stopButton.Enabled  = true;
            startButton.Enabled = false;
        }
Exemple #2
0
    static void Main(string[] args)
    {
        // Get global instance
        manager = RtAudioManager.GetInstance();

        // Create a simple mixer, mixing the default input device to the default output device
        RtStreamMixer mixer = manager.CreateMixer(new List<string>() { "Default" }, "Default");

        // Start the mixer
        mixer.Start();

        // Infinite Loop
        while (true)
        {
            Thread.Sleep(50);
        } // end while
    } // end Main
Exemple #3
0
        public MainWindow()
        {
            InitializeComponent();

            dispatcher = Dispatcher.CurrentDispatcher;

            manager = RtAudioManager.GetInstance();
            manager.DeviceEnumerationChanged += new EventHandler(manager_DeviceEnumerationChanged);

            // Connect Logging Events
            EventLoggerManager.TraceLoggingEvent    += new LoggingEventHandler(EventLoggerManager_TraceLoggingEvent);
            EventLoggerManager.DebugLoggingEvent    += new LoggingEventHandler(EventLoggerManager_DebugLoggingEvent);
            EventLoggerManager.InfoLoggingEvent     += new LoggingEventHandler(EventLoggerManager_InfoLoggingEvent);
            EventLoggerManager.WarnLoggingEvent     += new LoggingEventHandler(EventLoggerManager_WarnLoggingEvent);
            EventLoggerManager.ErrorLoggingEvent    += new LoggingEventHandler(EventLoggerManager_ErrorLoggingEvent);
            EventLoggerManager.CriticalLoggingEvent += new LoggingEventHandler(EventLoggerManager_CriticalLoggingEvent);

            // Process Priority
            process = Process.GetCurrentProcess();
            priorityBox.DataSource    = Enum.GetValues(typeof(ProcessPriorityClass));
            priorityBox.SelectedIndex = priorityBox.FindString("AboveNormal");

            // SampleRates
            sampleBox.Items.Add("4000");
            sampleBox.Items.Add("8000");
            sampleBox.Items.Add("11025");
            sampleBox.Items.Add("16000");
            sampleBox.Items.Add("22050");
            sampleBox.Items.Add("44100");
            sampleBox.SelectedIndex = 2;

            apiBox.DataSource    = Enum.GetValues(typeof(RtAudio.Api));
            apiBox.SelectedIndex = apiBox.FindString("WINDOWS_ASIO");

            enumerateDevices();

            // Check for changes in the list of active devices every 500ms.
            manager.enableDeviceWatcher(500);
        }