Exemplo n.º 1
0
        public virtual int hleAudioInputBlocking(int maxSamples, int frequency, TPointer buffer)
        {
            if (!inputDeviceInitialized)
            {
                IntBuffer majorVersion = BufferUtils.createIntBuffer(1);
                IntBuffer minorVersion = BufferUtils.createIntBuffer(1);
                ALC10.alcGetInteger(null, ALC10.ALC_MAJOR_VERSION, majorVersion);
                ALC10.alcGetInteger(null, ALC10.ALC_MINOR_VERSION, minorVersion);
                Console.WriteLine(string.Format("OpenAL Version {0:D}.{1:D}, extensions {2}", majorVersion.get(0), minorVersion.get(0), ALC10.alcGetString(null, ALC10.ALC_EXTENSIONS)));

                inputDevice = ALC11.alcCaptureOpenDevice(null, frequency, AL10.AL_FORMAT_MONO16, 10 * 1024);
                if (inputDevice != null)
                {
                    ALC11.alcCaptureStart(inputDevice);
                }
                else
                {
                    Console.WriteLine(string.Format("No audio input device available, faking."));
                }

                inputDeviceInitialized = true;
            }

            blockThreadInput(buffer.Address, maxSamples, frequency);

            return(0);
        }
Exemplo n.º 2
0
        public virtual int hleAudioGetInputLength()
        {
            if (inputDevice == null)
            {
                return(0);
            }

            if (samplesBuffer == null)
            {
                samplesBuffer = BufferUtils.createIntBuffer(1);
            }

            ALC10.alcGetInteger(inputDevice, ALC11.ALC_CAPTURE_SAMPLES, samplesBuffer);

            return(samplesBuffer.get(0));
        }