<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>AllegroOgg</title>
		<link>http://www.allegro.cc/forums/view/558006</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 07 Jan 2006 17:11:02 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ll tell you right off that I&#39;m not really an expert C programmer. I can program in C, but understanding new things is a weakness for me with programming.</p><p>So anyway, I recently installed AllegroOgg because I want to use OGG sound files with my game engine. I&#39;ve read the documentation and the example source code, and it goes above my head.</p><p>Here&#39;s what I want to do... I have specific sections in my source code that I want to have AllegroOgg perform very specific tasks. The best way for me to learn is from a very basic example that is broken up into small bits rather than the example provided with AllegroOgg. Here&#39;s four little parts in my code:</p><p>...<br />BITMAP *Dump;<br />// INSERT HERE !! OGG buffer<br />DUH *duhMod;<br />AL_DUH_PLAYER *musMod;<br />const char *cfgFile;<br />...</p><p>...<br />// INSERT HERE !! Open/prepare OGG file &quot;NEWDRUG.OGG&quot; at 44.1kHz<br />dumb_register_stdfiles();<br />duhMod = dumb_load_mod(&quot;BGM00.MOD&quot;);<br />...</p><p>...<br />JumpHere:<br />// INSERT HERE !! Poll OGG file<br />al_poll_duh(musMod);<br />...</p><p>...<br />destroy_bitmap(CombinedLayer);<br />// INSERT HERE !! Free OGG buffer<br />al_stop_duh(musMod);<br />unload_duh(duhMode);<br />allegro_exit();<br />...</p><p>Okay? Those are just bits of my code, but where you see // INSERT HERE !!, that&#39;s where I want to do something with AllegroOgg. I gave you the portions of my code to allow you to see where I need to insert the appropriate code so that it works with the way my program is setup. Would anyone be willing to fill in the missing lines? I hope this isn&#39;t asking much... I think it&#39;s probably about as simple as using MOD files with DUMB, but I actually understood DUMB instructions... AllegroOgg instructions I didn&#39;t think were easy to follow at all.</p><p>EDIT: And BTW, I&#39;m looking to read the file entirely from memory, not from a disk.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Damian Grove)</author>
		<pubDate>Sat, 07 Jan 2006 09:32:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s not AllegroOgg, but APEG can do it:
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td>...</td></tr><tr><td class="number">2</td><td><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>Dump<span class="k2">;</span></td></tr><tr><td class="number">3</td><td>APEG_STREAM <span class="k3">*</span>ogg_stream<span class="k2">;</span> <span class="c">/* HERE */</span></td></tr><tr><td class="number">4</td><td>DUH <span class="k3">*</span>duhMod<span class="k2">;</span></td></tr><tr><td class="number">5</td><td>AL_DUH_PLAYER <span class="k3">*</span>musMod<span class="k2">;</span></td></tr><tr><td class="number">6</td><td><span class="k1">const</span> <span class="k1">char</span> <span class="k3">*</span>cfgFile<span class="k2">;</span></td></tr><tr><td class="number">7</td><td>...</td></tr><tr><td class="number">8</td><td>&#160;</td></tr><tr><td class="number">9</td><td>&#160;</td></tr><tr><td class="number">10</td><td>...</td></tr><tr><td class="number">11</td><td>ogg_stream <span class="k3">=</span> apeg_open_stream<span class="k2">(</span><span class="s">"newdrug.ogg"</span><span class="k2">)</span><span class="k2">;</span> <span class="c">/* HERE */</span></td></tr><tr><td class="number">12</td><td>dumb_register_stdfiles<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td>duhMod <span class="k3">=</span> dumb_load_mod<span class="k2">(</span><span class="s">"BGM00.MOD"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>...</td></tr><tr><td class="number">15</td><td>&#160;</td></tr><tr><td class="number">16</td><td>&#160;</td></tr><tr><td class="number">17</td><td>...</td></tr><tr><td class="number">18</td><td>JumpHere:</td></tr><tr><td class="number">19</td><td>apeg_advance_stream<span class="k2">(</span>ogg_stream, TRUE<span class="c">/*if looping, else FALSE*/</span><span class="k2">)</span><span class="k2">;</span> <span class="c">/* HERE */</span></td></tr><tr><td class="number">20</td><td>al_poll_duh<span class="k2">(</span>musMod<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">21</td><td>...</td></tr><tr><td class="number">22</td><td>&#160;</td></tr><tr><td class="number">23</td><td>&#160;</td></tr><tr><td class="number">24</td><td>...</td></tr><tr><td class="number">25</td><td><a href="http://www.allegro.cc/manual/destroy_bitmap" target="_blank"><span class="a">destroy_bitmap</span></a><span class="k2">(</span>CombinedLayer<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">26</td><td>apeg_close_stream<span class="k2">(</span>ogg_stream<span class="k2">)</span><span class="k2">;</span> <span class="c">/* HERE */</span></td></tr><tr><td class="number">27</td><td>al_stop_duh<span class="k2">(</span>musMod<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">28</td><td>unload_duh<span class="k2">(</span>duhMode<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">29</td><td><a href="http://www.allegro.cc/manual/allegro_exit" target="_blank"><span class="a">allegro_exit</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">30</td><td>...</td></tr></tbody></table></div></div><p>
Getting Ogg to work in APEG with Windows can be a little tricky, though (since you need to build libogg, libvorbis, and libtheora). I think someone made a binary build, but I don&#39;t remember where, unfortunately.</p><p>If you want to read the file from memory (which really there isn&#39;t much of a reason to; disk access is rather minimal), you can do this to open it:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">int</span> size <span class="k3">=</span> file_size<span class="k2">(</span><span class="s">"newdrug.ogg"</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// get size</span>
<span class="k1">void</span> <span class="k3">*</span>buf <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_551.html" target="_blank">malloc</a><span class="k2">(</span>size<span class="k2">)</span><span class="k2">;</span> <span class="c">// allocate memory</span>
<a href="http://www.allegro.cc/manual/PACKFILE" target="_blank"><span class="a">PACKFILE</span></a> <span class="k3">*</span>pf <span class="k3">=</span> <a href="http://www.allegro.cc/manual/pack_fopen" target="_blank"><span class="a">pack_fopen</span></a><span class="k2">(</span><span class="s">"newdrug.ogg"</span>, F_READ<span class="k2">)</span><span class="k2">;</span> <span class="c">// open file</span>
<a href="http://www.allegro.cc/manual/pack_fread" target="_blank"><span class="a">pack_fread</span></a><span class="k2">(</span>buf, size, pf<span class="k2">)</span><span class="k2">;</span> <span class="c">// read file</span>
<a href="http://www.allegro.cc/manual/pack_fclose" target="_blank"><span class="a">pack_fclose</span></a><span class="k2">(</span>pf<span class="k2">)</span><span class="k2">;</span> <span class="c">// close file</span>

