42 lines
14 KiB
HTML
42 lines
14 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="BDirectWindow.html" title="BDirectWindow" /><link rel="next" href="BGameSound.html" title="BGameSound" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BDirectWindow.html" title="BDirectWindow"><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="BGameSound.html" title="BGameSound"><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="BDirectWindow.html">BDirectWindow</a> Up: <a href="TheGameKit.html">The Game Kit</a> Next: <a href="BGameSound.html">BGameSound</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="BFileGameSound"></a>BFileGameSound</h2></div></div></div><a id="id948072" 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="BStreamingGameSound.html" title="BStreamingGameSound">BStreamingGameSound</a></td></tr><tr><td>Mix-in Classes:</td><td>–</td></tr><tr><td>Declared In:</td><td><code class="filename">game/FileGameSound.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libgame.so</code></td></tr><tr><td>Allocation:</td><td>Constructor only</td></tr></tbody></table></td><td>
|
||
<a class="link overview" href="BFileGameSound_Overview.html" title="BFileGameSound">Class Overview</a>
|
||
<div class="toc"><ul><li><span class="section"><a href="BFileGameSound.html#BFileGameSound_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BFileGameSound.html#BFileGameSound_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="BFileGameSound_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="BFileGameSound_Constructor"></a>BFileGameSound()</h4></div></div></div><div class="synopsisgroup">
|
||
<code class="constructorsynopsis cpp"><span class="methodname">BFileGameSound</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">entry_ref* </span><span class="parameter">inFile</span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">looping</span><span class="initializer"> = <span class="constant">true</span></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="methodname">BFileGameSound</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">inFile</span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">looping</span><span class="initializer"> = <span class="constant">true</span></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>
|
||
</div><p>Prepares the object to play the specified sound file, which can be
|
||
specified either by <span class="type">entry_ref</span> or pathname in the
|
||
<code class="parameter">inFile</code> argument.</p><p>If the <code class="parameter">looping</code> flag is <code class="constant">true</code> (which it is by default), the sound
|
||
automatically loops back to the beginning and replays when the end of the
|
||
sound is reached. This is useful for easily playing background music (for
|
||
example).</p><p>In both cases, <code class="parameter">device</code> specifies the sound device that should be used for
|
||
playing the sound; <code class="constant">NULL</code> uses the default sound player.</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>.</p></div></div></div><p>After instantiating the <code class="classname">BFileGameSound</code> object, you should call
|
||
<a class="link" href="BFileGameSound.html#BFileGameSound_InitCheck" title="InitCheck()"><code class="methodname">InitCheck()</code></a> to determine whether or not the sound was successfully
|
||
created.</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="BFileGameSound_Destructor"></a>~BFileGameSound</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BFileGameSound</span>();</code><p>A typical destructor.</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="BFileGameSound_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="BFileGameSound_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"><code class="constant">B_NO_MEMORY</code>.</span></p></td><td><p>Can't get enough memory to preload the sound.</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></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="BFileGame_SoundPreload"></a>Preload()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">Preload</span>();</code><p><code class="methodname">Preload()</code> preloads enough of the sound file into memory that starting
|
||
playback of the sound won't cuase a delay while the first chunk of data
|
||
is fetched from disk.</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>
|
||
Preloading was successful.
|
||
</p></td></tr><tr><td><p><span class="term">Port errors.</span></p></td><td><p>
|
||
Unable to communicate with the streaming sound port.
|
||
</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="BFileGameSound_SetPaused"></a><a id="BFileGameSound_IsPaused"></a>
|
||
SetPaused(), IsPaused()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetPaused</span>(<span class="methodparam"><span class="type">bool </span><span class="parameter">isPaused</span></span>,<br /> <span class="methodparam"><span class="type">bigtime_t </span><span class="parameter">rampTime</span></span>);</code><code class="methodsynopsis cpp"><span class="type">int32 </span><span class="methodname">IsPaused</span>();</code><p><code class="methodname">SetPaused()</code> pauses if <code class="parameter">isPaused</code>
|
||
is <code class="constant">true</code>, and unpauses if <code class="parameter">isPaused</code> is
|
||
<code class="constant">false</code>. If <code class="parameter">rampTime</code> is nonzero, the sound ramps up to speed (or down to
|
||
stopped) instead of instantly changing state. The number of microseconds
|
||
specified by <code class="parameter">rampTime</code> indicates how long the change should take to
|
||
complete.</p><p><code class="methodname">IsPaused()</code> returns value indicating whether or not the sound is paused,
|
||
or if a pause is in process of being initiated (if ramping is underway).
|
||
The result is one of these values:</p><table class="variablelist constants"><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_NOT_PAUSED</code></span></p></td><td><p>The sound is playing normally.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_PAUSE_IN_PROGRESS</code></span></p></td><td><p>The sound is ramping toward or away from a
|
||
paused state.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_PAUSED</code></span></p></td><td><p>The sound is paused.</p></td></tr></tbody></table><p>Because these constants are members of the <code class="classname">BFileGameSound</code> class, be sure
|
||
to refer to them as
|
||
<span class="code"><code class="classname">BFileGameSound</code>::<code class="constant">B_NOT_PAUSED</code></span>
|
||
and so forth.</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 pause occurred without error.</p></td></tr><tr><td><p><span class="term"><code class="constant">EALREADY</code>.</span></p></td><td><p>The sound is already in the requested state.</p></td></tr></tbody></table></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BDirectWindow.html">BDirectWindow</a> Up: <a href="TheGameKit.html">The Game Kit</a> Next: <a href="BGameSound.html">BGameSound</a> </div><div id="footerB"><div id="footerBL"><a href="BDirectWindow.html" title="BDirectWindow"><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="BGameSound.html" title="BGameSound"><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>
|