Exemplo n.º 1
0
        public void SetPeriodSizeNear(ref uint periodSize, ref int dir)
        {
            int error = AlsaNativeMethods.snd_pcm_hw_params_set_period_size_near(_pcmPtr, _hardwareParamsPtr, ref periodSize, ref dir);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_hw_params_set_period_size_near));
            }
        }
Exemplo n.º 2
0
        public void SetPeriodSize(uint periodSize, int dir)
        {
            int error = AlsaNativeMethods.snd_pcm_hw_params_set_period_size(_pcmPtr, _hardwareParamsPtr, periodSize, dir);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_hw_params_set_period_size));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// would be nice to know what this does...
        /// </summary>
        public void Any()
        {
            int error = AlsaNativeMethods.snd_pcm_hw_params_any(_pcmPtr, _hardwareParamsPtr);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_hw_params_any));
            }
        }
Exemplo n.º 4
0
        public void SetRateNear(ref uint rate, ref int dir)
        {
            int error = AlsaNativeMethods.snd_pcm_hw_params_set_rate_near(_pcmPtr, _hardwareParamsPtr, ref rate, ref dir);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_hw_params_set_rate_near));
            }
        }
Exemplo n.º 5
0
        public void SetBufferNear(ref uint frames)
        {
            int error = AlsaNativeMethods.snd_pcm_hw_params_set_buffer_size_near(_pcmPtr, _hardwareParamsPtr, ref frames);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_hw_params_set_buffer_size_near));
            }
        }
Exemplo n.º 6
0
        public void Reset()
        {
            int error = AlsaNativeMethods.snd_pcm_reset(_pcmPtr);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_reset));
            }
        }
Exemplo n.º 7
0
        public void Drop()
        {
            int error = AlsaNativeMethods.snd_pcm_drop(_pcmPtr);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_drop));
            }
        }
Exemplo n.º 8
0
        public SoundPcm(string name, snd_pcm_stream_t streamType, int mode)
        {
            int error = AlsaNativeMethods.snd_pcm_open(out _pcmPtr, name, streamType, mode);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_open));
            }
        }
Exemplo n.º 9
0
        public void Resume()
        {
            int error = AlsaNativeMethods.snd_pcm_pause(_pcmPtr, 0);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_pause));
            }
        }
Exemplo n.º 10
0
        public void Prepare()
        {
            int error = AlsaNativeMethods.snd_pcm_prepare(_pcmPtr);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_prepare));
            }
        }
Exemplo n.º 11
0
        public SoundPcmHardwareParams(SoundPcm pcm)
        {
            _pcmPtr = pcm.Ptr;
            int error = AlsaNativeMethods.snd_pcm_hw_params_malloc(out _hardwareParamsPtr);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_hw_params_malloc));
            }
        }
Exemplo n.º 12
0
        public int Available()
        {
            int result = AlsaNativeMethods.snd_pcm_avail(_pcmPtr);

            if (result < 0)
            {
                throw new AlsaNativeError(result, nameof(AlsaNativeMethods.snd_pcm_avail));
            }
            return(result);
        }
Exemplo n.º 13
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    AlsaNativeMethods.snd_pcm_hw_params_free(_hardwareParamsPtr);
                }

                _disposedValue = true;
            }
        }
Exemplo n.º 14
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    AlsaNativeMethods.snd_pcm_close(_pcmPtr);
                }

                _disposedValue = true;
            }
        }
Exemplo n.º 15
0
 public int WriteInterleaved(short[] buffer, uint length)
 {
     return(AlsaNativeMethods.snd_pcm_writei(_pcmPtr, buffer, length));
 }
Exemplo n.º 16
0
 public int ReadInterleaved(short[] buffer, uint length)
 {
     return(AlsaNativeMethods.snd_pcm_readi(_pcmPtr, buffer, length));
 }