<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>streaming and looping audio</title>
		<link>http://www.allegro.cc/forums/view/612954</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 13 Jul 2013 07:26:43 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m using <span class="source-code"><a href="http://www.allegro.cc/manual/al_load_audio_stream_f"><span class="a">al_load_audio_stream_f</span></a><span class="k2">(</span><span class="k2">)</span></span> to stream audio, and setting the play mode to <span class="source-code">ALLEGRO_PLAYMODE_LOOP</span> for looping.</p><p>I set the stream to use 2 buffers, and 1024 samples. I noticed that with a higher number of samples, the audio doesn&#39;t loop as well since there&#39;s a more noticeable gap while looping. If I set the number of samples lower, I need more buffers to make the audio play properly. I tried at 8 buffers and 256 samples, and it loops nicely, but when I tested on a very old computer it affected performance.</p><p>My question is: What&#39;s the most efficient combination of buffers and samples I can use performance-wise, and how can I make it loop perfectly?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ph03nix)</author>
		<pubDate>Thu, 11 Jul 2013 21:33:16 +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/612954/987037#target">ph03nix</a> said:</div><div class="quote"><p> when I tested on a very old computer it affected performance.</p></div></div><p>Was the CPU practically maxed out in Resource Meter or whatever?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 11 Jul 2013 22:19:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes it was, but it would spike instead of consistently being high
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ph03nix)</author>
		<pubDate>Thu, 11 Jul 2013 22:23:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A rather simplistic hack would be to choose the amount of buffers and samples based on the speed of your rendering loop. If you have FPS to spare, then use many buffers, if not, then use less. So the old machine gets a bit of delay but not too much use of resources and the new one gets the benefits of it&#39;s performance.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (beoran)</author>
		<pubDate>Thu, 11 Jul 2013 22:52:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What exactly are you trying to do? The buffer size shouldn&#39;t affect the looping. There was a bug in the Ogg Vorbis decoder that would cause the audio to loop too soon, which caused inconsistent playback. This was fixed in the most recent version of Allegro (5.0.10).</p><p>The looping system for streamed audio shouldn&#39;t have any gaps at all. If it does, it is a bug.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Todd Cope)</author>
		<pubDate>Fri, 12 Jul 2013 03:05:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think my wording was a bit off, only the number of samples affects the looping (the higher it is the more of a gap there tends to be), but reducing the number of samples requires more buffers to play without stuttering, which seems to affect performance on my old computer. I&#39;m trying to figure out how to get the best performance <b>and</b> looping from the stream.</p><p>Also forgot to mention I&#39;m using 5.1.7
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ph03nix)</author>
		<pubDate>Fri, 12 Jul 2013 03:22:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Still, you shouldn&#39;t get any gaps in the audio unless the loop points are set incorrectly or the audio data itself has gaps. When the streamed audio runs out, it rewinds to the loop start point and continues to fill the buffer until it&#39;s full.</p><p>Allegro 5.1.7 doesn&#39;t have the Ogg Vorbis fix as it was implemented after that release. You can get the patch <a href="https://www.allegro.cc/forums/thread/612697">here</a> if you don&#39;t want to pull the source from git. If you are using some other audio format, please specify what it is.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Todd Cope)</author>
		<pubDate>Fri, 12 Jul 2013 04:15:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I forgot to mention it, but I am using ogg vorbis. I&#39;d love to try the patch (sounds like it would fix my looping issue), but I&#39;m using a built version of allegro so I don&#39;t think I can apply it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ph03nix)</author>
		<pubDate>Fri, 12 Jul 2013 05:30:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The patch won&#39;t do you any good, then. Maybe the devs will release 5.1.8 soon.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Todd Cope)</author>
		<pubDate>Fri, 12 Jul 2013 07:52:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I tried out 5.0.10 and the looping problem isn&#39;t there at all, good to know the source of the issue. Just wondering, will native dialog menus be added to the stable branch eventually?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ph03nix)</author>
		<pubDate>Sat, 13 Jul 2013 02:35:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think the native menu dialogs need a second pass on the API before going in to the stable branch.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Sat, 13 Jul 2013 03:12:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m not intending to put the menus on the 5.0 branch.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Sat, 13 Jul 2013 07:26:43 +0000</pubDate>
	</item>
</rss>
