<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Set audio buffer chunk size?</title>
		<link>http://www.allegro.cc/forums/view/612448</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 20 Apr 2013 09:00:37 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>When testing out a game I&#39;m making with Allegro 5, I couldn&#39;t help but notice that the timing on a rapidly-playing (about 5 times per second) sound seemed &quot;off&quot;. What I mean by this is that the sound wasn&#39;t playing at a constant rhythm, but rather erratically changing the timing between each sound.</p><p>Back when I was working with SDL, there was an option you could set when creating initializing the audio that was essentially the size of a &quot;chunk&quot; of audio. This is a completely different thing than the frequency and its normal value was usually around 2048. Making this value a high number would reduce the instance of pops and crackles that might happen on slower computers, but it caused horrid timing issues like the one I described above. Likewise, lowering the value made crackling more likely to happen, but it almost completely fixed any timing issues I was having.</p><p>Is there a way to adjusting this sort of setting in Allegro 5? I read through the API but the only thing that looked promising were the &#39;fragment_count&#39; and &#39;samples&#39; arguments to al_create_audio_stream(). I don&#39;t think this is what I&#39;m looking for, though, because I&#39;m not sure you can even play sound effects to an audio stream.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tumlee)</author>
		<pubDate>Fri, 19 Apr 2013 11:00:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Not in a systematic way, but that would be nice to have. The DirectSound driver&#39;s buffer size can be set through the allegro5.cfg file, under key directsound.buffer_size.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Fri, 19 Apr 2013 13:50:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_create_audio_stream"><span class="a">al_create_audio_stream</span></a></span> accepts a frag_samples parameter - this is essentially your buffer size, in number of samples per fragment (fragment_count) per audio stream.</p><div class="quote_container"><div class="title"><a href="https://www.allegro.cc/manual/al_create_audio_stream">A5 online manual</a> said:</div><div class="quote"><p>
The choice of fragment_count, frag_samples and freq directly influences the audio delay. The delay in seconds can be expressed as:</p><p>delay = fragment_count * frag_samples / freq</p><p>This is only the delay due to Allegro&#39;s streaming, there may be additional delay caused by sound drivers and/or hardware.
</p></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 19 Apr 2013 14:03:02 +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/612448/981089#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>al_create_audio_stream accepts a frag_samples parameter - this is essentially your buffer size, in number of samples per fragment (fragment_count) per audio stream</p></div></div><p> Is it possible to pump calls to al_play_sample() through an audio stream, though? Otherwise, it really doesn&#39;t help me.
</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612448/981087#target">Peter Wang</a> said:</div><div class="quote"><p>Not in a systematic way, but that would be nice to have.</p></div></div><p>If it would be nice to have, should I throw out a feature request for it? Or is there some underlying reason why it can&#39;t be done directly through Allegro?</p><p>I guess I&#39;ll just take your suggestion, though. It probably won&#39;t help any Linux users but it sounds like it will at least solve that problem under Windows.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tumlee)</author>
		<pubDate>Sat, 20 Apr 2013 02:20:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s not hard, just work. Also unsure how to expose it through the API but maybe that can come later.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Sat, 20 Apr 2013 06:19:44 +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/612448/981080#target">Tumlee</a> said:</div><div class="quote"><p> I&#39;m not sure you can even play sound effects to an audio stream.</p></div></div><p>You can play anything you want through a stream. At the lower levels there is no real conceptual difference, other than allegro does the streaming for you when using sample instances.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 20 Apr 2013 07:52:41 +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/612448/981170#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p>You can play anything you want through a stream. At the lower levels there is no real conceptual difference, other than allegro does the streaming for you when using sample instances.</p></div></div><p>From what I understand from the API guide, you can load and play a sound <i>as</i> an audio stream, but that&#39;s not the same thing as playing multiple sample instances <i>through</i> an already-running audio stream, and I don&#39;t think that&#39;s what they&#39;re for. I&#39;m probably not going to solve any lag issues unless I can change the buffer size of the actual <i>mixer</i>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tumlee)</author>
		<pubDate>Sat, 20 Apr 2013 09:00:37 +0000</pubDate>
	</item>
</rss>