ogg_stream <span class="k3">=</span> apeg_open_memory_stream<span class="k2">(</span>buf, size<span class="k2">)</span><span class="k2">;</span>

<span class="c">// and to close:</span>
apeg_close_stream<span class="k2">(</span>ogg_stream<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.delorie.com/djgpp/doc/libc/libc_350.html" target="_blank">free</a><span class="k2">(</span>buf<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Sat, 07 Jan 2006 09:45:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>you might like to try fmod (<a href="http://fmod.org">http://fmod.org</a>).</p><p>In the documentation for fmod_ex it only shows the c++ interface, but the c interface is alsmot exactly the same (Fmod::CreateStream becomes Fmod_CreateStream or something, just look at the C files in the examples folder).</p><p>Fmod_ex lets you use one single interface to play ogg files, mp3 files, wav files (PCM or ADPCM or AIFF and maybe some others, GSM perhaps im not sure), s3m files, mod, xm, it files, and flac files (or decoded from memory, good for datafiles) and you can even give a url to them and they will be streamed off the net. I like it becuase it&#39;s really simple and hassle-free and is still cross-platform compatible.</p><p>The only issue i have with it is it, unlike DUMB, doesn&#39;t honor the Zxx comands in .it files (so a few cool effects are completely ignored). I&#39;ve never once used any allegro sound things (i looked at them once, and decided to keep on searching, once i found fmod i never really turned back).</p><p>Oh yeah, as far as i know fmod places no external dependencies except for it&#39;s runtime dl library/object. You just download it, and copy the sources into your include dir and the mingw libfmod.a into your lib folder (or on linux type make install as root and it&#39;s finsihed). It&#39;s insanely easy.</p><p>Some of the examples failed to build on my linux box, but i didn&#39;t care, it still works great, and i later built them by hand and all worked properly.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (m c)</author>
		<pubDate>Sat, 07 Jan 2006 12:33:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you insist on AllegroOGG then you can try my test program. I translated the comments and messages to Eng and erased most display code to make it look even easier. It loads the file into memory as you wanted.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Murat AYIK)</author>
		<pubDate>Sat, 07 Jan 2006 17:11:02 +0000</pubDate>
	</item>
</rss>
