From 6364e83c9f4ad17a4ce1210dcc4cc77caa36cc47 Mon Sep 17 00:00:00 2001 From: arpi_esp Date: Tue, 8 May 2001 21:28:04 +0000 Subject: fragment info added (disabled) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@731 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/audio-block2.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'TOOLS') diff --git a/TOOLS/audio-block2.c b/TOOLS/audio-block2.c index 9720d2af0a..3480083686 100644 --- a/TOOLS/audio-block2.c +++ b/TOOLS/audio-block2.c @@ -26,6 +26,15 @@ unsigned int GetTimer(){ static unsigned char a_buffer[OUTBURST]; +void inline print_info(int audio_fd){ +#if 1 + audio_buf_info zz; + ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz); + printf("Status: %3d/%d (%d byte/frag) free: %6d\n", + zz.fragments, zz.fragstotal, zz.fragsize, zz.bytes); +#endif +} + int main(){ int audio_buffer_size=0; int r; @@ -39,12 +48,19 @@ int main(){ printf("Can't open audio device %s\n",dsp); return 1; } + +// ioctl(audio_fd, SNDCTL_DSP_RESET, NULL); +// print_info(audio_fd); + + ioctl(audio_fd, SNDCTL_DSP_RESET, NULL); r=AFMT_S16_LE;ioctl (audio_fd, SNDCTL_DSP_SETFMT, &r); r=1; ioctl (audio_fd, SNDCTL_DSP_STEREO, &r); r=44100; if(ioctl (audio_fd, SNDCTL_DSP_SPEED, &r)==-1) printf("audio_setup: your card doesn't support %d Hz samplerate\n",r); +// print_info(audio_fd); + t0=t1=GetTimer(); while(xxx-->0){ @@ -55,6 +71,8 @@ while(xxx-->0){ tv.tv_sec=0; tv.tv_usec = 0; if(select(audio_fd+1, NULL, &rfds, NULL, &tv)) c=' '; +// print_info(audio_fd); + r=write(audio_fd,a_buffer,OUTBURST); t2=GetTimer(); if(r<0) printf("Error writting to device\n"); else -- cgit v1.2.3