<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>music</title>
		<link>http://www.allegro.cc/forums/view/615222</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 27 Mar 2015 22:51:54 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What is the best way to play music in game.</p><p>I was using al_load_sample and it all works fine. but this is slow to load as it all has to be loaded into memory at the start (and will eventually use a lot of memory).</p><p>So I tried al_load_audio_stream, which works, but is poorly documented in how to control it. <br />	<br />al_attach_audio_stream_to_mixer(Music, al_get_default_mixer()); The music plays fine.<br />But now how to stop it, it just keeps adding new music over the old music so I end up with multiple music files playing at once.</p><p>Also when it gets to the end of the file, it will no longer play it.</p><p>I have dozens of ogg files, that I need to be able to play at random, however when I play a new one, I need the old one to stop, or fade would be better.</p><p>The documentation is fine for documenting what each function does, but it dosent give an overview of how to use them all together and what is the correct way to use them.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (duncan perham)</author>
		<pubDate>Fri, 27 Mar 2015 16:26:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I haven&#39;t used the audio addon much myself, but it seems that you can stop an audio stream by passing <tt>false</tt> to <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_audio_stream_playing"><span class="a">al_set_audio_stream_playing</span></a></span>.<br />I think you can accomplish fading of an individual audio-stream by calling <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_audio_stream_gain"><span class="a">al_set_audio_stream_gain</span></a></span> repeatedly with values 1.0 ... 0.0.<br />However, I guess you should wait for someone with more experience with the audio addon... </p><p>Edit:<br />You can set <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_audio_stream_playmode"><span class="a">al_set_audio_stream_playmode</span></a></span> to <tt>ALLEGRO_PLAYMODE_LOOP</tt> if you want the stream to start anew after it&#39;s finished.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Polybios)</author>
		<pubDate>Fri, 27 Mar 2015 17:51:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_attach_audio_stream_to_mixer"><span class="a">al_attach_audio_stream_to_mixer</span></a></span> has a link to <span class="source-code"><a href="http://www.allegro.cc/manual/al_detach_audio_stream"><span class="a">al_detach_audio_stream</span></a></span> in the documentation, so that would be my first guess to stop it again.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Fri, 27 Mar 2015 18:25:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/615222/1011598#target">Polybios</a> said:</div><div class="quote"><p>
I think you can accomplish fading of an individual audio-stream by calling al_set_audio_stream_gain repeatedly with values 1.0 ... 0.0.
</p></div></div><p>
Isn&#39;t that fairly inefficient and subject to logic loop latency? Shouldn&#39;t audio playback (since it already depends so much on timing) support something like 
</p><div class="source-code snippet"><div class="inner"><pre>al_set_audio_stream_gradient<span class="k2">(</span>stream, start_volume, end_volume, time_for_envelope<span class="k2">)</span>?
</pre></div></div><p>
Ideally, you&#39;d could also use a *_get_gradient_value and *_stop_gradient, so you could change the envelope mid-gradient. But you could fall back to the normal way for those if you had to.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Fri, 27 Mar 2015 22:51:54 +0000</pubDate>
	</item>
</rss>
