comparison ALmixer.c @ 28:60500a33735a

Initial backend changes to decouple assumption of 1 buffer queued per channel / per pass. API will eventually be changed/broken to support this.
author Eric Wing <ewing . public |-at-| gmail . com>
date Mon, 28 Mar 2011 15:16:26 -0700
parents 9cf93a099f75
children 1c23805d5ce9
comparison
equal deleted inserted replaced
27:9cf93a099f75 28:60500a33735a
415 415
416 /* Needed for streamed buffers */ 416 /* Needed for streamed buffers */
417 ALuint max_queue_buffers; /* Max number of queue buffers */ 417 ALuint max_queue_buffers; /* Max number of queue buffers */
418 ALuint num_startup_buffers; /* Number of ramp-up buffers */ 418 ALuint num_startup_buffers; /* Number of ramp-up buffers */
419 ALuint num_buffers_in_use; /* number of buffers in use */ 419 ALuint num_buffers_in_use; /* number of buffers in use */
420 ALuint num_target_buffers_per_pass; /* number of buffers to try to queue in an update pass */
420 421
421 /* This stuff is for streamed buffers that require data access */ 422 /* This stuff is for streamed buffers that require data access */
422 ALmixer_Buffer_Map* buffer_map_list; /* translate ALbuffer to index 423 ALmixer_Buffer_Map* buffer_map_list; /* translate ALbuffer to index
423 and holds pointer to copy of data for 424 and holds pointer to copy of data for
424 data access */ 425 data access */
5158 ALint buffers_processed; 5159 ALint buffers_processed;
5159 ALint buffers_still_queued; 5160 ALint buffers_still_queued;
5160 ALint current_buffer_id; 5161 ALint current_buffer_id;
5161 5162
5162 ALuint unqueued_buffer_id; 5163 ALuint unqueued_buffer_id;
5164 ALuint number_of_buffers_to_queue_this_pass = ALmixer_Channel_List[i].almixer_data->num_target_buffers_per_pass;
5165 ALuint current_count_of_buffer_queue_passes = 0;
5166
5163 #if 0 5167 #if 0
5164 /********* Remove this **********/ 5168 /********* Remove this **********/
5165 fprintf(stderr, "For Streamed\n"); 5169 fprintf(stderr, "For Streamed\n");
5166 5170
5167 alGetSourcei( 5171 alGetSourcei(
5396 * if buffers_processed > 0 or 5400 * if buffers_processed > 0 or
5397 * if num_of_buffers_in_use < NUMBER_OF_QUEUE_BUFFERS 5401 * if num_of_buffers_in_use < NUMBER_OF_QUEUE_BUFFERS
5398 * but we don't do this if at EOF, 5402 * but we don't do this if at EOF,
5399 * except when there is looping 5403 * except when there is looping
5400 */ 5404 */
5405
5406 /* NEW FEATURE: Try to queue up more buffers per pass, allowing the size of the buffer to be decoupled. */
5407 /* TODO: Optimization: If number of available buffers (max_buffers-buffers_in_use), adjust the number of buffers to queue for this pass. */
5408 for(current_count_of_buffer_queue_passes=0; current_count_of_buffer_queue_passes<number_of_buffers_to_queue_this_pass; current_count_of_buffer_queue_passes++)
5409 {
5410
5401 /* For this to work, we must rely on EVERYTHING 5411 /* For this to work, we must rely on EVERYTHING
5402 * else to unset the EOF if there is looping. 5412 * else to unset the EOF if there is looping.
5403 * Remember, even Play() must do this 5413 * Remember, even Play() must do this
5404 */ 5414 */
5405 5415
6128 */ 6138 */
6129 } 6139 }
6130 #endif 6140 #endif
6131 } /* End trap section */ 6141 } /* End trap section */
6132 } /* End POST-EOF use-up buffer section */ 6142 } /* End POST-EOF use-up buffer section */
6143
6144 } /* END NEW number of queue buffers per pass */
6145
6133 } /* END Streamed section */ 6146 } /* END Streamed section */
6134 } /* END channel in use */ 6147 } /* END channel in use */
6135 } /* END for-loop for each channel */ 6148 } /* END for-loop for each channel */
6136 6149
6137 #ifdef ENABLE_ALMIXER_ALC_SYNC 6150 #ifdef ENABLE_ALMIXER_ALC_SYNC