Mercurial > audlegacy-plugins
diff src/sun/audio.c @ 1686:2e8adf61c54f
remove realtime craq from the code
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Tue, 11 Sep 2007 06:52:53 -0500 |
| parents | 8c93d207a4d9 |
| children | 2ebeb7816c5e |
line wrap: on
line diff
--- a/src/sun/audio.c Tue Sep 11 06:04:15 2007 -0500 +++ b/src/sun/audio.c Tue Sep 11 06:52:53 2007 -0500 @@ -35,7 +35,6 @@ static gboolean prebuffer, remove_prebuffer; static pthread_t buffer_thread; static int (*sun_convert)(void **, int); -static int realtime; static int rd_index, wr_index; static int buffer_size; static int prebuffer_size; @@ -233,9 +232,6 @@ if (!audio.fd || !audio.going) return 0; - if (realtime) - sun_bufused(); - bytes = output_bytes < device_buffer_used ? 0 : output_bytes - device_buffer_used; return (output_time_offset + ((bytes * 1000) / output.bps)); @@ -243,9 +239,6 @@ static inline int sun_used(void) { - if (realtime) - return 0; - if (wr_index >= rd_index) return (wr_index - rd_index); @@ -257,9 +250,6 @@ if (!audio.going) return 0; - if (realtime) - sun_bufused(); - if (!sun_used() && (device_buffer_used - (3 * blocksize)) <= 0) return (FALSE); @@ -268,9 +258,6 @@ int sun_free(void) { - if (realtime) - return (audio.paused ? 0 : 1000000); - if (remove_prebuffer && prebuffer) { prebuffer = FALSE; @@ -372,15 +359,6 @@ { int cnt, off = 0; - if (realtime) - { - if (audio.paused) - return; - sun_write_audio(ptr, length); - written += length; - return; - } - remove_prebuffer = FALSE; written += length; while (length > 0) @@ -400,15 +378,7 @@ audio.going = 0; - if (realtime) - { - ioctl(audio.fd, AUDIO_FLUSH, NULL); - close(audio.fd); - } - else - { - pthread_join(buffer_thread, NULL); - } + pthread_join(buffer_thread, NULL); sun_get_convert_buffer(0); wr_index = 0; @@ -426,15 +396,10 @@ void sun_pause(short p) { - if (!realtime) - { - if (p == TRUE) - audio.do_pause = TRUE; - else - audio.unpause = TRUE; - } + if (p == TRUE) + audio.do_pause = TRUE; else - audio.paused = p; + audio.unpause = TRUE; } static void* sun_loop(void *arg) @@ -519,25 +484,21 @@ input.bps = sun_bps(sun_format(fmt), rate, nch); sun_setformat(fmt, rate, nch); - realtime = xmms_check_realtime_priority(); - if (ioctl(audio.fd, AUDIO_GETINFO, &info) != 0) blocksize = SUN_DEFAULT_BLOCKSIZE; else blocksize = info.blocksize; - if (!realtime) - { - buffer_size = audio.req_buffer_size; + buffer_size = audio.req_buffer_size; + + if (buffer_size < SUN_MIN_BUFFER_SIZE) + buffer_size = SUN_MIN_BUFFER_SIZE; - if (buffer_size < SUN_MIN_BUFFER_SIZE) - buffer_size = SUN_MIN_BUFFER_SIZE; + prebuffer_size = (buffer_size * audio.req_prebuffer_size) / 100; - prebuffer_size = (buffer_size * audio.req_prebuffer_size) / 100; + buffer_size += blocksize; + buffer = g_malloc0(buffer_size); - buffer_size += blocksize; - buffer = g_malloc0(buffer_size); - } prebuffer = TRUE; wr_index = 0; rd_index = 0; @@ -551,8 +512,8 @@ remove_prebuffer = FALSE; audio.going++; - if (!realtime) - pthread_create(&buffer_thread, NULL, sun_loop, NULL); + + pthread_create(&buffer_thread, NULL, sun_loop, NULL); return 1; }
