Exemplo n.º 1
0
        public Capture(CaptureInitializer init)
        {
            myFrequency  = init.frequency;
            myFormat     = init.format;
            myBufferSize = init.captureSampleringBufferSize;
            myDeviceName = init.deviceName;

            ALFormat alFormat = 0;

            switch (myFormat)
            {
            case AudioBuffer.AudioFormat.MONO8: alFormat = ALFormat.Mono8; break;

            case AudioBuffer.AudioFormat.MONO16: alFormat = ALFormat.Mono16; break;

            case AudioBuffer.AudioFormat.STEREO8: alFormat = ALFormat.Stereo8; break;

            case AudioBuffer.AudioFormat.STEREO16: alFormat = ALFormat.Stereo16; break;
            }

            myDevice = new AudioCapture(myDeviceName == "" ? AudioCapture.DefaultDevice : myDeviceName, myFrequency, alFormat, myBufferSize);
        }
Exemplo n.º 2
0
        Capture getCaptureDevice(CaptureInitializer init)
        {
            if (myCaptureDevice == null)
            {
                if (init != null)
                {
                    myCaptureDevice = new Capture(init);
                }
            }
            else
            {
                if (init != null &&
                    init.format != myCaptureDevice.format &
                    init.captureSampleringBufferSize != myCaptureDevice.bufferSize &&
                    init.frequency != myCaptureDevice.frequency &&
                    init.deviceName != myCaptureDevice.deviceName)
                {
                    myCaptureDevice.Dispose();
                    myCaptureDevice = new Capture(init);
                }
            }

            return(myCaptureDevice);
        }