<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro GTK3 and Mac</title>
		<link>http://www.allegro.cc/forums/view/618228</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 04 Sep 2020 04:58:29 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I am trying to improve an OpenSource project called gpredict, I would like to add audio... and hence I ended up at your door. </p><p>But there is something unpleasant going on with the Mac and it&#39;s instance to run Allegro from the main thread - because this is what GTK3 also appears to want to do.... </p><p>Enough talk - Please find 4 files attached....</p><p>This builds are runs wonderfully in Ubuntu, this crashes and after 4 hours of trying to trick Allegro into use a fake_main, calling main etc ... I am calling it quits for today. </p><p>Can anyone point me to the path of happiness with regards to Allegro and gtk3 on a mac ?? </p><p>Build steps</p><p>    mkdir build<br />    cd build<br />    cmake ..</p><p>There should be 3 files...</p><p>    gtk<br />    gtk2<br />    gtk3</p><p>Trying to show that Gtk Works, works with a simple Dialog, and then Works with an Audio file ...  (Sorry you will need to change the definition of this file in audio.h)</p><p>Many thanks for taking the time to read this.</p><p>   Tim
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (deepstar)</author>
		<pubDate>Thu, 03 Sep 2020 14:41:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve  never used GTK and Allegro together on MacOS (the native dialogs use Cocoa) but did your investigations include <a href="https://liballeg.org/a5docs/trunk/misc.html#al_run_main">al_run_main</a>?</p><p>[edit] are you using Allegro just for audio in the app?</p><p>[edit2] actually the audio stuff is not so picky about the threads. For example this works on my Mac
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;allegro5/allegro.h&gt;</span>
<span class="p">#include &lt;allegro5/allegro_audio.h&gt;</span>
<span class="p">#include &lt;allegro5/allegro_acodec.h&gt;</span>
<span class="p">#undef main</span>
<span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span>
  <a href="http://www.allegro.cc/manual/al_install_audio"><span class="a">al_install_audio</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/al_reserve_samples"><span class="a">al_reserve_samples</span></a><span class="k2">(</span><span class="n">1</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/al_init_acodec_addon"><span class="a">al_init_acodec_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/ALLEGRO_SAMPLE"><span class="a">ALLEGRO_SAMPLE</span></a><span class="k3">*</span> s<span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_sample"><span class="a">al_load_sample</span></a><span class="k2">(</span><span class="s">"welcome.wav"</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/al_play_sample"><span class="a">al_play_sample</span></a><span class="k2">(</span>s, <span class="n">1</span>.<span class="n">0</span>, <span class="n">0</span>.<span class="n">0</span>, <span class="n">1</span>.<span class="n">0</span>, ALLEGRO_PLAYMODE_ONCE, NULL<span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.delorie.com/djgpp/doc/libc/libc_731.html" target="_blank">sleep</a><span class="k2">(</span><span class="n">10</span><span class="k2">)</span><span class="k2">;</span>
  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

Note: #undef main to defeat Allegro&#39;s attempt to take over main. Don&#39;t specify the allegro_main addon. Don&#39;t call <span class="source-code"><a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a></span><br />If you are using Allegro for graphics too, then we will have to think a bit harder.</p><p>(btw, doesn&#39;t GTK have decent audio functions of its own?)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Hull)</author>
		<pubDate>Thu, 03 Sep 2020 22:22:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Peter - Thank u for the #undef main, it all now works correctly. </p><p>Yes I am just looking at adding an Audio output.</p><p>Gtk does have audio capability - gtk_beep !!! Which is now deprecated....</p><p>Many thanks, for the assistance.</p><p> Tim
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (deepstar)</author>
		<pubDate>Fri, 04 Sep 2020 04:58:29 +0000</pubDate>
	</item>
</rss>
