65 lines
17 KiB
HTML
65 lines
17 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Game Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
|
||
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
|
||
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheGameKit.html" title="The Game Kit" /><link rel="prev" href="BSimpleGameSound.html" title="BSimpleGameSound" /><link rel="next" href="BWindowScreen.html" title="BWindowScreen" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BSimpleGameSound.html" title="BSimpleGameSound"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheGameKit.html" title="The Game Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BWindowScreen.html" title="BWindowScreen"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Game Kit</div></div><div id="headerB">Prev: <a href="BSimpleGameSound.html">BSimpleGameSound</a> Up: <a href="TheGameKit.html">The Game Kit</a> Next: <a href="BWindowScreen.html">BWindowScreen</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound"></a>BStreamingGameSound</h2></div></div></div><a id="id952092" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td><a class="link" href="BGameSound.html" title="BGameSound">BGameSound</a></td></tr><tr><td>Mix-in Classes:</td><td>–</td></tr><tr><td>Declared In:</td><td><code class="filename">game/StreamingGameSound.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libgame.so</code></td></tr><tr><td>Allocation:</td><td>–</td></tr></tbody></table></td><td>
|
||
<a class="link overview" href="BStreamingGameSound_Overview.html" title="BStreamingGameSound">Class Overview</a>
|
||
<div class="toc"><ul><li><span class="section"><a href="BStreamingGameSound.html#BStreamingGameSound_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BStreamingGameSound.html#BStreamingGameSound_MemberFunctions">Member Functions</a></span></li></ul></div>
|
||
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_Constructor"></a>BStreamingGameSound()</h4></div></div></div><div class="synopsisgroup">
|
||
<code class="constructorsynopsis cpp"><span class="methodname">BStreamingGameSound</span>(<span class="methodparam"><span class="type">size_t </span><span class="parameter">inBufferFrameCount</span></span>,<br /> <span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="TheGameKit_DefinedTypes.html#gs_audio_format" title="gs_audio_format">gs_audio_format</a>* </span><span class="parameter">format</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">inBufferCount</span><span class="initializer"> = 2</span></span>,<br /> <span class="methodparam"><span class="type">BGameSoundDevice* </span><span class="parameter">device</span><span class="initializer"> = <span class="constant">NULL</span></span></span>);</code>
|
||
|
||
<code class="constructorsynopsis cpp"><span class="modifier">protected </span><span class="methodname">BStreamingGameSound</span>(<span class="methodparam"><span class="type">BGameSoundDevice </span><span class="parameter">device</span></span>);</code>
|
||
</div><p>Prepares the object to play streamed audio.
|
||
<code class="parameter">inBufferFrameCount</code> specifies the number of frames
|
||
each audio buffer should be able to hold. <code class="parameter">format</code>
|
||
indicates the audio format that will be streamed.
|
||
<code class="parameter">inBufferCount</code> specifies the number of buffers to
|
||
use, and, as always, <code class="parameter">device</code> is the sound device to
|
||
use for playback.</p><p>By default, two audio buffers are used.</p><div class="admonition note"><div class="title">Note</div><div class="graphic"><img class="icon" alt="Note" width="32" src="./images/admonitions/Info_32.png" /><div class="text"><p>Currently, <code class="parameter">device</code> must always be
|
||
<code class="constant">NULL</code> to indicate that the default
|
||
playback device should be used.</p></div></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_Destructor"></a>~BStreamingGameSound</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BStreamingGameSound</span>();</code><p>Stops playing the sound.</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_FillBuffer"></a>FillBuffer()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">FillBuffer</span>(<span class="methodparam"><span class="type">void* </span><span class="parameter">inBuffer</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">byteCount</span></span>);</code><p>
|
||
Fills the buffer specified by <code class="parameter">inBuffer</code> with <code class="parameter">byteCount</code> bytes of audio data.
|
||
</p><p>
|
||
In the <code class="classname">BStreamingGameSound</code> implemenation, this function calls the stream
|
||
hook, if one exists.
|
||
</p><p>
|
||
See also: <a class="link" href="BStreamingGameSound.html#BStreamingGameSound_SetStreamHook" title="SetStreamHook()"><code class="methodname">SetStreamHook()</code></a>
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_InitCheck"></a>InitCheck()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">InitCheck</span>() <span class="modifier">const</span>;</code><p>
|
||
Returns a <span class="type">status_t</span> indicating whether or not the object was successfully
|
||
instantiated.
|
||
</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>
|
||
The sound was successfully initialized.
|
||
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ERROR</code>.</span></p></td><td><p>
|
||
Unable to create a sound player.
|
||
</p></td></tr><tr><td><p><span class="term">Other errors.</span></p></td><td><p>
|
||
The sound player may return errors.
|
||
</p></td></tr></tbody></table><p>
|
||
See also: the <code class="classname">BStreamingGameSound</code>
|
||
<a class="link" href="BStreamingGameSound.html#BStreamingGameSound_Constructor" title="BStreamingGameSound()">constructor</a>
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_Lock"></a><a id="BStreamingGameSound_Unlock"></a>
|
||
Lock(), Unlock()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">Lock</span>();</code><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">Unlock</span>();</code><p>
|
||
<code class="methodname">Lock()</code> locks the <code class="classname">BStreamingGameSound</code> to prevent unpleasant collisions in
|
||
the land of multithreadedness; it returns <code class="constant">true</code> if it was able to lock the
|
||
object, otherwise <code class="constant">false</code> is returned. <code class="methodname">Unlock()</code> releases the lock.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_SetAttributes"></a>SetAttributes()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">status_t </span><span class="methodname">SetAttributes</span>(<span class="methodparam"><span class="type"><a class="link" href="TheGameKit_DefinedTypes.html#gs_attribute" title="gs_attribute">gs_attribute</a>* </span><span class="parameter">inAttributes</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">inAttributeCount</span></span>);</code><p>
|
||
<code class="methodname">SetAttributes()</code> is implemented to disallow the <code class="constant">B_GS_LOOPING</code> attribute,
|
||
since streamed sounds can't loop.
|
||
</p><p>
|
||
See also:
|
||
<a class="link" href="BGameSound.html#BGameSound_SetAttributes" title="SetAttributes(), GetAttributes()"><code class="methodname">BGameSound::SetAttributes()</code></a>
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_SetParameters"></a>SetParameters()</h4></div><div xmlns:d="http://docbook.org/ns/docbook"><h5 xmlns="http://www.w3.org/1999/xhtml" class="subtitle">protected</h5></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">status_t </span><span class="methodname">SetParameters</span>(<span class="methodparam"><span class="type">size_t </span><span class="parameter">inBufferFrameCount</span></span>,<br /> <span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="TheGameKit_DefinedTypes.html#gs_audio_format" title="gs_audio_format">gs_audio_format</a>* </span><span class="parameter">fmt</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">inBufferCount</span></span>);</code><p>
|
||
Changes the <code class="classname">BStreamingGameSound</code> object's parameters. This lets you change
|
||
the buffer size, audio format, and number of buffers after the object has
|
||
been instantiated.
|
||
</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>
|
||
No error.
|
||
</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ERROR</code>.</span></p></td><td><p>
|
||
Couldn't change the parameters.
|
||
</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BStreamingGameSound_SetStreamHook"></a>SetStreamHook()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">status_t </span><span class="methodname">SetStreamHook</span>(<span class="methodparam"><span class="type">void </span> (*<span class="parameter">hook</span>)(<span class="type">void * </span><span class="parameter">cookie</span>, <span class="type">void* </span><span class="parameter">inBuffer</span>, <span class="type">size_t </span><span class="parameter">byteCount</span>, <span class="type">BStreamingGameSound* </span><span class="parameter">object</span>)</span>,<br /> <span class="methodparam"><span class="type">void* </span><span class="parameter">cookie</span></span>);</code><p>Specfies the hook function to be called to fill buffers with audio
|
||
data.</p><p>
|
||
The inputs to the hook function are:
|
||
</p><table class="variablelist parameters"><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="parameter">cookie</code></span></p></td><td><p>A user-defined value. Indicates the cookie pointer that will be passed to the hook
|
||
function.</p></td></tr><tr><td><p><span class="term"><code class="parameter">inBuffer</code></span></p></td><td><p>A pointer to the buffer to be filled with audio data.</p></td></tr><tr><td><p><span class="term"><code class="parameter">byteCount</code></span></p></td><td><p>The size of the buffer in bytes.</p></td></tr><tr><td><p><span class="term"><code class="parameter">object</code></span></p></td><td><p>A pointer to the <code class="classname">BStreamingGameSound</code> object.</p></td></tr></tbody></table><p>And returns...</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>The hook function was set without error.</p></td></tr></tbody></table></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BSimpleGameSound.html">BSimpleGameSound</a> Up: <a href="TheGameKit.html">The Game Kit</a> Next: <a href="BWindowScreen.html">BWindowScreen</a> </div><div id="footerB"><div id="footerBL"><a href="BSimpleGameSound.html" title="BSimpleGameSound"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheGameKit.html" title="The Game Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BWindowScreen.html" title="BWindowScreen"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
|
||
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>
|