comparison ALmixer.h @ 44:56855942fdc6

Split off background thread (threads only) termination and creation into separate functions from Interruption handling to make it easier to avoid race condition bug with Apple rdar://10081775 w.r.t. setting the OpenAL context. New APIs to suspend and resume update threads. Interruption handling calls these automatically. Also partially regressed simplification with regards to getting the current playing state in the main update loop.
author Eric Wing <ewing@anscamobile.com>
date Tue, 13 Sep 2011 18:03:21 -0700
parents 05e5dc4817a4
children e2687188aea5
comparison
equal deleted inserted replaced
42:05e5dc4817a4 44:56855942fdc6
370 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_InitMixer(ALuint num_sources); 370 extern ALMIXER_DECLSPEC ALboolean ALMIXER_CALL ALmixer_InitMixer(ALuint num_sources);
371 371
372 /** 372 /**
373 * (EXPERIMENTAL) Call to notify ALmixer that your device needs to handle an interruption. 373 * (EXPERIMENTAL) Call to notify ALmixer that your device needs to handle an interruption.
374 * (EXPERIMENTAL) For devices like iOS that need special handling for interruption events like phone calls and alarms, 374 * (EXPERIMENTAL) For devices like iOS that need special handling for interruption events like phone calls and alarms,
375 * this function will do the correct platform correct thing to handle the interruption w.r.t. OpenAL. 375 * this function will do the correct platform correct thing to handle the interruption w.r.t. OpenAL. This calls ALmixer_SuspendUpdates().
376 */ 376 */
377 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_BeginInterruption(void); 377 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_BeginInterruption(void);
378 378
379 /** 379 /**
380 * (EXPERIMENTAL) Call to notify ALmixer that your device needs to resume from an interruption. 380 * (EXPERIMENTAL) Call to notify ALmixer that your device needs to resume from an interruption.
381 * (EXPERIMENTAL) For devices like iOS that need special handling for interruption events like phone calls and alarms, 381 * (EXPERIMENTAL) For devices like iOS that need special handling for interruption events like phone calls and alarms,
382 * this function will do the correct platform correct thing to resume from the interruption w.r.t. OpenAL. 382 * this function will do the correct platform correct thing to resume from the interruption w.r.t. OpenAL. This calls ALmixer_ResumeUpdates().
383 */ 383 */
384 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_EndInterruption(void); 384 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_EndInterruption(void);
385 385
386 /** 386 /**
387 * (EXPERIMENTAL) Call to determine if in an interruption. 387 * (EXPERIMENTAL) Call to determine if in an interruption.
388 * (EXPERIMENTAL) For devices like iOS that need special handling for interruption events like phone calls and alarms, 388 * (EXPERIMENTAL) For devices like iOS that need special handling for interruption events like phone calls and alarms,
389 * this function will do the correct platform correct thing to determine if in an interruption. 389 * this function will do the correct platform correct thing to determine if in an interruption.
390 */ 390 */
391 extern ALMIXER_DECLSPEC ALboolean ALmixer_IsInInterruption(void); 391 extern ALMIXER_DECLSPEC ALboolean ALmixer_IsInInterruption(void);
392
393
394 /**
395 * (EXPERIMENTAL) Destroys the background update thread (ENABLE_ALMIXER_THREADS only).
396 * (EXPERIMENTAL) Destroys the background update thread (ENABLE_ALMIXER_THREADS only). BeginInterruption used to do this internally, but this was split off due to an iOS OpenAL race condition bug (10081775). Being able to manipulate the thread without manipulating the context was useful for suspend/resume backgrounding when not dealing with a full-blown interruption event.
397 */
398 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_SuspendUpdates(void);
399
400 /**
401 * (EXPERIMENTAL) Recreates the background update thread (ENABLE_ALMIXER_THREADS only).
402 * (EXPERIMENTAL) Recreates the background update thread (ENABLE_ALMIXER_THREADS only). EndInterruption used to do this internally, but this was split off due to an iOS OpenAL race condition bug (10081775). Being able to manipulate the thread without manipulating the context was useful for suspend/resume backgrounding when not dealing with a full-blown interruption event.
403 */
404 extern ALMIXER_DECLSPEC void ALMIXER_CALL ALmixer_ResumeUpdates(void);
405
406 /**
407 * (EXPERIMENTAL) Call to determine if in ALmixer_SuspendUpdates(). (ENABLE_ALMIXER_THREADS only.)
408 */
409 extern ALMIXER_DECLSPEC ALboolean ALmixer_AreUpdatesSuspended(void);
392 410
393 411
394 /** 412 /**
395 * This shuts down ALmixer. Please remember to free your ALmixer_Data* instances 413 * This shuts down ALmixer. Please remember to free your ALmixer_Data* instances
396 * before calling this method. 414 * before calling this method.