Skip to content

Commit

Permalink
some more rephrasing in the docs, mainly to be clearer on interrupts
Browse files Browse the repository at this point in the history
  • Loading branch information
stuij committed Jul 27, 2021
1 parent 2de3639 commit 831636c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/conv2aas.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<br><font size=+1 color="#333377">:: Creating Sound Files</font>
<blockquote>

<p>These days, the most popular MOD trackers seem to be Milkytracker and OpenMPT. For more info, read a short summary on <a href=http://modarchive.org/index.php?article-trackers>modarchive</a>. If you prefer an Impulse Tracker-like interface, there's <a href="https://github.com/hukkax/Propulse">Propulse</a></p>
<p>These days, the most popular MOD trackers seem to be Milkytracker and OpenMPT. For more info, read a short summary on <a href=http://modarchive.org/index.php?article-trackers>modarchive</a>. If you prefer an Impulse Tracker-like interface, there's <a href="https://github.com/hukkax/Propulse">Propulse</a>.</p>

<p>For converting samples into the appropriate RAW and WAV formats, I recommend <a href="http://sox.sourceforge.net/">SoX</a>.</p>

Expand Down
18 changes: 13 additions & 5 deletions docs/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,17 @@
<br><font size=+1 color="#333377">:: Interrupt Handling</font>
<blockquote>

<p>AAS requires for one or some AAS-specific interrupts are set up correctly. AAS can be made to work with a number of different methods, provided that a Timer 1 interrupt results in a call to <a href="api_general.html#AAS_Timer1InterruptHandler">AAS_Timer1InterruptHandler</a>.</p>
<p>AAS requires for one or some AAS-specific interrupts are set up correctly. This will require some general interrupt system to be set up.</p>

<p>There are lots of ways in which to set up interrupts correctly. You can use a specialized crt0.s file, which is how AAS used to be configured. But these days, the easiest way to set them up is to use either <a href="https://github.com/devkitPro/libgba">libgba</a>, or <a href="https://github.com/devkitPro/libtonc">libtonc</a>. The examples use libtonc as it seems to be the most popular general GBA library and because it's got much better documentation (see the <a href="https://www.coranac.com/man/tonclib">reference</a> and the <a href="https://www.coranac.com/tonc/text/interrupts.htm">interrupt tutorial</a>).</p>
<p>You can use a specialized crt0.s file, which is how AAS used to be configured. But the easiest way to set them up is to use either <a href="https://github.com/devkitPro/libgba">libgba</a>, or <a href="https://github.com/devkitPro/libtonc">libtonc</a>.</p>

<p>With libtonc, you can easily set the required interrupts from within your C code, provided that you include libtonc in you project.</p>
<p>The AAS examples use libtonc as it seems to be the most popular general GBA library these days and because it's got much better documentation (see the <a href="https://www.coranac.com/man/tonclib">reference</a> and the <a href="https://www.coranac.com/tonc/text/interrupts.htm">interrupt tutorial</a>). With libtonc, you can easily set the required interrupts from within your C code, provided that you include libtonc in you project.</p>

<p>"AASExample" and "AASExample_c++" have been configured to use "Fast Interrupts". The only thing you need to do is to include the AAS and libtonc headers, initialize the interrupt handlers and assign AAS_Timer1InterruptHandler to the timer1 interrupt handler. To understand exactly what is going on, read the Tonc interrupt tutorial two paragraphs up.</p>
</blockquote>
<br><font size=+1 color="#333377">:: Interrupt Handling setup for the simple case</font>
<blockquote>

<p>The "AASExample" and "AASExample_c++" AAS interrupts have been configured for projects with no other CPU intensive interrupts. The only thing you need to do is to include the AAS and libtonc headers, initialize the interrupt handlers and assign <a href="api_general.html#AAS_Timer1InterruptHandler">AAS_Timer1InterruptHandler</a> to the timer1 interrupt handler.</p>

<pre>
#include "AAS.h"
Expand All @@ -131,11 +135,15 @@

</pre>

<p>To understand how the general interrupt mechanism works exactly, read the <a href="https://www.coranac.com/tonc/text/interrupts.htm">Tonc interrupt tutorial</a>.</p>

