From 43704e753f2532deb76f1d9719c75c97e13eb47b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 5 Mar 2011 22:51:23 -0800 Subject: [PATCH] More/larger buffers causes an increase in time between needed updates --- docs/html/files/streamplay-cpp.html | 4 ++-- src/streamplay.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/html/files/streamplay-cpp.html b/docs/html/files/streamplay-cpp.html index d757802..9c74ced 100644 --- a/docs/html/files/streamplay-cpp.html +++ b/docs/html/files/streamplay-cpp.html @@ -15,9 +15,9 @@ if (browserType) {document.write("
");if (browserV

Functions

-

alurePlaySourceStream

ALURE_API ALboolean ALURE_APIENTRY alurePlaySourceStream(
   ALuint source,
   alureStream *stream,
   ALsizei numBufs,
   ALsizei loopcount,
   void (*eos_callback)(void *userdata, ALuint source),
   void *userdata
)

Starts playing a stream, using the specified source ID.  A stream can only be played if it is not already playing.  You must call alureUpdate at regular intervals to keep the stream playing, or else the stream will underrun and cause a break in the playback until an update call can restart it.  It is also important that the current context is kept for alureUpdate calls if ALC_EXT_thread_local_context is not supported, otherwise the method may start calling OpenAL with invalid IDs.  Note that checking the state of the specified source is not a good method to determine if a stream is playing.  If an underrun occurs, the source will enter a stopped state until it is automatically restarted.  Instead, set a flag using the callback to indicate the stream being stopped.

Parameters

sourceThe source ID to play the stream with.  Any buffers on the source will be unqueued.  It is valid to set source properties not related to the buffer queue or playback state (ie. you may change the source’s position, pitch, gain, etc, but you must not stop the source or queue/unqueue buffers on it).  To pause the source, call alurePauseSource.
streamThe stream to play.  Any valid stream will work, although looping will only work if the stream can be rewound (eg. streams made with alureCreateStreamFromCallback cannot loop, but will play for as long as the callback provides data).
numBufsThe number of buffers used to queue with the OpenAL source.  Each buffer will be filled with the chunk length specified when the stream was created.  This value must be at least 2.  More buffers at a larger size will decrease the time needed between updates, but at the cost of more memory usage.
loopcountThe number of times to loop the stream.  When the stream reaches the end of processing, it will be rewound to continue buffering data.  A value of -1 will cause the stream to loop indefinitely (or until alureStopSource is called).
eos_callbackThis callback will be called when the stream reaches the end, no more loops are pending, and the source reaches a stopped state.  It will also be called if an error occured and playback terminated.
userdataAn opaque user pointer passed to the callback.

Returns

AL_FALSE on error.

Version Added: 1.1

See Also

alureStopSource, alurePauseSource, alureUpdate

+

alurePlaySourceStream

ALURE_API ALboolean ALURE_APIENTRY alurePlaySourceStream(
   ALuint source,
   alureStream *stream,
   ALsizei numBufs,
   ALsizei loopcount,
   void (*eos_callback)(void *userdata, ALuint source),
   void *userdata
)

Starts playing a stream, using the specified source ID.  A stream can only be played if it is not already playing.  You must call alureUpdate at regular intervals to keep the stream playing, or else the stream will underrun and cause a break in the playback until an update call can restart it.  It is also important that the current context is kept for alureUpdate calls if ALC_EXT_thread_local_context is not supported, otherwise the method may start calling OpenAL with invalid IDs.  Note that checking the state of the specified source is not a good method to determine if a stream is playing.  If an underrun occurs, the source will enter a stopped state until it is automatically restarted.  Instead, set a flag using the callback to indicate the stream being stopped.

Parameters

sourceThe source ID to play the stream with.  Any buffers on the source will be unqueued.  It is valid to set source properties not related to the buffer queue or playback state (ie. you may change the source’s position, pitch, gain, etc, but you must not stop the source or queue/unqueue buffers on it).  To pause the source, call alurePauseSource.
streamThe stream to play.  Any valid stream will work, although looping will only work if the stream can be rewound (eg. streams made with alureCreateStreamFromCallback cannot loop, but will play for as long as the callback provides data).
numBufsThe number of buffers used to queue with the OpenAL source.  Each buffer will be filled with the chunk length specified when the stream was created.  This value must be at least 2.  More buffers at a larger size will increase the time needed between updates, but at the cost of more memory usage.
loopcountThe number of times to loop the stream.  When the stream reaches the end of processing, it will be rewound to continue buffering data.  A value of -1 will cause the stream to loop indefinitely (or until alureStopSource is called).
eos_callbackThis callback will be called when the stream reaches the end, no more loops are pending, and the source reaches a stopped state.  It will also be called if an error occured and playback terminated.
userdataAn opaque user pointer passed to the callback.

Returns

AL_FALSE on error.

Version Added: 1.1

See Also

alureStopSource, alurePauseSource, alureUpdate

-

alurePlaySource

ALURE_API ALboolean ALURE_APIENTRY alurePlaySource(
   ALuint source,
   void (*callback)(void *userdata, ALuint source),
   void *userdata
)

Plays the specified source ID and watches for it to stop.  When a source enters an AL_STOPPED state, the specified callback will be called by alureUpdate to alert the application.  As with alurePlaySourceStream, if ALC_EXT_thread_local_context is not supported, the current context must not be changed while the source is being watched (before the callback is called or alureStopSource is called).  It also must not be deleted while being watched.

Parameters

sourceThe source ID to play.  As with alurePlaySourceStream, it is valid to set source properties not related to the playback state (ie. you may change a source’s position, pitch, gain, etc).  Pausing a source and restarting a paused source is allowed, and the callback will still be invoked when the source naturally reaches an AL_STOPPED state.
callbackThe callback to be called when the source stops.
userdataAn opaque user pointer passed to the callback.

Returns

AL_FALSE on error.

Version Added: 1.1

See Also

alureStopSource, alureUpdate

+

alurePlaySource

ALURE_API ALboolean ALURE_APIENTRY alurePlaySource(
   ALuint source,
   void (*callback)(void *userdata, ALuint source),
   void *userdata
)

Plays the specified source ID and watches for it to stop.  When a source enters an AL_STOPPED state, the specified callback will be called by alureUpdate to alert the application.  As with alurePlaySourceStream, if ALC_EXT_thread_local_context is not supported the current context must not be changed while the source is being watched (before the callback is called or alureStopSource is called).  It also must not be deleted while being watched.

Parameters

sourceThe source ID to play.  As with alurePlaySourceStream, it is valid to set source properties not related to the playback state (ie. you may change a source’s position, pitch, gain, etc).  Pausing a source and restarting a paused source is allowed, and the callback will still be invoked when the source naturally reaches an AL_STOPPED state.
callbackThe callback to be called when the source stops.
userdataAn opaque user pointer passed to the callback.

Returns

AL_FALSE on error.

Version Added: 1.1

See Also

alureStopSource, alureUpdate

alureStopSource

ALURE_API ALboolean ALURE_APIENTRY alureStopSource(ALuint source,
ALboolean run_callback)

Stops the specified source ID, and any associated stream.  The previously specified callback will be invoked if ‘run_callback’ is not AL_FALSE.  Sources that were not started with alurePlaySourceStream or alurePlaySource will still be stopped, but will not have any callback called for them.

Returns

AL_FALSE on error.

Version Added: 1.1

See Also

alurePlaySourceStream, alurePlaySource

diff --git a/src/streamplay.cpp b/src/streamplay.cpp index a21353f..74006fc 100644 --- a/src/streamplay.cpp +++ b/src/streamplay.cpp @@ -314,7 +314,7 @@ extern "C" { * numBufs - The number of buffers used to queue with the OpenAL source. Each * buffer will be filled with the chunk length specified when the * stream was created. This value must be at least 2. More buffers at - * a larger size will decrease the time needed between updates, but + * a larger size will increase the time needed between updates, but * at the cost of more memory usage. * loopcount - The number of times to loop the stream. When the stream reaches * the end of processing, it will be rewound to continue buffering @@ -465,7 +465,7 @@ ALURE_API ALboolean ALURE_APIENTRY alurePlaySourceStream(ALuint source, * Plays the specified source ID and watches for it to stop. When a source * enters an AL_STOPPED state, the specified callback will be called by * to alert the application. As with , if - * ALC_EXT_thread_local_context is not supported, the current context must not + * ALC_EXT_thread_local_context is not supported the current context must not * be changed while the source is being watched (before the callback is called * or is called). It also must not be deleted while being * watched. -- 2.11.4.GIT