<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>How do I play music B after A ends?</title>
		<link>http://www.allegro.cc/forums/view/618332</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 08 Jan 2021 15:30:01 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have background music consisting of two Ogg files. One is an intro, the other is a loop. So the two should be played like A,B,B,B,... The gap between A and B should be as short as possible.</p><p>What is the best way to start audio stream B directly after audio stream A ends? I don&#39;t think there is a way to generate an event when an audio stream has finished, and respond to that, right?</p><p>I can think of two other ways. One is to carefully set a timer at exactly the moment A is supposed to end, and start playing B at the right moment.</p><p>The other is to take control of how the audio buffer is filled. First fill it with data from stream A, until it runs out, then fill it with data from stream B.  That&#39;s a bit more involved that loading and playing a stream, but it will probably give the most glitchless result.</p><p>What do you think is the best approach? Or is there another option?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Thu, 07 Jan 2021 20:15:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Never used this, but...</p><p><a href="https://liballeg.org/a5docs/trunk/audio.html#allegro_event_audio_stream_finished">https://liballeg.org/a5docs/trunk/audio.html#allegro_event_audio_stream_finished</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Thu, 07 Jan 2021 20:26:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ideally, you have the music ready and prepared before playing it, so you just stop the above and reproduce the new in 2 lines quickly. Although you could also reproduce the new and then stop the old.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (RmBeer2)</author>
		<pubDate>Fri, 08 Jan 2021 02:12:29 +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/618332/1048824#target">amarillion</a> said:</div><div class="quote"><p> The other is to take control of how the audio buffer is filled. First fill it with data from stream A, until it runs out, then fill it with data from stream B. That&#39;s a bit more involved that loading and playing a stream, but it will probably give the most glitchless result.</p></div></div><p>This is the only way that will have no playback gaps. We have an issue open to make the loading bit easier: <a href="https://github.com/liballeg/allegro5/issues/1046">https://github.com/liballeg/allegro5/issues/1046</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Fri, 08 Jan 2021 05:56:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If the oggs aren&#39;t absolutely huge - and you&#39;re happy with that A,B,B,B pattern - I guess you could do this:</p><ul><li><p>Concatenate A and B into a single file with ffmpeg or somesuch
</p></li><li><p>Load the file
</p></li><li><p>Call <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_audio_stream_loop_secs"><span class="a">al_set_audio_stream_loop_secs</span></a></span>, setting <span class="source-code">start</span> to the original length of A
</p></li></ul></div>]]>
		</description>
		<author>no-reply@allegro.cc (dthompson)</author>
		<pubDate>Fri, 08 Jan 2021 15:30:01 +0000</pubDate>
	</item>
</rss>
