<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro sample/stream</title>
		<link>http://www.allegro.cc/forums/view/608940</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 01 Dec 2011 05:01:53 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Okay in my game, I have background music, currently it is in:  &#39;al_play_sample(bg_music, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_LOOP, NULL);&#39;</p><p>but when I pause the game I want the sample to pause. </p><p>How could I do that? Or do I have to make a stream! and If so how do I make a stream?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (larzconwell)</author>
		<pubDate>Thu, 01 Dec 2011 04:35:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The manual is your friend.</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_stop_sample"><span class="a">al_stop_sample</span></a>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 01 Dec 2011 04:42:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Okay here&#39;s how its working</p><p>if (bg_music_on == false) {<br />  al_stop_samples();<br />  al_play_sample(bg_music, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_LOOP, NULL);<br />  bg_music_on = true;<br />} else {<br />  al_stop_samples();<br />  bg_music_on = false;<br />}</p><p>When I press enter it runs through that if..else, bg_music_on is false at first.</p><p>When I press enter again and it starts the sample, it restarts it. How do I make it pause? or turn the gain down
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (larzconwell)</author>
		<pubDate>Thu, 01 Dec 2011 04:47:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The simple API that you are using doesn&#39;t support that sort of thing. If you want to micro-manage, you&#39;ll need to load sample data and create a sample instance and use <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_sample_instance_playing"><span class="a">al_set_sample_instance_playing</span></a><span class="k2">(</span><span class="k2">)</span></span>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Thu, 01 Dec 2011 04:52:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In this case you&#39;re better of not using the simple audio API, but using the more advanced API.</p><p>You&#39;d do something like this:
</p><div class="source-code snippet"><div class="inner"><pre><span class="c">/* Level initialization */</span>
<a href="http://www.allegro.cc/manual/ALLEGRO_SAMPLE_INSTANCE"><span class="a">ALLEGRO_SAMPLE_INSTANCE</span></a><span class="k3">*</span> bg_music_instance <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_sample_instance"><span class="a">al_create_sample_instance</span></a><span class="k2">(</span>bg_music<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_attach_sample_instance_to_mixer"><span class="a">al_attach_sample_instance_to_mixer</span></a><span class="k2">(</span>bg_music_instance, <a href="http://www.allegro.cc/manual/al_get_default_mixer"><span class="a">al_get_default_mixer</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_set_sample_instance_playmode"><span class="a">al_set_sample_instance_playmode</span></a><span class="k2">(</span>bg_music_instance, ALLEGRO_PLAYMODE_LOOP<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/al_play_sample_instance"><span class="a">al_play_sample_instance</span></a><span class="k2">(</span>bg_music_instance<span class="k2">)</span><span class="k2">;</span>

<span class="c">/* Game paused */</span>
<a href="http://www.allegro.cc/manual/al_set_sample_instance_playing"><span class="a">al_set_sample_instance_playing</span></a><span class="k2">(</span>bg_music_instance, <span class="k1">false</span><span class="k2">)</span><span class="k2">;</span>

<span class="c">/* Game un-paused */</span>
<a href="http://www.allegro.cc/manual/al_set_sample_instance_playing"><span class="a">al_set_sample_instance_playing</span></a><span class="k2">(</span>bg_music_instance, <span class="k1">true</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 01 Dec 2011 04:52:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That works great! Thanks!! Just it still, restarts the song.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (larzconwell)</author>
		<pubDate>Thu, 01 Dec 2011 04:57:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_set_voice_position"><span class="a">al_set_voice_position</span></a>
<a href="http://www.allegro.cc/manual/al_get_voice_position"><span class="a">al_get_voice_position</span></a>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 01 Dec 2011 04:58:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It does? That&#39;s odd. Well, then you can save the spot you&#39;re in the music before you stop it using <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_sample_instance_position"><span class="a">al_get_sample_instance_position</span></a></span> and then do <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_sample_instance_position"><span class="a">al_set_sample_instance_position</span></a></span> after you restart it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 01 Dec 2011 04:59:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Instead of using &#39;al_set_sample_instance_playing&#39; I used &#39;al_set_sample_instance_gain&#39;, It works good enough!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (larzconwell)</author>
		<pubDate>Thu, 01 Dec 2011 05:01:53 +0000</pubDate>
	</item>
</rss>
