Changeset 1313
- Timestamp:
- 01/13/08 17:22:36 (7 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
portaudio/branches/v19-devel/src/hostapi/oss/pa_unix_oss.c
r1310 r1313 406 406 { 407 407 sr = 44100; 408 if( ioctl( devHandle, SNDCTL_DSP_SPEED, &sr ) < 0 ) 409 { 410 result = paUnanticipatedHostError; 411 goto error; 412 } 408 ENSURE_( ioctl( devHandle, SNDCTL_DSP_SPEED, &sr ), paUnanticipatedHostError ); 413 409 414 410 *defaultSampleRate = sr; … … 1872 1868 unsigned long frames ) 1873 1869 { 1870 PaError result = paNoError; 1874 1871 PaOssStream *stream = (PaOssStream*)s; 1875 1872 int bytesRequested, bytesRead; … … 1892 1889 1893 1890 bytesRequested = framesRequested * PaOssStreamComponent_FrameSize( stream->capture ); 1894 bytesRead = read( stream->capture->fd, stream->capture->buffer, bytesRequested ); 1891 ENSURE_( (bytesRead = read( stream->capture->fd, stream->capture->buffer, bytesRequested )), 1892 paUnanticipatedHostError ); 1895 1893 if ( bytesRequested != bytesRead ) 1894 { 1895 PA_DEBUG(( "Requested %d bytes, read %d\n", bytesRequested, bytesRead )); 1896 1896 return paUnanticipatedHostError; 1897 } 1897 1898 1898 1899 PaUtil_SetInputFrameCount( &stream->bufferProcessor, stream->capture->hostFrames ); … … 1901 1902 frames -= framesRequested; 1902 1903 } 1903 return paNoError; 1904 1905 error: 1906 return result; 1904 1907 } 1905 1908 … … 1907 1910 static PaError WriteStream( PaStream *s, const void *buffer, unsigned long frames ) 1908 1911 { 1912 PaError result = paNoError; 1909 1913 PaOssStream *stream = (PaOssStream*)s; 1910 1914 int bytesRequested, bytesWritten; … … 1932 1936 1933 1937 bytesRequested = framesConverted * PaOssStreamComponent_FrameSize( stream->playback ); 1934 bytesWritten = write( stream->playback->fd, stream->playback->buffer, bytesRequested ); 1938 ENSURE_( (bytesWritten = write( stream->playback->fd, stream->playback->buffer, bytesRequested )), 1939 paUnanticipatedHostError ); 1935 1940 1936 1941 if ( bytesRequested != bytesWritten ) 1942 { 1943 PA_DEBUG(( "Requested %d bytes, wrote %d\n", bytesRequested, bytesWritten )); 1937 1944 return paUnanticipatedHostError; 1938 } 1939 return paNoError; 1945 } 1946 } 1947 1948 error: 1949 return result; 1940 1950 } 1941 1951 … … 1943 1953 static signed long GetStreamReadAvailable( PaStream* s ) 1944 1954 { 1955 PaError result = paNoError; 1945 1956 PaOssStream *stream = (PaOssStream*)s; 1946 1957 audio_buf_info info; 1947 1958 1948 if( ioctl( stream->capture->fd, SNDCTL_DSP_GETISPACE, &info ) < 0 ) 1949 return paUnanticipatedHostError; 1959 ENSURE_( ioctl( stream->capture->fd, SNDCTL_DSP_GETISPACE, &info ), paUnanticipatedHostError ); 1950 1960 return info.fragments * stream->capture->hostFrames; 1961 1962 error: 1963 return result; 1951 1964 } 1952 1965 … … 1955 1968 static signed long GetStreamWriteAvailable( PaStream* s ) 1956 1969 { 1970 PaError result = paNoError; 1957 1971 PaOssStream *stream = (PaOssStream*)s; 1958 1972 int delay = 0; 1959 1973 1960 if( ioctl( stream->playback->fd, SNDCTL_DSP_GETODELAY, &delay ) < 0 ) 1961 return paUnanticipatedHostError; 1962 1974 ENSURE_( ioctl( stream->playback->fd, SNDCTL_DSP_GETODELAY, &delay ), paUnanticipatedHostError ); 1963 1975 return (PaOssStreamComponent_BufferSize( stream->playback ) - delay) / PaOssStreamComponent_FrameSize( stream->playback ); 1964 } 1965 1976 1977 error: 1978 return result; 1979 } 1980
