# HG changeset patch # User Eric Wing # Date 1301350586 25200 # Node ID 60500a33735ad04f3a8a308956df10d6ae0178c7 # Parent 9cf93a099f75e654edc83be208540ed18a2511bf Initial backend changes to decouple assumption of 1 buffer queued per channel / per pass. API will eventually be changed/broken to support this. diff -r 9cf93a099f75 -r 60500a33735a ALmixer.c --- a/ALmixer.c Fri Mar 04 11:29:05 2011 -0800 +++ b/ALmixer.c Mon Mar 28 15:16:26 2011 -0700 @@ -417,6 +417,7 @@ ALuint max_queue_buffers; /* Max number of queue buffers */ ALuint num_startup_buffers; /* Number of ramp-up buffers */ ALuint num_buffers_in_use; /* number of buffers in use */ + ALuint num_target_buffers_per_pass; /* number of buffers to try to queue in an update pass */ /* This stuff is for streamed buffers that require data access */ ALmixer_Buffer_Map* buffer_map_list; /* translate ALbuffer to index @@ -5160,6 +5161,9 @@ ALint current_buffer_id; ALuint unqueued_buffer_id; + ALuint number_of_buffers_to_queue_this_pass = ALmixer_Channel_List[i].almixer_data->num_target_buffers_per_pass; + ALuint current_count_of_buffer_queue_passes = 0; + #if 0 /********* Remove this **********/ fprintf(stderr, "For Streamed\n"); @@ -5398,6 +5402,12 @@ * but we don't do this if at EOF, * except when there is looping */ + + /* NEW FEATURE: Try to queue up more buffers per pass, allowing the size of the buffer to be decoupled. */ + /* TODO: Optimization: If number of available buffers (max_buffers-buffers_in_use), adjust the number of buffers to queue for this pass. */ + for(current_count_of_buffer_queue_passes=0; current_count_of_buffer_queue_passes