public SequenceRecorder(Conductor cond, KeyboardConfiguration key)
        {
            conductor = cond;
            keyboard  = key;

            InitializeComponent();

            int waveInDevices = NAudio.Wave.WaveIn.DeviceCount;

            for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++)
            {
                NAudio.Wave.WaveInCapabilities deviceInfo = NAudio.Wave.WaveIn.GetCapabilities(waveInDevice);
                microphoneList.Items.Add(waveInDevice + ": " + deviceInfo.ProductName);
            }

            microphoneList.SelectedIndex = 0;
            sensitivity.SelectedIndex    = 0;

            sourceStream = new NAudio.Wave.WaveIn();
            sourceStream.DeviceNumber = 0;
            sourceStream.WaveFormat   = conductor.GetWaveFormat();// new NAudio.Wave.WaveFormat(44100, NAudio.Wave.WaveIn.GetCapabilities(0).Channels);
            bytesPerChannel           = (sourceStream.WaveFormat.BitsPerSample / 8);
            bytesPerSample            = bytesPerChannel * sourceStream.WaveFormat.Channels;

            sourceStream.DataAvailable += new EventHandler <NAudio.Wave.WaveInEventArgs>(sourceStream_DataAvailable);

            sourceStream.StartRecording();
        }
Example #2
0
 /// <summary>
 /// Retrieves the capabilities of a waveIn device
 /// </summary>
 /// <param name="devNumber">Device to test</param>
 /// <returns>The WaveIn device capabilities</returns>
 public static WaveInCapabilities GetCapabilities(int devNumber)
 {
     WaveInCapabilities caps = new WaveInCapabilities();
     int structSize = Marshal.SizeOf(caps);
     MmException.Try(WaveInterop.waveInGetDevCaps((IntPtr)devNumber, out caps, structSize), "waveInGetDevCaps");
     return caps;
 }
 public AudioSourceInfo(WaveInCapabilities capabilities, int deviceNumber)
 {
     Name = capabilities.ProductName;
     Channels = capabilities.Channels.ToString(CultureInfo.InvariantCulture);
     Capabilities = capabilities;
     DeviceNumber = deviceNumber;
 }
        /// <summary>
        /// Retrieves the capabilities of a waveIn device
        /// </summary>
        /// <param name="devNumber">Device to test</param>
        /// <returns>The WaveIn device capabilities</returns>
        public static WaveInCapabilities GetCapabilities(int devNumber)
        {
            WaveInCapabilities caps = new WaveInCapabilities();
            int structSize          = Marshal.SizeOf(caps);

            MmException.Try(WaveInterop.waveInGetDevCaps((IntPtr)devNumber, out caps, structSize), "waveInGetDevCaps");
            return(caps);
        }
Example #5
0
        public static WaveInCapabilities GetCapabilities(int devNumber)
        {
            WaveInCapabilities waveInCapabilities = default(WaveInCapabilities);
            int waveInCapsSize = Marshal.SizeOf(waveInCapabilities);

            MmException.Try(WaveInterop.waveInGetDevCaps((IntPtr)devNumber, out waveInCapabilities, waveInCapsSize), "waveInGetDevCaps");
            return(waveInCapabilities);
        }
 public AudioInputRecorder(int deviceNumber, WaveInCapabilities deviceInfo)
 {
     Options.Description = deviceInfo.ProductName;
     Options.DeviceNumber = deviceNumber;
     Options.DeviceGuid = deviceInfo.ProductGuid.ToString("N");
     Options.Load();
     if(Options.Enabled)
         StartListening();
     Options.PropertyChanged += OptionsOnPropertyChanged;
 }
 public static extern MmResult waveInGetDevCaps(IntPtr deviceID, out WaveInCapabilities waveInCaps, int waveInCapsSize);
Example #8
0
 public static extern MmResult waveInGetDevCaps(IntPtr deviceID, out WaveInCapabilities waveInCaps, int waveInCapsSize);
Example #9
0
		RecordingDevice(int deviceNumber, string name, WaveInCapabilities capabilities)
		{
			DeviceNumber = deviceNumber;
			GenericName = name;
			Capabilities = capabilities;
		}
Example #10
0
        private int GetDeviceNumberFromCapabilities(WaveInCapabilities capabilities)
        {
            for (int i = 0; i < WaveIn.DeviceCount; i++)
            {
                if (AreCapabiliesEqual(WaveIn.GetCapabilities(i), capabilities))
                    return i;
            }

            throw new ArgumentException("Input capabilies not found");
        }
Example #11
0
 private bool AreCapabiliesEqual(WaveInCapabilities a, WaveInCapabilities b)
 {
     return a.ManufacturerGuid == b.ManufacturerGuid && a.ProductGuid == b.ProductGuid;
 }
Example #12
0
 public DeviceModel(int wavDeviceNum, WaveInCapabilities waveincapabilities)
 {
     Provider = DeviceProvider.Wave;
     WavDeviceNumber = wavDeviceNum;
     WaveInCapabilities = waveincapabilities;
 }
Example #13
0
 public InputDeviceModel(int n, WaveInCapabilities capabilities)
     : base(n, capabilities)
 {
 }