</blockquote>
<br><font size=+1 color="#333377">:: Using AAS With Other CPU-Intensive Interrupts</font>
<blockquote>

<p>A complication not mentioned in the explanation above is that AAS requires that its interrupt be processed very quickly to avoid audible gaps in the sound. This may cause problems if your code uses other CPU-intensive interrupts. In this situation, you should set up your interrupts a bit differently. First you should set up a timer 1 interrupt which automatically calls <a href="api_general.html#AAS_FastTimer1InterruptHandler">AAS_FastTimer1InterruptHandler</a>. This is a simple routine that is designed to return quickly so as not to interfere with your own code. However, unlike <a href="api_general.html#AAS_Timer1InterruptHandler">AAS_Timer1InterruptHandler</a>, <a href="api_general.html#AAS_FastTimer1InterruptHandler">AAS_FastTimer1InterruptHandler</a> does not mix the next batch of audio so a seperate call to <a href="api_general.html#AAS_DoWork">AAS_DoWork</a> is also required. This must be done at least 50 times per second, although it is safe to do it more often than that. Doing it at the beginning of each VBlank is ideal. This method is demonstrated in "AASExample2". The code used in this case is shown below:</p>
<p>A complication not mentioned in the explanation above is that AAS requires that its interrupt be processed very quickly to avoid audible gaps in the sound. This may cause problems if your code uses other CPU-intensive interrupts. In this situation, you should set up your interrupts a little bit differently.</p>

<p>First you should set up a timer 1 interrupt which automatically calls <a href="api_general.html#AAS_FastTimer1InterruptHandler">AAS_FastTimer1InterruptHandler</a>. This is a simple routine that is designed to return quickly so as not to interfere with your own code. However, unlike <a href="api_general.html#AAS_Timer1InterruptHandler">AAS_Timer1InterruptHandler</a>, <a href="api_general.html#AAS_FastTimer1InterruptHandler">AAS_FastTimer1InterruptHandler</a> does not mix the next batch of audio so a seperate call to <a href="api_general.html#AAS_DoWork">AAS_DoWork</a> is also required. This must be done at least 50 times per second, although it is safe to do it more often than that. Doing it at the beginning of each VBlank is ideal. This method is demonstrated in "AASExample2". The code used in this case is shown below:</p>

<pre>
#include "AAS.h"
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<br><font size=+1 color="#333377">:: First Steps</font>
<blockquote>

<p>Once the library and conv2aas are built, the user must include the AAS header files ("AAS.h" and, optionally, "AAS_Mixer.h") and link "libAAS.a" with their project. Next, the interrupt handling routines must be set up so that a Timer 1 interrupt results in a call to <a href="api_general.html#AAS_Timer1InterruptHandler">AAS_Timer1InterruptHandler</a> (or <a href="api_general.html#AAS_FastTimer1InterruptHandler">AAS_FastTimer1InterruptHandler</a> with a seperate call to <a href="api_general.html#AAS_DoWork">AAS_DoWork</a> later if "AAS_MultipleInterrupts" are being used). The <a href="example.html">example code section</a> in this documentation, and the code included with AAS demonstrates how to do this, and users are encouraged to reuse the code shown in their own projects.</p>
<p>Once the library and conv2aas are built, the user must include the AAS header files ("AAS.h" and, optionally, "AAS_Mixer.h") and link "libAAS.a" with their project. Next, the interrupt handling routines must be set up so that a Timer 1 interrupt results in a call to <a href="api_general.html#AAS_Timer1InterruptHandler">AAS_Timer1InterruptHandler</a> (or <a href="api_general.html#AAS_FastTimer1InterruptHandler">AAS_FastTimer1InterruptHandler</a> with a seperate call to <a href="api_general.html#AAS_DoWork">AAS_DoWork</a>). The <a href="example.html">example code section</a> in this documentation, and the code included with AAS demonstrates how to do this. Users are encouraged to reuse the code shown in their own projects.</p>

<p>It is also recommended that the project's makefile be modified so that <a href="conv2aas.html">Conv2AAS</a> is automatically called when the project is compiled, and its output is assembled and linked with the main code. The makefile included with the <a href="example.html">example code</a> shows how to do this.</p>

Expand Down

0 comments on commit 831636c

Please sign in to comment.