<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Cannot create an ALLEGRO_VOICE object in Allegro5</title>
		<link>http://www.allegro.cc/forums/view/616714</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 09 Feb 2017 01:00:03 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m working on a game for Allegro 5 and I&#39;m trying to get an ALLEGRO_VOICE object created: <br /><tt>m_voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, ALLEGRO_CHANNEL_CONF_2);</tt></p><p>The program will not make this, and Visual Studio likes to place it in memory address <tt>0x00000000</tt>.</p><p>What I&#39;m trying to do is create looping game music that will repeat itself after finishing an initial warm-up part. I do not know a good name for this kind of looping music. I suppose like <a href="https://www.youtube.com/watch?v=KMYXYewC0Y0">this song.</a></p><p>Any alternative suggestions for how to accomplish this are welcome.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AgentBaron)</author>
		<pubDate>Mon, 30 Jan 2017 23:00:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you don&#39;t need a voice, just use the default mixer instead. Look for example here: <a href="https://github.com/liballeg/allegro5/blob/master/examples/ex_saw.c">https://github.com/liballeg/allegro5/blob/master/examples/ex_saw.c</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 31 Jan 2017 00:49:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_create_voice"><span class="a">al_create_voice</span></a></span> only fails when this fails :</p><div class="quote_container"><div class="title">al_create_voice said:</div><div class="quote"><p>
</p><div class="source-code"><div class="toolbar"><span class="name">kcm_voice.c</span><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number"> 90</span>   <span class="k1">if</span> <span class="k2">(</span>_al_kcm_driver-&gt;allocate_voice<span class="k2">(</span>voice<span class="k2">)</span> <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 91</span>      <a href="http://www.allegro.cc/manual/al_destroy_mutex"><span class="a">al_destroy_mutex</span></a><span class="k2">(</span>voice-&gt;mutex<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 92</span>      <a href="http://www.allegro.cc/manual/al_destroy_cond"><span class="a">al_destroy_cond</span></a><span class="k2">(</span>voice-&gt;cond<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 93</span>      <a href="http://www.allegro.cc/manual/al_free"><span class="a">al_free</span></a><span class="k2">(</span>voice<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 94</span>      <span class="k1">return</span> NULL<span class="k2">;</span>
<span class="number"> 95</span>   <span class="k2">}</span>
</div></div><p>
</p></div></div><p>

allocate_voice is a function pointer in the ALLEGRO_AUDIO_DRIVER structure. Its value depends on which audio driver you&#39;re using. Debug this in GDB and set a breakpoint in al_create_voice. Print out the value of _al_kcm_driver-&gt;allocate_voice to see which function it is calling. Then debug that function and so on. I can&#39;t do this right now because I&#39;m not at home and I don&#39;t have easy access to GDB.</p><p>Short answer : It depends on which driver you&#39;re using.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 31 Jan 2017 02:43:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks for the suggestions. I was able to use the default mixer without creating a voice, though for some reason trying to make a custom mixer results in pure and utter silence.</p><p>Since this is a project for school, I do not have the luxury of taking the time to troubleshoot as Edgar Reynaldo suggested. However, I will definitely look into this once my semester is over and post here any findings.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AgentBaron)</author>
		<pubDate>Thu, 02 Feb 2017 06:31:30 +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/616714/1028160#target">AgentBaron</a> said:</div><div class="quote"><p>
Thanks for the suggestions. I was able to use the default mixer without creating a voice, though for some reason trying to make a custom mixer results in pure and utter silence.
</p></div></div><p>
Did you remember to attach the mixer you created to the default voice?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 02 Feb 2017 07:10:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I actually did not attach anything to a default voice. I don&#39;t even see anything pooping up in my autocomplete. Is this a feature in Allegro 5.2.2? I am presently using a slightly out of date version.</p><p>I was able to get the sound working by attaching the samples to a default mixer, though. Is there a reason why a default mixer would give sound while a custom mixer gives silence?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AgentBaron)</author>
		<pubDate>Wed, 08 Feb 2017 10:56:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>There is only one voice in allegro 5. If you don&#39;t attach your mixer to it, there will be no output from it. The voice is basically the hardware and outputs the sound. When you call <span class="source-code"><a href="http://www.allegro.cc/manual/al_reserve_samples"><span class="a">al_reserve_samples</span></a></span>, a default voice and mixer are created for you. Otherwise you have to create your own, which you&#39;ve had problems with IIRC.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 08 Feb 2017 20:56:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The default mixer is already attached to the default voice. So if you do nothing sound already will work. ALLEGRO_VOICE is only needed in very special situations - in fact could probably say it is a mis-feature we only still have for historic reasons.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 08 Feb 2017 23:43:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How do you choose the sound driver???
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 09 Feb 2017 01:00:03 +0000</pubDate>
	</item>
</rss>
