예제 #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));
            }
        }
예제 #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));
            }
        }
예제 #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));
            }
        }
예제 #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));
            }
        }
예제 #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));
            }
        }
예제 #6
0
파일: SoundPcm.cs 프로젝트: trampster/Ropu
        public void Reset()
        {
            int error = AlsaNativeMethods.snd_pcm_reset(_pcmPtr);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_reset));
            }
        }
예제 #7
0
파일: SoundPcm.cs 프로젝트: trampster/Ropu
        public void Drop()
        {
            int error = AlsaNativeMethods.snd_pcm_drop(_pcmPtr);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_drop));
            }
        }
예제 #8
0
파일: SoundPcm.cs 프로젝트: trampster/Ropu
        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));
            }
        }
예제 #9
0
파일: SoundPcm.cs 프로젝트: trampster/Ropu
        public void Resume()
        {
            int error = AlsaNativeMethods.snd_pcm_pause(_pcmPtr, 0);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_pause));
            }
        }
예제 #10
0
파일: SoundPcm.cs 프로젝트: trampster/Ropu
        public void Prepare()
        {
            int error = AlsaNativeMethods.snd_pcm_prepare(_pcmPtr);

            if (error < 0)
            {
                throw new AlsaNativeError(error, nameof(AlsaNativeMethods.snd_pcm_prepare));
            }
        }
예제 #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));
            }
        }
예제 #12
0
파일: SoundPcm.cs 프로젝트: trampster/Ropu
        public int Available()
        {
            int result = AlsaNativeMethods.snd_pcm_avail(_pcmPtr);

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

                _disposedValue = true;
            }
        }
예제 #14
0
파일: SoundPcm.cs 프로젝트: trampster/Ropu
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    AlsaNativeMethods.snd_pcm_close(_pcmPtr);
                }

                _disposedValue = true;
            }
        }
예제 #15
0
파일: SoundPcm.cs 프로젝트: trampster/Ropu
 public int WriteInterleaved(short[] buffer, uint length)
 {
     return(AlsaNativeMethods.snd_pcm_writei(_pcmPtr, buffer, length));
 }
예제 #16
0
파일: SoundPcm.cs 프로젝트: trampster/Ropu
 public int ReadInterleaved(short[] buffer, uint length)
 {
     return(AlsaNativeMethods.snd_pcm_readi(_pcmPtr, buffer, length));
 }