mirror of
https://github.com/mrkite/soundsmith.git
synced 2024-12-22 01:29:19 +00:00
1607 lines
105 KiB
HTML
1607 lines
105 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
|
|
<meta name="generator" content="AsciiDoc 8.6.9" />
|
|
<title>DOC info and Player Pseudocode</title>
|
|
<style type="text/css">
|
|
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
|
|
|
|
/* Default font. */
|
|
body {
|
|
font-family: Georgia,serif;
|
|
}
|
|
|
|
/* Title font. */
|
|
h1, h2, h3, h4, h5, h6,
|
|
div.title, caption.title,
|
|
thead, p.table.header,
|
|
#toctitle,
|
|
#author, #revnumber, #revdate, #revremark,
|
|
#footer {
|
|
font-family: Arial,Helvetica,sans-serif;
|
|
}
|
|
|
|
body {
|
|
margin: 1em 5% 1em 5%;
|
|
}
|
|
|
|
a {
|
|
color: blue;
|
|
text-decoration: underline;
|
|
}
|
|
a:visited {
|
|
color: fuchsia;
|
|
}
|
|
|
|
em {
|
|
font-style: italic;
|
|
color: navy;
|
|
}
|
|
|
|
strong {
|
|
font-weight: bold;
|
|
color: #083194;
|
|
}
|
|
|
|
h1, h2, h3, h4, h5, h6 {
|
|
color: #527bbd;
|
|
margin-top: 1.2em;
|
|
margin-bottom: 0.5em;
|
|
line-height: 1.3;
|
|
}
|
|
|
|
h1, h2, h3 {
|
|
border-bottom: 2px solid silver;
|
|
}
|
|
h2 {
|
|
padding-top: 0.5em;
|
|
}
|
|
h3 {
|
|
float: left;
|
|
}
|
|
h3 + * {
|
|
clear: left;
|
|
}
|
|
h5 {
|
|
font-size: 1.0em;
|
|
}
|
|
|
|
div.sectionbody {
|
|
margin-left: 0;
|
|
}
|
|
|
|
hr {
|
|
border: 1px solid silver;
|
|
}
|
|
|
|
p {
|
|
margin-top: 0.5em;
|
|
margin-bottom: 0.5em;
|
|
}
|
|
|
|
ul, ol, li > p {
|
|
margin-top: 0;
|
|
}
|
|
ul > li { color: #aaa; }
|
|
ul > li > * { color: black; }
|
|
|
|
.monospaced, code, pre {
|
|
font-family: "Courier New", Courier, monospace;
|
|
font-size: inherit;
|
|
color: navy;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
pre {
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
#author {
|
|
color: #527bbd;
|
|
font-weight: bold;
|
|
font-size: 1.1em;
|
|
}
|
|
#email {
|
|
}
|
|
#revnumber, #revdate, #revremark {
|
|
}
|
|
|
|
#footer {
|
|
font-size: small;
|
|
border-top: 2px solid silver;
|
|
padding-top: 0.5em;
|
|
margin-top: 4.0em;
|
|
}
|
|
#footer-text {
|
|
float: left;
|
|
padding-bottom: 0.5em;
|
|
}
|
|
#footer-badges {
|
|
float: right;
|
|
padding-bottom: 0.5em;
|
|
}
|
|
|
|
#preamble {
|
|
margin-top: 1.5em;
|
|
margin-bottom: 1.5em;
|
|
}
|
|
div.imageblock, div.exampleblock, div.verseblock,
|
|
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
|
|
div.admonitionblock {
|
|
margin-top: 1.0em;
|
|
margin-bottom: 1.5em;
|
|
}
|
|
div.admonitionblock {
|
|
margin-top: 2.0em;
|
|
margin-bottom: 2.0em;
|
|
margin-right: 10%;
|
|
color: #606060;
|
|
}
|
|
|
|
div.content { /* Block element content. */
|
|
padding: 0;
|
|
}
|
|
|
|
/* Block element titles. */
|
|
div.title, caption.title {
|
|
color: #527bbd;
|
|
font-weight: bold;
|
|
text-align: left;
|
|
margin-top: 1.0em;
|
|
margin-bottom: 0.5em;
|
|
}
|
|
div.title + * {
|
|
margin-top: 0;
|
|
}
|
|
|
|
td div.title:first-child {
|
|
margin-top: 0.0em;
|
|
}
|
|
div.content div.title:first-child {
|
|
margin-top: 0.0em;
|
|
}
|
|
div.content + div.title {
|
|
margin-top: 0.0em;
|
|
}
|
|
|
|
div.sidebarblock > div.content {
|
|
background: #ffffee;
|
|
border: 1px solid #dddddd;
|
|
border-left: 4px solid #f0f0f0;
|
|
padding: 0.5em;
|
|
}
|
|
|
|
div.listingblock > div.content {
|
|
border: 1px solid #dddddd;
|
|
border-left: 5px solid #f0f0f0;
|
|
background: #f8f8f8;
|
|
padding: 0.5em;
|
|
}
|
|
|
|
div.quoteblock, div.verseblock {
|
|
padding-left: 1.0em;
|
|
margin-left: 1.0em;
|
|
margin-right: 10%;
|
|
border-left: 5px solid #f0f0f0;
|
|
color: #888;
|
|
}
|
|
|
|
div.quoteblock > div.attribution {
|
|
padding-top: 0.5em;
|
|
text-align: right;
|
|
}
|
|
|
|
div.verseblock > pre.content {
|
|
font-family: inherit;
|
|
font-size: inherit;
|
|
}
|
|
div.verseblock > div.attribution {
|
|
padding-top: 0.75em;
|
|
text-align: left;
|
|
}
|
|
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
|
|
div.verseblock + div.attribution {
|
|
text-align: left;
|
|
}
|
|
|
|
div.admonitionblock .icon {
|
|
vertical-align: top;
|
|
font-size: 1.1em;
|
|
font-weight: bold;
|
|
text-decoration: underline;
|
|
color: #527bbd;
|
|
padding-right: 0.5em;
|
|
}
|
|
div.admonitionblock td.content {
|
|
padding-left: 0.5em;
|
|
border-left: 3px solid #dddddd;
|
|
}
|
|
|
|
div.exampleblock > div.content {
|
|
border-left: 3px solid #dddddd;
|
|
padding-left: 0.5em;
|
|
}
|
|
|
|
div.imageblock div.content { padding-left: 0; }
|
|
span.image img { border-style: none; vertical-align: text-bottom; }
|
|
a.image:visited { color: white; }
|
|
|
|
dl {
|
|
margin-top: 0.8em;
|
|
margin-bottom: 0.8em;
|
|
}
|
|
dt {
|
|
margin-top: 0.5em;
|
|
margin-bottom: 0;
|
|
font-style: normal;
|
|
color: navy;
|
|
}
|
|
dd > *:first-child {
|
|
margin-top: 0.1em;
|
|
}
|
|
|
|
ul, ol {
|
|
list-style-position: outside;
|
|
}
|
|
ol.arabic {
|
|
list-style-type: decimal;
|
|
}
|
|
ol.loweralpha {
|
|
list-style-type: lower-alpha;
|
|
}
|
|
ol.upperalpha {
|
|
list-style-type: upper-alpha;
|
|
}
|
|
ol.lowerroman {
|
|
list-style-type: lower-roman;
|
|
}
|
|
ol.upperroman {
|
|
list-style-type: upper-roman;
|
|
}
|
|
|
|
div.compact ul, div.compact ol,
|
|
div.compact p, div.compact p,
|
|
div.compact div, div.compact div {
|
|
margin-top: 0.1em;
|
|
margin-bottom: 0.1em;
|
|
}
|
|
|
|
tfoot {
|
|
font-weight: bold;
|
|
}
|
|
td > div.verse {
|
|
white-space: pre;
|
|
}
|
|
|
|
div.hdlist {
|
|
margin-top: 0.8em;
|
|
margin-bottom: 0.8em;
|
|
}
|
|
div.hdlist tr {
|
|
padding-bottom: 15px;
|
|
}
|
|
dt.hdlist1.strong, td.hdlist1.strong {
|
|
font-weight: bold;
|
|
}
|
|
td.hdlist1 {
|
|
vertical-align: top;
|
|
font-style: normal;
|
|
padding-right: 0.8em;
|
|
color: navy;
|
|
}
|
|
td.hdlist2 {
|
|
vertical-align: top;
|
|
}
|
|
div.hdlist.compact tr {
|
|
margin: 0;
|
|
padding-bottom: 0;
|
|
}
|
|
|
|
.comment {
|
|
background: yellow;
|
|
}
|
|
|
|
.footnote, .footnoteref {
|
|
font-size: 0.8em;
|
|
}
|
|
|
|
span.footnote, span.footnoteref {
|
|
vertical-align: super;
|
|
}
|
|
|
|
#footnotes {
|
|
margin: 20px 0 20px 0;
|
|
padding: 7px 0 0 0;
|
|
}
|
|
|
|
#footnotes div.footnote {
|
|
margin: 0 0 5px 0;
|
|
}
|
|
|
|
#footnotes hr {
|
|
border: none;
|
|
border-top: 1px solid silver;
|
|
height: 1px;
|
|
text-align: left;
|
|
margin-left: 0;
|
|
width: 20%;
|
|
min-width: 100px;
|
|
}
|
|
|
|
div.colist td {
|
|
padding-right: 0.5em;
|
|
padding-bottom: 0.3em;
|
|
vertical-align: top;
|
|
}
|
|
div.colist td img {
|
|
margin-top: 0.3em;
|
|
}
|
|
|
|
@media print {
|
|
#footer-badges { display: none; }
|
|
}
|
|
|
|
#toc {
|
|
margin-bottom: 2.5em;
|
|
}
|
|
|
|
#toctitle {
|
|
color: #527bbd;
|
|
font-size: 1.1em;
|
|
font-weight: bold;
|
|
margin-top: 1.0em;
|
|
margin-bottom: 0.1em;
|
|
}
|
|
|
|
div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
|
|
margin-top: 0;
|
|
margin-bottom: 0;
|
|
}
|
|
div.toclevel2 {
|
|
margin-left: 2em;
|
|
font-size: 0.9em;
|
|
}
|
|
div.toclevel3 {
|
|
margin-left: 4em;
|
|
font-size: 0.9em;
|
|
}
|
|
div.toclevel4 {
|
|
margin-left: 6em;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
span.aqua { color: aqua; }
|
|
span.black { color: black; }
|
|
span.blue { color: blue; }
|
|
span.fuchsia { color: fuchsia; }
|
|
span.gray { color: gray; }
|
|
span.green { color: green; }
|
|
span.lime { color: lime; }
|
|
span.maroon { color: maroon; }
|
|
span.navy { color: navy; }
|
|
span.olive { color: olive; }
|
|
span.purple { color: purple; }
|
|
span.red { color: red; }
|
|
span.silver { color: silver; }
|
|
span.teal { color: teal; }
|
|
span.white { color: white; }
|
|
span.yellow { color: yellow; }
|
|
|
|
span.aqua-background { background: aqua; }
|
|
span.black-background { background: black; }
|
|
span.blue-background { background: blue; }
|
|
span.fuchsia-background { background: fuchsia; }
|
|
span.gray-background { background: gray; }
|
|
span.green-background { background: green; }
|
|
span.lime-background { background: lime; }
|
|
span.maroon-background { background: maroon; }
|
|
span.navy-background { background: navy; }
|
|
span.olive-background { background: olive; }
|
|
span.purple-background { background: purple; }
|
|
span.red-background { background: red; }
|
|
span.silver-background { background: silver; }
|
|
span.teal-background { background: teal; }
|
|
span.white-background { background: white; }
|
|
span.yellow-background { background: yellow; }
|
|
|
|
span.big { font-size: 2em; }
|
|
span.small { font-size: 0.6em; }
|
|
|
|
span.underline { text-decoration: underline; }
|
|
span.overline { text-decoration: overline; }
|
|
span.line-through { text-decoration: line-through; }
|
|
|
|
div.unbreakable { page-break-inside: avoid; }
|
|
|
|
|
|
/*
|
|
* xhtml11 specific
|
|
*
|
|
* */
|
|
|
|
div.tableblock {
|
|
margin-top: 1.0em;
|
|
margin-bottom: 1.5em;
|
|
}
|
|
div.tableblock > table {
|
|
border: 3px solid #527bbd;
|
|
}
|
|
thead, p.table.header {
|
|
font-weight: bold;
|
|
color: #527bbd;
|
|
}
|
|
p.table {
|
|
margin-top: 0;
|
|
}
|
|
/* Because the table frame attribute is overriden by CSS in most browsers. */
|
|
div.tableblock > table[frame="void"] {
|
|
border-style: none;
|
|
}
|
|
div.tableblock > table[frame="hsides"] {
|
|
border-left-style: none;
|
|
border-right-style: none;
|
|
}
|
|
div.tableblock > table[frame="vsides"] {
|
|
border-top-style: none;
|
|
border-bottom-style: none;
|
|
}
|
|
|
|
|
|
/*
|
|
* html5 specific
|
|
*
|
|
* */
|
|
|
|
table.tableblock {
|
|
margin-top: 1.0em;
|
|
margin-bottom: 1.5em;
|
|
}
|
|
thead, p.tableblock.header {
|
|
font-weight: bold;
|
|
color: #527bbd;
|
|
}
|
|
p.tableblock {
|
|
margin-top: 0;
|
|
}
|
|
table.tableblock {
|
|
border-width: 3px;
|
|
border-spacing: 0px;
|
|
border-style: solid;
|
|
border-color: #527bbd;
|
|
border-collapse: collapse;
|
|
}
|
|
th.tableblock, td.tableblock {
|
|
border-width: 1px;
|
|
padding: 4px;
|
|
border-style: solid;
|
|
border-color: #527bbd;
|
|
}
|
|
|
|
table.tableblock.frame-topbot {
|
|
border-left-style: hidden;
|
|
border-right-style: hidden;
|
|
}
|
|
table.tableblock.frame-sides {
|
|
border-top-style: hidden;
|
|
border-bottom-style: hidden;
|
|
}
|
|
table.tableblock.frame-none {
|
|
border-style: hidden;
|
|
}
|
|
|
|
th.tableblock.halign-left, td.tableblock.halign-left {
|
|
text-align: left;
|
|
}
|
|
th.tableblock.halign-center, td.tableblock.halign-center {
|
|
text-align: center;
|
|
}
|
|
th.tableblock.halign-right, td.tableblock.halign-right {
|
|
text-align: right;
|
|
}
|
|
|
|
th.tableblock.valign-top, td.tableblock.valign-top {
|
|
vertical-align: top;
|
|
}
|
|
th.tableblock.valign-middle, td.tableblock.valign-middle {
|
|
vertical-align: middle;
|
|
}
|
|
th.tableblock.valign-bottom, td.tableblock.valign-bottom {
|
|
vertical-align: bottom;
|
|
}
|
|
|
|
|
|
/*
|
|
* manpage specific
|
|
*
|
|
* */
|
|
|
|
body.manpage h1 {
|
|
padding-top: 0.5em;
|
|
padding-bottom: 0.5em;
|
|
border-top: 2px solid silver;
|
|
border-bottom: 2px solid silver;
|
|
}
|
|
body.manpage h2 {
|
|
border-style: none;
|
|
}
|
|
body.manpage div.sectionbody {
|
|
margin-left: 3em;
|
|
}
|
|
|
|
@media print {
|
|
body.manpage div#toc { display: none; }
|
|
}
|
|
|
|
|
|
</style>
|
|
<script type="text/javascript">
|
|
/*<![CDATA[*/
|
|
var asciidoc = { // Namespace.
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
// Table Of Contents generator
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
/* Author: Mihai Bazon, September 2002
|
|
* http://students.infoiasi.ro/~mishoo
|
|
*
|
|
* Table Of Content generator
|
|
* Version: 0.4
|
|
*
|
|
* Feel free to use this script under the terms of the GNU General Public
|
|
* License, as long as you do not remove or alter this notice.
|
|
*/
|
|
|
|
/* modified by Troy D. Hanson, September 2006. License: GPL */
|
|
/* modified by Stuart Rackham, 2006, 2009. License: GPL */
|
|
|
|
// toclevels = 1..4.
|
|
toc: function (toclevels) {
|
|
|
|
function getText(el) {
|
|
var text = "";
|
|
for (var i = el.firstChild; i != null; i = i.nextSibling) {
|
|
if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
|
|
text += i.data;
|
|
else if (i.firstChild != null)
|
|
text += getText(i);
|
|
}
|
|
return text;
|
|
}
|
|
|
|
function TocEntry(el, text, toclevel) {
|
|
this.element = el;
|
|
this.text = text;
|
|
this.toclevel = toclevel;
|
|
}
|
|
|
|
function tocEntries(el, toclevels) {
|
|
var result = new Array;
|
|
var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
|
|
// Function that scans the DOM tree for header elements (the DOM2
|
|
// nodeIterator API would be a better technique but not supported by all
|
|
// browsers).
|
|
var iterate = function (el) {
|
|
for (var i = el.firstChild; i != null; i = i.nextSibling) {
|
|
if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
|
|
var mo = re.exec(i.tagName);
|
|
if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
|
|
result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
|
|
}
|
|
iterate(i);
|
|
}
|
|
}
|
|
}
|
|
iterate(el);
|
|
return result;
|
|
}
|
|
|
|
var toc = document.getElementById("toc");
|
|
if (!toc) {
|
|
return;
|
|
}
|
|
|
|
// Delete existing TOC entries in case we're reloading the TOC.
|
|
var tocEntriesToRemove = [];
|
|
var i;
|
|
for (i = 0; i < toc.childNodes.length; i++) {
|
|
var entry = toc.childNodes[i];
|
|
if (entry.nodeName.toLowerCase() == 'div'
|
|
&& entry.getAttribute("class")
|
|
&& entry.getAttribute("class").match(/^toclevel/))
|
|
tocEntriesToRemove.push(entry);
|
|
}
|
|
for (i = 0; i < tocEntriesToRemove.length; i++) {
|
|
toc.removeChild(tocEntriesToRemove[i]);
|
|
}
|
|
|
|
// Rebuild TOC entries.
|
|
var entries = tocEntries(document.getElementById("content"), toclevels);
|
|
for (var i = 0; i < entries.length; ++i) {
|
|
var entry = entries[i];
|
|
if (entry.element.id == "")
|
|
entry.element.id = "_toc_" + i;
|
|
var a = document.createElement("a");
|
|
a.href = "#" + entry.element.id;
|
|
a.appendChild(document.createTextNode(entry.text));
|
|
var div = document.createElement("div");
|
|
div.appendChild(a);
|
|
div.className = "toclevel" + entry.toclevel;
|
|
toc.appendChild(div);
|
|
}
|
|
if (entries.length == 0)
|
|
toc.parentNode.removeChild(toc);
|
|
},
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
// Footnotes generator
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
/* Based on footnote generation code from:
|
|
* http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
|
|
*/
|
|
|
|
footnotes: function () {
|
|
// Delete existing footnote entries in case we're reloading the footnodes.
|
|
var i;
|
|
var noteholder = document.getElementById("footnotes");
|
|
if (!noteholder) {
|
|
return;
|
|
}
|
|
var entriesToRemove = [];
|
|
for (i = 0; i < noteholder.childNodes.length; i++) {
|
|
var entry = noteholder.childNodes[i];
|
|
if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
|
|
entriesToRemove.push(entry);
|
|
}
|
|
for (i = 0; i < entriesToRemove.length; i++) {
|
|
noteholder.removeChild(entriesToRemove[i]);
|
|
}
|
|
|
|
// Rebuild footnote entries.
|
|
var cont = document.getElementById("content");
|
|
var spans = cont.getElementsByTagName("span");
|
|
var refs = {};
|
|
var n = 0;
|
|
for (i=0; i<spans.length; i++) {
|
|
if (spans[i].className == "footnote") {
|
|
n++;
|
|
var note = spans[i].getAttribute("data-note");
|
|
if (!note) {
|
|
// Use [\s\S] in place of . so multi-line matches work.
|
|
// Because JavaScript has no s (dotall) regex flag.
|
|
note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
|
|
spans[i].innerHTML =
|
|
"[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
|
|
"' title='View footnote' class='footnote'>" + n + "</a>]";
|
|
spans[i].setAttribute("data-note", note);
|
|
}
|
|
noteholder.innerHTML +=
|
|
"<div class='footnote' id='_footnote_" + n + "'>" +
|
|
"<a href='#_footnoteref_" + n + "' title='Return to text'>" +
|
|
n + "</a>. " + note + "</div>";
|
|
var id =spans[i].getAttribute("id");
|
|
if (id != null) refs["#"+id] = n;
|
|
}
|
|
}
|
|
if (n == 0)
|
|
noteholder.parentNode.removeChild(noteholder);
|
|
else {
|
|
// Process footnoterefs.
|
|
for (i=0; i<spans.length; i++) {
|
|
if (spans[i].className == "footnoteref") {
|
|
var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
|
|
href = href.match(/#.*/)[0]; // Because IE return full URL.
|
|
n = refs[href];
|
|
spans[i].innerHTML =
|
|
"[<a href='#_footnote_" + n +
|
|
"' title='View footnote' class='footnote'>" + n + "</a>]";
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
install: function(toclevels) {
|
|
var timerId;
|
|
|
|
function reinstall() {
|
|
asciidoc.footnotes();
|
|
if (toclevels) {
|
|
asciidoc.toc(toclevels);
|
|
}
|
|
}
|
|
|
|
function reinstallAndRemoveTimer() {
|
|
clearInterval(timerId);
|
|
reinstall();
|
|
}
|
|
|
|
timerId = setInterval(reinstall, 500);
|
|
if (document.addEventListener)
|
|
document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
|
|
else
|
|
window.onload = reinstallAndRemoveTimer;
|
|
}
|
|
|
|
}
|
|
asciidoc.install();
|
|
/*]]>*/
|
|
</script>
|
|
</head>
|
|
<body class="article">
|
|
<div id="header">
|
|
<h1>DOC info and Player Pseudocode</h1>
|
|
</div>
|
|
<div id="content">
|
|
<div class="sect1">
|
|
<h2 id="_doc">DOC</h2>
|
|
<div class="sectionbody">
|
|
<div class="paragraph"><p>The DOC in the IIgs is a multi-channel digital oscillator. There are
|
|
32 oscillators, operating in pairs. There is 64k of sound RAM, which holds
|
|
the wavetable. The oscillators address into soundram and determine what
|
|
sound data to send to the speaker.. the oscillators operate at a set
|
|
frequency.</p></div>
|
|
<div class="paragraph"><p>There are four registers for controlling the DOC.</p></div>
|
|
<div class="dlist"><dl>
|
|
<dt class="hdlist1">
|
|
<code>$c03c</code>
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Sound Control. This uses various bits to control the other register modes.
|
|
</p>
|
|
<div class="dlist"><dl>
|
|
<dt class="hdlist1">
|
|
Bit 7
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
DOC busy flag. 1 - DOC is busy
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
Bit 6
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
DOC or SoundRAM access. 0 - DOC
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
Bit 5
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Address auto-increment. 1 - enabled
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
Bit 4
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
reserved
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
Bits 3—0
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Master volume, 0 - low, 15 - high
|
|
</p>
|
|
</dd>
|
|
</dl></div>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
<code>$c03d</code>
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Sound Data. This is used to read and write to and from the DOC and
|
|
SoundRAM. If auto-increment is enabled, reading or writing to this register
|
|
will auto-increment the address register. Note, when reading, the register
|
|
lags by one cycle. You’ll need to throw away the first read after modifying
|
|
the address registers.
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
<code>$c03e</code>
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Address Low. This is the address into either the DOC or the SoundRAM.
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
<code>$c03f</code>
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Address High. This is the address into SoundRAM. When accessing the DOC,
|
|
only the low byte of the address register is used.
|
|
</p>
|
|
</dd>
|
|
</dl></div>
|
|
<div class="sect2">
|
|
<h3 id="_doc_addresses">DOC Addresses</h3>
|
|
<div class="paragraph"><p>When in DOC mode, you can modify various settings by setting the low address
|
|
register to various addresses and writing and reading from the data register.
|
|
The following are the various addresses used.</p></div>
|
|
<div class="sect3">
|
|
<h4 id="_oscillator_interrupt_e0">Oscillator Interrupt $E0</h4>
|
|
<div class="paragraph"><p>Contains which oscillator triggered an interrupt.</p></div>
|
|
<div class="dlist"><dl>
|
|
<dt class="hdlist1">
|
|
Bit 7
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Interrupt occurred, 1 - yes
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
Bits 5—1
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Oscillator number that triggered the interrupt
|
|
</p>
|
|
</dd>
|
|
</dl></div>
|
|
</div>
|
|
<div class="sect3">
|
|
<h4 id="_oscillator_enable_e1">Oscillator Enable $E1</h4>
|
|
<div class="paragraph"><p>The number of oscillators running. Multiply the number of desired oscillators
|
|
by two, and set. Any number from 2 to 64 is valid. 2 is the default
|
|
(1 oscillator).</p></div>
|
|
</div>
|
|
<div class="sect3">
|
|
<h4 id="_a_d_converter_e2">A/D Converter $E2</h4>
|
|
<div class="paragraph"><p>This is the current value of the analog input.</p></div>
|
|
</div>
|
|
<div class="sect3">
|
|
<h4 id="_wavetable_size_c0_df">Wavetable Size $C0--$DF</h4>
|
|
<div class="paragraph"><p>Control the size of the wavetable for each oscillator. $C0 controls
|
|
oscillator 0, $DF controls oscillator 31.</p></div>
|
|
<div class="dlist"><dl>
|
|
<dt class="hdlist1">
|
|
Bits 5—3
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Table size.
|
|
</p>
|
|
<div class="dlist"><dl>
|
|
<dt class="hdlist1">
|
|
0
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
256
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
1
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
512
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
2
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
1024
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
3
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
2048
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
4
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
4096
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
5
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
8192
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
6
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
16384
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
7
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
32768
|
|
</p>
|
|
</dd>
|
|
</dl></div>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
Bits 2—0
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Address resolution. See below for the wavetable address calculation.
|
|
</p>
|
|
</dd>
|
|
</dl></div>
|
|
</div>
|
|
<div class="sect3">
|
|
<h4 id="_oscillator_control_a0_bf">Oscillator Control $A0--$BF</h4>
|
|
<div class="paragraph"><p>Control the oscillator behavior. $A0 is for oscillator 0, $BF is for
|
|
oscillator 31.</p></div>
|
|
<div class="dlist"><dl>
|
|
<dt class="hdlist1">
|
|
Bits 7—4
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Which hardware channel to use.
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
Bit 3
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Interrupt enable, 1 - interrupts enabled
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
Bits 2—1
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Oscillator mode
|
|
</p>
|
|
<div class="dlist"><dl>
|
|
<dt class="hdlist1">
|
|
0
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Free Run. Starts at beginning of wavetable and repeats same
|
|
wavetable. Halts when halt bit is set, or 0 occurs in wavetable.
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
1
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
One Shot. Start at beginning of wavetable, step through once,
|
|
stop at end of table.
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
2
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Sync. When even-numbered oscillator starts, the oscillator above
|
|
it will synchronize and begin simulatenously.
|
|
</p>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
3
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Swap. When even-numbered oscillator reaches end of wavetable,
|
|
it resetsthe accumulator to 0, sets the halt bit, and clears the
|
|
halt bit of the oscillator above it.
|
|
</p>
|
|
</dd>
|
|
</dl></div>
|
|
</dd>
|
|
<dt class="hdlist1">
|
|
Bit 0
|
|
</dt>
|
|
<dd>
|
|
<p>
|
|
Halt bit. 1 - Oscillator is halted.
|
|
</p>
|
|
</dd>
|
|
</dl></div>
|
|
</div>
|
|
<div class="sect3">
|
|
<h4 id="_wavetable_pointers_80_9f">Wavetable Pointers $80--$9F</h4>
|
|
<div class="paragraph"><p>The start page of each oscillator’s wavetable. Each page is 256 bytes long.
|
|
$80 is the start page of oscillator 0, $9F is the start page of oscillator 31.</p></div>
|
|
</div>
|
|
<div class="sect3">
|
|
<h4 id="_oscillator_data_60_7f">Oscillator Data $60--$7F</h4>
|
|
<div class="paragraph"><p>The last byte read fro the wavetable for each oscillator. $60 is oscillator
|
|
0, $7F is oscillator 31.</p></div>
|
|
</div>
|
|
<div class="sect3">
|
|
<h4 id="_volume_40_5f">Volume $40--$5F</h4>
|
|
<div class="paragraph"><p>The oscillator’s volume. The current wavetable data byte is multiplied
|
|
by the 8-bit volume to obtain the final output level. $40 is the
|
|
volume for oscillator 0, $5F is for oscillator 31.</p></div>
|
|
</div>
|
|
<div class="sect3">
|
|
<h4 id="_frequency_high_and_low_00_3f">Frequency High and Low $00--$3F</h4>
|
|
<div class="paragraph"><p>This is a 16-bit value for each oscillator. $00 is the low byte of the
|
|
frequency for oscillator 0, $20 is the high byte for oscillator 0.</p></div>
|
|
<div class="paragraph"><p>This determines the speed the wavetable is read from memory.</p></div>
|
|
<div class="paragraph"><p>Output Frequency = F * SR / (2 ^ (17 + RES))</p></div>
|
|
<div class="paragraph"><p>SR = 894.886KHz / (OSC + 2).</p></div>
|
|
<div class="paragraph"><p>RES = Wavetable resolution</p></div>
|
|
<div class="paragraph"><p>F = 16-bit frequency</p></div>
|
|
<div class="paragraph"><p>OSC = number of enabled oscillators</p></div>
|
|
</div>
|
|
</div>
|
|
<div class="sect2">
|
|
<h3 id="_wavetable_address_calculation">Wavetable Address Calculation</h3>
|
|
<div class="paragraph"><p>Each oscillator has a 24-bit accumulator. Each time the oscillator
|
|
updates, the 16-bit value from the oscillator’s Frequency is added to
|
|
the accumulator. The result is then passed to a multiplexer to determine
|
|
the final 16-bit SoundRAM address. The Table Size, Wavetable Pointer, and
|
|
Resolution all determine how the multiplexer works. Use the following
|
|
table to determine how to calcualte the final address. The Pointer
|
|
register determines the high bits of the address, the accumulatr determines
|
|
the low bits.</p></div>
|
|
<div class="tableblock">
|
|
<table rules="all"
|
|
width="50%"
|
|
frame="border"
|
|
cellspacing="0" cellpadding="4">
|
|
<col width="25%" />
|
|
<col width="25%" />
|
|
<col width="25%" />
|
|
<col width="25%" />
|
|
<thead>
|
|
<tr>
|
|
<th align="left" valign="top">Table Size</th>
|
|
<th align="left" valign="top">Resolution</th>
|
|
<th align="left" valign="top">Pointer Reg</th>
|
|
<th align="left" valign="top">Accumulator</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">256</p></td>
|
|
<td align="left" valign="top"><p class="table">7</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P0</p></td>
|
|
<td align="left" valign="top"><p class="table">A23—A16</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">256</p></td>
|
|
<td align="left" valign="top"><p class="table">6</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P0</p></td>
|
|
<td align="left" valign="top"><p class="table">A22—A15</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">256</p></td>
|
|
<td align="left" valign="top"><p class="table">5</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P0</p></td>
|
|
<td align="left" valign="top"><p class="table">A21—A14</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">256</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">256</p></td>
|
|
<td align="left" valign="top"><p class="table">0</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P0</p></td>
|
|
<td align="left" valign="top"><p class="table">A16—A9</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">512</p></td>
|
|
<td align="left" valign="top"><p class="table">7</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P1</p></td>
|
|
<td align="left" valign="top"><p class="table">A23—A15</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">512</p></td>
|
|
<td align="left" valign="top"><p class="table">6</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P1</p></td>
|
|
<td align="left" valign="top"><p class="table">A22—A14</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">512</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">512</p></td>
|
|
<td align="left" valign="top"><p class="table">0</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P1</p></td>
|
|
<td align="left" valign="top"><p class="table">A16—A8</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">1024</p></td>
|
|
<td align="left" valign="top"><p class="table">7</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P2</p></td>
|
|
<td align="left" valign="top"><p class="table">A23—A14</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">1024</p></td>
|
|
<td align="left" valign="top"><p class="table">6</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P2</p></td>
|
|
<td align="left" valign="top"><p class="table">A22—A13</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">1024</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">1024</p></td>
|
|
<td align="left" valign="top"><p class="table">0</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P2</p></td>
|
|
<td align="left" valign="top"><p class="table">A16—A7</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">2048</p></td>
|
|
<td align="left" valign="top"><p class="table">7</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P3</p></td>
|
|
<td align="left" valign="top"><p class="table">A23—A13</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">2048</p></td>
|
|
<td align="left" valign="top"><p class="table">6</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P3</p></td>
|
|
<td align="left" valign="top"><p class="table">A22—A12</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">2048</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">2048</p></td>
|
|
<td align="left" valign="top"><p class="table">0</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P3</p></td>
|
|
<td align="left" valign="top"><p class="table">A16—A6</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">4096</p></td>
|
|
<td align="left" valign="top"><p class="table">7</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P4</p></td>
|
|
<td align="left" valign="top"><p class="table">A23—A12</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">4096</p></td>
|
|
<td align="left" valign="top"><p class="table">6</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P4</p></td>
|
|
<td align="left" valign="top"><p class="table">A22—A11</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">4096</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">4096</p></td>
|
|
<td align="left" valign="top"><p class="table">0</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P4</p></td>
|
|
<td align="left" valign="top"><p class="table">A16—A5</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">8192</p></td>
|
|
<td align="left" valign="top"><p class="table">7</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P5</p></td>
|
|
<td align="left" valign="top"><p class="table">A23—A11</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">8192</p></td>
|
|
<td align="left" valign="top"><p class="table">6</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P5</p></td>
|
|
<td align="left" valign="top"><p class="table">A22—A10</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">8192</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">8192</p></td>
|
|
<td align="left" valign="top"><p class="table">0</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P5</p></td>
|
|
<td align="left" valign="top"><p class="table">A16—A4</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">16384</p></td>
|
|
<td align="left" valign="top"><p class="table">7</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P6</p></td>
|
|
<td align="left" valign="top"><p class="table">A23—A10</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">16384</p></td>
|
|
<td align="left" valign="top"><p class="table">6</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P6</p></td>
|
|
<td align="left" valign="top"><p class="table">A22—A9</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">16384</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">16384</p></td>
|
|
<td align="left" valign="top"><p class="table">0</p></td>
|
|
<td align="left" valign="top"><p class="table">P7—P6</p></td>
|
|
<td align="left" valign="top"><p class="table">A16—A3</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">32768</p></td>
|
|
<td align="left" valign="top"><p class="table">7</p></td>
|
|
<td align="left" valign="top"><p class="table">P7</p></td>
|
|
<td align="left" valign="top"><p class="table">A23—A9</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">32768</p></td>
|
|
<td align="left" valign="top"><p class="table">6</p></td>
|
|
<td align="left" valign="top"><p class="table">P7</p></td>
|
|
<td align="left" valign="top"><p class="table">A22—A8</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">32768</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
<td align="left" valign="top"><p class="table">…</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="left" valign="top"><p class="table">32768</p></td>
|
|
<td align="left" valign="top"><p class="table">0</p></td>
|
|
<td align="left" valign="top"><p class="table">P7</p></td>
|
|
<td align="left" valign="top"><p class="table">A16—A2</p></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="paragraph"><p>The 32 oscillators are serviced in sequence. With all oscillators
|
|
enabled, the DOC takes 38 microseconds to service all 32. 1.2 microseconds
|
|
per oscillator.</p></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="sect1">
|
|
<h2 id="_player">Player</h2>
|
|
<div class="sectionbody">
|
|
<div class="paragraph"><p>This is pseudocode for the soundsmith music player. The pseudocode style
|
|
is basically C-style, with 68k-style word notation.</p></div>
|
|
<div class="paragraph"><p>For example: <code>music[8].w</code> means read a little-endian word from the music
|
|
array, starting at byte offset 8.</p></div>
|
|
<div class="listingblock">
|
|
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
|
|
by Lorenzo Bettini
|
|
http://www.lorenzobettini.it
|
|
http://www.gnu.org/software/src-highlite -->
|
|
<pre><tt><span style="font-style: italic"><span style="color: #9A1900">// parse the song headers and prep audio</span></span>
|
|
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">initSong</span></span><span style="color: #990000">()</span> <span style="color: #FF0000">{</span>
|
|
SNDCTL <span style="color: #990000">=</span> CURVOL <span style="color: #990000">&</span> <span style="color: #993399">0xf</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// set vol, enable DAC, disable autoinc</span></span>
|
|
<span style="font-style: italic"><span style="color: #9A1900">// reset all oscillators to halt + freerun</span></span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">for</span></span> <span style="color: #990000">(</span><span style="color: #009900">int</span> osc <span style="color: #990000">=</span> <span style="color: #993399">0xa0</span><span style="color: #990000">;</span> osc <span style="color: #990000"><</span> <span style="color: #993399">0xc0</span><span style="color: #990000">;</span> osc<span style="color: #990000">++)</span> <span style="color: #FF0000">{</span>
|
|
SNDADRL <span style="color: #990000">=</span> osc<span style="color: #990000">;</span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">1</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// halt</span></span>
|
|
<span style="color: #FF0000">}</span>
|
|
|
|
<span style="font-style: italic"><span style="color: #9A1900">// load wavebank into sound RAM</span></span>
|
|
SNDCTL <span style="color: #990000">=</span> <span style="color: #993399">0x60</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// enable RAM + autoinc</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
SNDADRH <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// point to beginning of sound RAM</span></span>
|
|
<span style="font-style: italic"><span style="color: #9A1900">// do all 64k of sound RAM</span></span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">for</span></span> <span style="color: #990000">(</span><span style="color: #009900">int</span> addr <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> addr <span style="color: #990000"><</span> <span style="color: #993399">0x10000</span><span style="color: #990000">;</span> addr<span style="color: #990000">++)</span> <span style="color: #FF0000">{</span>
|
|
SNDDAT <span style="color: #990000">=</span> wavebank<span style="color: #990000">[</span>addr <span style="color: #990000">+</span> <span style="color: #993399">2</span><span style="color: #990000">];</span> <span style="font-style: italic"><span style="color: #9A1900">// skip num inst at start of wavebank</span></span>
|
|
<span style="color: #FF0000">}</span>
|
|
playing <span style="color: #990000">=</span> false<span style="color: #990000">;</span>
|
|
|
|
SNDINT <span style="color: #990000">=</span> <span style="color: #993399">0x945c</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// = jsr $00/945c, this is soundInt()</span></span>
|
|
SNDINTH <span style="color: #990000">=</span> <span style="color: #993399">0x003c</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// called whenever a channel stops</span></span>
|
|
|
|
SNDCTL <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// DAC, vol = 0, disable autoinc</span></span>
|
|
|
|
<span style="font-style: italic"><span style="color: #9A1900">// use oscillator 0 as a timer</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0x0</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// Osc 0 Frequency</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">0xfa</span><span style="color: #990000">;</span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0x20</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// Osc 0 Frequency Hi</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0x40</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// Osc 0 Volume</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// mute the timer</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0x80</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// Osc 0 Wavetable ptr</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xc0</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// Osc 0 Wavetable size</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// 0 = 256 bytes, 0 res</span></span>
|
|
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xe1</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// Enable oscillators</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">0x3c</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// 30 oscillators</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xa0</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// Osc 0 control</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">0x8</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// free run mode + interrupts enabled</span></span>
|
|
|
|
<span style="font-style: italic"><span style="color: #9A1900">// music + header + blockSize = effects1 table (blockSize bytes long)</span></span>
|
|
effects1 <span style="color: #990000">=</span> <span style="color: #990000">&</span>music <span style="color: #990000">+</span> <span style="color: #993399">0x258</span> <span style="color: #990000">+</span> music<span style="color: #990000">[</span><span style="color: #993399">6</span><span style="color: #990000">].</span>w<span style="color: #990000">;</span>
|
|
<span style="font-style: italic"><span style="color: #9A1900">// effects1 + blockSize = effects2 table (blockSize bytes long)</span></span>
|
|
effects2 <span style="color: #990000">=</span> effects1 <span style="color: #990000">+</span> music<span style="color: #990000">[</span><span style="color: #993399">6</span><span style="color: #990000">].</span>w<span style="color: #990000">;</span>
|
|
<span style="font-style: italic"><span style="color: #9A1900">// effects2 + blockSize = stereo table (16 words long)</span></span>
|
|
stereoTable <span style="color: #990000">=</span> effects2 <span style="color: #990000">+</span> music<span style="color: #990000">[</span><span style="color: #993399">6</span><span style="color: #990000">].</span>w<span style="color: #990000">;</span>
|
|
|
|
<span style="font-style: italic"><span style="color: #9A1900">// load instrument headers</span></span>
|
|
<span style="color: #009900">int</span> pos <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
numInst <span style="color: #990000">=</span> wavebank<span style="color: #990000">[</span><span style="color: #993399">0</span><span style="color: #990000">]</span> <span style="color: #990000">&</span> <span style="color: #993399">0xff</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">for</span></span> <span style="color: #990000">(</span>inst <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> inst <span style="color: #990000"><</span> numInst<span style="color: #990000">;</span> inst<span style="color: #990000">++)</span> <span style="color: #FF0000">{</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">for</span></span> <span style="color: #990000">(</span><span style="color: #009900">int</span> i <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> i <span style="color: #990000"><</span> <span style="color: #993399">12</span><span style="color: #990000">;</span> i<span style="color: #990000">++)</span> <span style="color: #FF0000">{</span>
|
|
instdef<span style="color: #990000">[</span>inst <span style="color: #990000">*</span> <span style="color: #993399">12</span> <span style="color: #990000">+</span> i<span style="color: #990000">]</span> <span style="color: #990000">=</span> wavebank<span style="color: #990000">[</span><span style="color: #993399">0x10022</span> <span style="color: #990000">+</span> pos<span style="color: #990000">++];</span>
|
|
<span style="color: #FF0000">}</span>
|
|
pos <span style="color: #990000">+=</span> <span style="color: #993399">0x50</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="font-style: italic"><span style="color: #9A1900">// load compact table</span></span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">for</span></span> <span style="color: #990000">(</span><span style="color: #009900">int</span> y <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> y <span style="color: #990000"><</span> <span style="color: #993399">0x20</span><span style="color: #990000">;</span> y<span style="color: #990000">++)</span> <span style="color: #FF0000">{</span>
|
|
compactTable<span style="color: #990000">[</span>y<span style="color: #990000">]</span> <span style="color: #990000">=</span> wavebank<span style="color: #990000">[</span><span style="color: #993399">0x1005e</span> <span style="color: #990000">+</span> pos<span style="color: #990000">++];</span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="color: #FF0000">}</span>
|
|
|
|
<span style="font-style: italic"><span style="color: #9A1900">// start playing the song</span></span>
|
|
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">playSong</span></span><span style="color: #990000">()</span> <span style="color: #FF0000">{</span>
|
|
timer <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
songLen <span style="color: #990000">=</span> music<span style="color: #990000">[</span><span style="color: #993399">0x1d6</span><span style="color: #990000">];</span>
|
|
curRow <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
curPattern <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
rowOffset <span style="color: #990000">=</span> music<span style="color: #990000">[</span><span style="color: #993399">0x1d8</span><span style="color: #990000">]</span> <span style="color: #990000">*</span> <span style="color: #993399">64</span> <span style="color: #990000">*</span> <span style="color: #993399">14</span><span style="color: #990000">;</span>
|
|
tempo <span style="color: #990000">=</span> music<span style="color: #990000">[</span><span style="color: #993399">8</span><span style="color: #990000">].</span>w<span style="color: #990000">;</span>
|
|
|
|
<span style="color: #009900">int</span> pos <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">for</span></span> <span style="color: #990000">(</span><span style="color: #009900">int</span> i <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> i <span style="color: #990000"><</span> <span style="color: #993399">0x1e</span><span style="color: #990000">;</span> i <span style="color: #990000">+=</span> <span style="color: #993399">2</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
volumeTable<span style="color: #990000">[</span>i<span style="color: #990000">].</span>w <span style="color: #990000">=</span> music<span style="color: #990000">[</span><span style="color: #993399">0x2c</span> <span style="color: #990000">+</span> pos<span style="color: #990000">].</span>w<span style="color: #990000">;</span>
|
|
pos <span style="color: #990000">+=</span> <span style="color: #993399">0x1e</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
playing <span style="color: #990000">=</span> true<span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
|
|
<span style="font-style: italic"><span style="color: #9A1900">// this is called whenever an oscillator halts with interrupts enabled</span></span>
|
|
<span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">soundInt</span></span><span style="color: #990000">()</span> <span style="color: #FF0000">{</span>
|
|
SNDCTL <span style="color: #990000">&=</span> <span style="color: #993399">0x9f</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// doc, no auto inc</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xe0</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// oscillator interrupt</span></span>
|
|
SNDDAT <span style="color: #990000">&=</span> <span style="color: #993399">0x7f</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// clear interrupt</span></span>
|
|
<span style="color: #008080">uint8_t</span> osc <span style="color: #990000">=</span> <span style="color: #990000">(</span>SNDDAT <span style="color: #990000">&</span> <span style="color: #993399">0x3e</span><span style="color: #990000">)</span> <span style="color: #990000">>></span> <span style="color: #993399">1</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// get fired oscillator</span></span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>osc <span style="color: #990000">!=</span> <span style="color: #993399">0</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span> <span style="font-style: italic"><span style="color: #9A1900">// wasn't timer</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xa0</span> <span style="color: #990000">+</span> osc<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc control</span></span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>SNDDAT <span style="color: #990000">&</span> <span style="color: #993399">8</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span> <span style="font-style: italic"><span style="color: #9A1900">// were interrupts enabled?</span></span>
|
|
SNDDAT <span style="color: #990000">&=</span> <span style="color: #993399">0xfe</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// clear halt bit.. retrig</span></span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(!</span>playing<span style="color: #990000">)</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span><span style="color: #990000">;</span>
|
|
timer<span style="color: #990000">++;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>timer <span style="color: #990000">==</span> tempo<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
timer <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">for</span></span> <span style="color: #990000">(</span>oscillator <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> oscillator <span style="color: #990000"><</span> <span style="color: #993399">0xe</span><span style="color: #990000">;</span> oscillator<span style="color: #990000">++)</span> <span style="color: #FF0000">{</span>
|
|
semitone <span style="color: #990000">=</span> music<span style="color: #990000">[</span><span style="color: #993399">0x258</span> <span style="color: #990000">+</span> rowOffset<span style="color: #990000">];</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>semitone <span style="color: #990000">==</span> <span style="color: #993399">0</span> <span style="color: #990000">||</span> semitone <span style="color: #990000">>=</span> <span style="color: #993399">0x80</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
rowOffset<span style="color: #990000">++;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>semitone <span style="color: #990000">==</span> <span style="color: #993399">0x80</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
SNDCTL <span style="color: #990000">&=</span> <span style="color: #993399">0x9f</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// DAC mode</span></span>
|
|
oscaddr <span style="color: #990000">=</span> <span style="color: #990000">(</span>oscillator <span style="color: #990000">+</span> <span style="color: #993399">1</span><span style="color: #990000">)</span> <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">;</span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xa0</span> <span style="color: #990000">+</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc control</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">1</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// halt</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xa0</span> <span style="color: #990000">+</span> oscaddr <span style="color: #990000">+</span> <span style="color: #993399">1</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc control</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #993399">1</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// halt pair</span></span>
|
|
<span style="color: #FF0000">}</span> <span style="font-weight: bold"><span style="color: #0000FF">else</span></span> <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>semitone <span style="color: #990000">==</span> <span style="color: #993399">0x81</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
curRow <span style="color: #990000">=</span> <span style="color: #993399">0x3f</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="color: #FF0000">}</span> <span style="font-weight: bold"><span style="color: #0000FF">else</span></span> <span style="color: #FF0000">{</span>
|
|
<span style="color: #008080">uint8_t</span> fx <span style="color: #990000">=</span> effects1<span style="color: #990000">[</span>rowOffset<span style="color: #990000">];</span>
|
|
<span style="color: #008080">uint8_t</span> inst <span style="color: #990000">=</span> fx <span style="color: #990000">&</span> <span style="color: #993399">0xf0</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(!</span>inst<span style="color: #990000">)</span>
|
|
inst <span style="color: #990000">=</span> prevInst<span style="color: #990000">[</span>oscillator<span style="color: #990000">];</span>
|
|
prevInst<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">=</span> inst<span style="color: #990000">;</span>
|
|
volumeInt <span style="color: #990000">=</span> volumeTable<span style="color: #990000">[((</span>inst <span style="color: #990000">>></span> <span style="color: #993399">4</span><span style="color: #990000">)</span> <span style="color: #990000">-</span> <span style="color: #993399">1</span><span style="color: #990000">)</span> <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">].</span>w <span style="color: #990000">/</span> <span style="color: #993399">2</span><span style="color: #990000">;</span>
|
|
fx <span style="color: #990000">&=</span> <span style="color: #993399">0xf</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>fx <span style="color: #990000">==</span> <span style="color: #993399">0</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
arpeggio<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">=</span> effects2<span style="color: #990000">[</span>rowOffset<span style="color: #990000">];</span>
|
|
arpTone<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">=</span> semitone<span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span> <span style="font-weight: bold"><span style="color: #0000FF">else</span></span> <span style="color: #FF0000">{</span>
|
|
arpeggio<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>fx <span style="color: #990000">==</span> <span style="color: #993399">3</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
volumeInt <span style="color: #990000">=</span> effects2<span style="color: #990000">[</span>rowOffset<span style="color: #990000">]</span> <span style="color: #990000">/</span> <span style="color: #993399">2</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span> <span style="font-weight: bold"><span style="color: #0000FF">else</span></span> <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>fx <span style="color: #990000">==</span> <span style="color: #993399">6</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
volumeInt <span style="color: #990000">-=</span> effects2<span style="color: #990000">[</span>rowOffset<span style="color: #990000">]</span> <span style="color: #990000">/</span> <span style="color: #993399">2</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>volumeInt <span style="color: #990000"><</span> <span style="color: #993399">0</span><span style="color: #990000">)</span>
|
|
volumeInt <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span> <span style="font-weight: bold"><span style="color: #0000FF">else</span></span> <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>fx <span style="color: #990000">==</span> <span style="color: #993399">5</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
volumeInt <span style="color: #990000">+=</span> effects2<span style="color: #990000">[</span>rowOffset<span style="color: #990000">]</span> <span style="color: #990000">/</span> <span style="color: #993399">2</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>volumeInt <span style="color: #990000">>=</span> <span style="color: #993399">0x80</span><span style="color: #990000">)</span>
|
|
volumeInt <span style="color: #990000">=</span> <span style="color: #993399">0x7f</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span> <span style="font-weight: bold"><span style="color: #0000FF">else</span></span> <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>fx <span style="color: #990000">==</span> <span style="color: #993399">0xf</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
tempo <span style="color: #990000">=</span> effects2<span style="color: #990000">[</span>rowOffset<span style="color: #990000">];</span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">((</span>fx <span style="color: #990000">==</span> <span style="color: #993399">3</span> <span style="color: #990000">||</span> fx <span style="color: #990000">==</span> <span style="color: #993399">5</span> <span style="color: #990000">||</span> fx <span style="color: #990000">==</span> <span style="color: #993399">6</span><span style="color: #990000">)</span> <span style="color: #990000">&&</span> semitone <span style="color: #990000">==</span> <span style="color: #993399">0</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">while</span></span> <span style="color: #990000">(</span>SNDCTL <span style="color: #990000">&</span> <span style="color: #993399">0x80</span><span style="color: #990000">);</span> <span style="font-style: italic"><span style="color: #9A1900">// wait for DOC</span></span>
|
|
SNDCTL <span style="color: #990000">=</span> <span style="color: #990000">(</span>SNDCTL <span style="color: #990000">|</span> <span style="color: #993399">0x20</span><span style="color: #990000">)</span> <span style="color: #990000">&</span> <span style="color: #993399">0xbf</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// DOC + autoinc</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0x40</span> <span style="color: #990000">+</span> <span style="color: #990000">(</span>oscillator <span style="color: #990000">+</span> <span style="color: #993399">1</span><span style="color: #990000">)</span> <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc volume</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> volumeInt<span style="color: #990000">;</span>
|
|
SNDDAT <span style="color: #990000">=</span> volumeInt<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// pair</span></span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="color: #FF0000">}</span>
|
|
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>semitone<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
oscaddr <span style="color: #990000">=</span> <span style="color: #990000">(</span>oscillator <span style="color: #990000">+</span> <span style="color: #993399">1</span><span style="color: #990000">)</span> <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">;</span>
|
|
SNDCTL <span style="color: #990000">&=</span> <span style="color: #993399">0x9f</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// DOC mode</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xa0</span> <span style="color: #990000">+</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc ctl</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #990000">(</span>SNDDAT <span style="color: #990000">&</span> <span style="color: #993399">0xf7</span><span style="color: #990000">)</span> <span style="color: #990000">|</span> <span style="color: #993399">1</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// halt, no interrupt</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xa0</span> <span style="color: #990000">+</span> oscaddr <span style="color: #990000">+</span> <span style="color: #993399">1</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc ctl pair</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> <span style="color: #990000">(</span>SNDDAT <span style="color: #990000">&</span> <span style="color: #993399">0xf7</span><span style="color: #990000">)</span> <span style="color: #990000">|</span> <span style="color: #993399">1</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// halt, no interrupt pair</span></span>
|
|
inst <span style="color: #990000">=</span> <span style="color: #990000">(</span>prevInst<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">>></span> <span style="color: #993399">4</span><span style="color: #990000">)</span> <span style="color: #990000">-</span> <span style="color: #993399">1</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>inst <span style="color: #990000"><</span> numInst<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
<span style="color: #009900">int</span> x <span style="color: #990000">=</span> inst <span style="color: #990000">*</span> <span style="color: #993399">12</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">while</span></span> <span style="color: #990000">(</span>instruments<span style="color: #990000">[</span>x<span style="color: #990000">].</span>b <span style="color: #990000"><</span> semitone<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
x <span style="color: #990000">+=</span> <span style="color: #993399">6</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
oscAptr <span style="color: #990000">=</span> instruments<span style="color: #990000">[</span>x <span style="color: #990000">+</span> <span style="color: #993399">1</span><span style="color: #990000">].</span>b<span style="color: #990000">;</span>
|
|
oscAsiz <span style="color: #990000">=</span> instruments<span style="color: #990000">[</span>x <span style="color: #990000">+</span> <span style="color: #993399">2</span><span style="color: #990000">].</span>b<span style="color: #990000">;</span>
|
|
oscActl <span style="color: #990000">=</span> instruments<span style="color: #990000">[</span>x <span style="color: #990000">+</span> <span style="color: #993399">3</span><span style="color: #990000">].</span>b<span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>stereo<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
oscActl <span style="color: #990000">&=</span> <span style="color: #993399">0xf</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>stereoTable<span style="color: #990000">[</span>oscillator <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">])</span>
|
|
oscActl <span style="color: #990000">|=</span> <span style="color: #993399">0x10</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">while</span></span> <span style="color: #990000">(</span>instruments<span style="color: #990000">[</span>x<span style="color: #990000">].</span>b <span style="color: #990000">!=</span> <span style="color: #993399">0x7f</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
x <span style="color: #990000">+=</span> <span style="color: #993399">6</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
x <span style="color: #990000">+=</span> <span style="color: #993399">6</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// skip last instdef</span></span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">while</span></span> <span style="color: #990000">(</span>instruments<span style="color: #990000">[</span>x<span style="color: #990000">]</span> <span style="color: #990000"><</span> semitone<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
x <span style="color: #990000">+=</span> <span style="color: #993399">6</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
oscBptr <span style="color: #990000">=</span> instruments<span style="color: #990000">[</span>x <span style="color: #990000">+</span> <span style="color: #993399">1</span><span style="color: #990000">].</span>b<span style="color: #990000">;</span>
|
|
oscBsiz <span style="color: #990000">=</span> instruments<span style="color: #990000">[</span>x <span style="color: #990000">+</span> <span style="color: #993399">2</span><span style="color: #990000">].</span>b<span style="color: #990000">;</span>
|
|
oscBctl <span style="color: #990000">=</span> instruments<span style="color: #990000">[</span>x <span style="color: #990000">+</span> <span style="color: #993399">3</span><span style="color: #990000">].</span>b<span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>stereo<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
oscBctl <span style="color: #990000">&=</span> <span style="color: #993399">0xf</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>stereoTable<span style="color: #990000">[</span>oscillator <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">])</span>
|
|
oscBctl <span style="color: #990000">|=</span> <span style="color: #993399">0x10</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
freq <span style="color: #990000">=</span> freqTable<span style="color: #990000">[</span>semitone <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">].</span>w <span style="color: #990000">>></span> compactTable<span style="color: #990000">[</span>inst <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">].</span>w<span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">while</span></span> <span style="color: #990000">(</span>SNDCTL <span style="color: #990000">&</span> <span style="color: #993399">0x80</span><span style="color: #990000">);</span> <span style="font-style: italic"><span style="color: #9A1900">// wait for DOC</span></span>
|
|
SNDCTL <span style="color: #990000">=</span> <span style="color: #990000">(</span>SNDCTL <span style="color: #990000">|</span> <span style="color: #993399">0x20</span><span style="color: #990000">)</span> <span style="color: #990000">&</span> <span style="color: #993399">0xbf</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// DOC + autoinc</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc freq lo</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> freq<span style="color: #990000">;</span>
|
|
SNDDAT <span style="color: #990000">=</span> freq<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// pair</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0x20</span> <span style="color: #990000">+</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc freq hi</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> freq <span style="color: #990000">>></span> <span style="color: #993399">8</span><span style="color: #990000">;</span>
|
|
SNDDAT <span style="color: #990000">=</span> freq <span style="color: #990000">>></span> <span style="color: #993399">8</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// pair</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0x40</span> <span style="color: #990000">+</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc volume</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> volumeConversion<span style="color: #990000">[</span>volumeInt<span style="color: #990000">];</span>
|
|
SNDDAT <span style="color: #990000">=</span> volumeConversion<span style="color: #990000">[</span>volumeInt<span style="color: #990000">];</span> <span style="font-style: italic"><span style="color: #9A1900">// pair</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0x80</span> <span style="color: #990000">+</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc wavetable ptr</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> oscAptr<span style="color: #990000">;</span>
|
|
SNDDAT <span style="color: #990000">=</span> oscBptr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// pair</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xc0</span> <span style="color: #990000">+</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc wavetable size</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> oscAsiz<span style="color: #990000">;</span>
|
|
SNDDAT <span style="color: #990000">=</span> oscBsiz<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// pair</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0xa0</span> <span style="color: #990000">+</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// osc ctl</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> oscActl<span style="color: #990000">;</span>
|
|
SNDDAT <span style="color: #990000">=</span> oscBctl<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// pair</span></span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="color: #FF0000">}</span>
|
|
rowOffset<span style="color: #990000">++;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="color: #FF0000">}</span>
|
|
curRow<span style="color: #990000">++;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>curRow <span style="color: #990000"><</span> <span style="color: #993399">0x40</span><span style="color: #990000">)</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span><span style="color: #990000">;</span>
|
|
<span style="font-style: italic"><span style="color: #9A1900">// advance pattern</span></span>
|
|
curRow <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span>
|
|
curPattern<span style="color: #990000">++;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>curPattern <span style="color: #990000"><</span> songLen<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
rowOffset <span style="color: #990000">=</span> music<span style="color: #990000">[</span><span style="color: #993399">0x1d8</span> <span style="color: #990000">+</span> curPattern<span style="color: #990000">]</span> <span style="color: #990000">*</span> <span style="color: #993399">64</span> <span style="color: #990000">*</span> <span style="color: #993399">14</span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span> <span style="font-weight: bold"><span style="color: #0000FF">else</span></span> <span style="color: #FF0000">{</span> <span style="font-style: italic"><span style="color: #9A1900">// stopped</span></span>
|
|
playing <span style="color: #990000">=</span> false<span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">return</span></span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span> <span style="font-weight: bold"><span style="color: #0000FF">else</span></span> <span style="color: #FF0000">{</span> <span style="font-style: italic"><span style="color: #9A1900">// between notes.. apply arpeggios</span></span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">for</span></span> <span style="color: #990000">(</span>oscillator <span style="color: #990000">=</span> <span style="color: #993399">0</span><span style="color: #990000">;</span> oscillator <span style="color: #990000"><</span> <span style="color: #993399">0xe</span><span style="color: #990000">;</span> oscillator<span style="color: #990000">++)</span> <span style="color: #FF0000">{</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span>arpeggio<span style="color: #990000">[</span>oscillator<span style="color: #990000">])</span> <span style="color: #FF0000">{</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">switch</span></span> <span style="color: #990000">(</span>timer <span style="color: #990000">%</span> <span style="color: #993399">6</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">case</span></span> <span style="color: #993399">1</span><span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">case</span></span> <span style="color: #993399">4</span><span style="color: #990000">:</span>
|
|
arpTone<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">+=</span> arpeggio<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">>></span> <span style="color: #993399">4</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">break</span></span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">case</span></span> <span style="color: #993399">2</span><span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">case</span></span> <span style="color: #993399">5</span><span style="color: #990000">:</span>
|
|
arpTone<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">+=</span> arpeggio<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">&</span> <span style="color: #993399">0xf</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">break</span></span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">case</span></span> <span style="color: #993399">0</span><span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">case</span></span> <span style="color: #993399">3</span><span style="color: #990000">:</span>
|
|
arpTone<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">-=</span> arpeggio<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">>></span> <span style="color: #993399">4</span><span style="color: #990000">;</span>
|
|
arpTone<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">-=</span> arpeggio<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">&</span> <span style="color: #993399">0xf</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">break</span></span><span style="color: #990000">;</span>
|
|
<span style="color: #FF0000">}</span>
|
|
freq <span style="color: #990000">=</span> freqTable<span style="color: #990000">[</span>arpTone<span style="color: #990000">[</span>oscillator<span style="color: #990000">]</span> <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">].</span>w <span style="color: #990000">>></span> compactTable<span style="color: #990000">[</span>oscillator <span style="color: #990000">*</span>
|
|
<span style="color: #993399">2</span><span style="color: #990000">].</span>w<span style="color: #990000">;</span>
|
|
oscaddr <span style="color: #990000">=</span> <span style="color: #990000">(</span>oscillator <span style="color: #990000">+</span> <span style="color: #993399">1</span><span style="color: #990000">)</span> <span style="color: #990000">*</span> <span style="color: #993399">2</span><span style="color: #990000">;</span>
|
|
<span style="font-weight: bold"><span style="color: #0000FF">while</span></span> <span style="color: #990000">(</span>SNDCTL <span style="color: #990000">&</span> <span style="color: #993399">0x80</span><span style="color: #990000">);</span> <span style="font-style: italic"><span style="color: #9A1900">// wait for DOC</span></span>
|
|
SNDCTL <span style="color: #990000">=</span> <span style="color: #990000">(</span>SNDCTL <span style="color: #990000">|</span> <span style="color: #993399">0x20</span><span style="color: #990000">)</span> <span style="color: #990000">&</span> <span style="color: #993399">0xbf</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// DOC + autoinc</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// freq lo</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> freq<span style="color: #990000">;</span>
|
|
SNDDAT <span style="color: #990000">=</span> freq<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// pair</span></span>
|
|
SNDADRL <span style="color: #990000">=</span> <span style="color: #993399">0x20</span> <span style="color: #990000">+</span> oscaddr<span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// freq hi</span></span>
|
|
SNDDAT <span style="color: #990000">=</span> freq <span style="color: #990000">>></span> <span style="color: #993399">8</span><span style="color: #990000">;</span>
|
|
SNDDAT <span style="color: #990000">=</span> freq <span style="color: #990000">>></span> <span style="color: #993399">8</span><span style="color: #990000">;</span> <span style="font-style: italic"><span style="color: #9A1900">// pair</span></span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="color: #FF0000">}</span>
|
|
<span style="color: #FF0000">}</span>
|
|
|
|
<span style="color: #008080">uint8_t</span> volumeConversion<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">{</span>
|
|
<span style="color: #993399">0x00</span><span style="color: #990000">,</span> <span style="color: #993399">0x02</span><span style="color: #990000">,</span> <span style="color: #993399">0x04</span><span style="color: #990000">,</span> <span style="color: #993399">0x05</span><span style="color: #990000">,</span> <span style="color: #993399">0x06</span><span style="color: #990000">,</span> <span style="color: #993399">0x07</span><span style="color: #990000">,</span> <span style="color: #993399">0x09</span><span style="color: #990000">,</span> <span style="color: #993399">0x0a</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 0</span></span>
|
|
<span style="color: #993399">0x0c</span><span style="color: #990000">,</span> <span style="color: #993399">0x0d</span><span style="color: #990000">,</span> <span style="color: #993399">0x0f</span><span style="color: #990000">,</span> <span style="color: #993399">0x10</span><span style="color: #990000">,</span> <span style="color: #993399">0x12</span><span style="color: #990000">,</span> <span style="color: #993399">0x13</span><span style="color: #990000">,</span> <span style="color: #993399">0x15</span><span style="color: #990000">,</span> <span style="color: #993399">0x16</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 8</span></span>
|
|
<span style="color: #993399">0x18</span><span style="color: #990000">,</span> <span style="color: #993399">0x19</span><span style="color: #990000">,</span> <span style="color: #993399">0x1b</span><span style="color: #990000">,</span> <span style="color: #993399">0x1c</span><span style="color: #990000">,</span> <span style="color: #993399">0x1e</span><span style="color: #990000">,</span> <span style="color: #993399">0x1f</span><span style="color: #990000">,</span> <span style="color: #993399">0x21</span><span style="color: #990000">,</span> <span style="color: #993399">0x22</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 10</span></span>
|
|
<span style="color: #993399">0x24</span><span style="color: #990000">,</span> <span style="color: #993399">0x25</span><span style="color: #990000">,</span> <span style="color: #993399">0x27</span><span style="color: #990000">,</span> <span style="color: #993399">0x28</span><span style="color: #990000">,</span> <span style="color: #993399">0x2a</span><span style="color: #990000">,</span> <span style="color: #993399">0x2b</span><span style="color: #990000">,</span> <span style="color: #993399">0x2d</span><span style="color: #990000">,</span> <span style="color: #993399">0x2e</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 18</span></span>
|
|
<span style="color: #993399">0x30</span><span style="color: #990000">,</span> <span style="color: #993399">0x31</span><span style="color: #990000">,</span> <span style="color: #993399">0x33</span><span style="color: #990000">,</span> <span style="color: #993399">0x34</span><span style="color: #990000">,</span> <span style="color: #993399">0x36</span><span style="color: #990000">,</span> <span style="color: #993399">0x37</span><span style="color: #990000">,</span> <span style="color: #993399">0x39</span><span style="color: #990000">,</span> <span style="color: #993399">0x3a</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 20</span></span>
|
|
<span style="color: #993399">0x3c</span><span style="color: #990000">,</span> <span style="color: #993399">0x3d</span><span style="color: #990000">,</span> <span style="color: #993399">0x3f</span><span style="color: #990000">,</span> <span style="color: #993399">0x40</span><span style="color: #990000">,</span> <span style="color: #993399">0x42</span><span style="color: #990000">,</span> <span style="color: #993399">0x43</span><span style="color: #990000">,</span> <span style="color: #993399">0x45</span><span style="color: #990000">,</span> <span style="color: #993399">0x46</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 28</span></span>
|
|
<span style="color: #993399">0x48</span><span style="color: #990000">,</span> <span style="color: #993399">0x49</span><span style="color: #990000">,</span> <span style="color: #993399">0x4b</span><span style="color: #990000">,</span> <span style="color: #993399">0x4c</span><span style="color: #990000">,</span> <span style="color: #993399">0x4e</span><span style="color: #990000">,</span> <span style="color: #993399">0x4f</span><span style="color: #990000">,</span> <span style="color: #993399">0x51</span><span style="color: #990000">,</span> <span style="color: #993399">0x52</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 30</span></span>
|
|
<span style="color: #993399">0x54</span><span style="color: #990000">,</span> <span style="color: #993399">0x55</span><span style="color: #990000">,</span> <span style="color: #993399">0x57</span><span style="color: #990000">,</span> <span style="color: #993399">0x58</span><span style="color: #990000">,</span> <span style="color: #993399">0x5a</span><span style="color: #990000">,</span> <span style="color: #993399">0x5b</span><span style="color: #990000">,</span> <span style="color: #993399">0x5d</span><span style="color: #990000">,</span> <span style="color: #993399">0x5e</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 38</span></span>
|
|
<span style="color: #993399">0x60</span><span style="color: #990000">,</span> <span style="color: #993399">0x61</span><span style="color: #990000">,</span> <span style="color: #993399">0x63</span><span style="color: #990000">,</span> <span style="color: #993399">0x64</span><span style="color: #990000">,</span> <span style="color: #993399">0x66</span><span style="color: #990000">,</span> <span style="color: #993399">0x67</span><span style="color: #990000">,</span> <span style="color: #993399">0x69</span><span style="color: #990000">,</span> <span style="color: #993399">0x6a</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 40</span></span>
|
|
<span style="color: #993399">0x6c</span><span style="color: #990000">,</span> <span style="color: #993399">0x6d</span><span style="color: #990000">,</span> <span style="color: #993399">0x6f</span><span style="color: #990000">,</span> <span style="color: #993399">0x70</span><span style="color: #990000">,</span> <span style="color: #993399">0x72</span><span style="color: #990000">,</span> <span style="color: #993399">0x73</span><span style="color: #990000">,</span> <span style="color: #993399">0x75</span><span style="color: #990000">,</span> <span style="color: #993399">0x76</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 48</span></span>
|
|
<span style="color: #993399">0x78</span><span style="color: #990000">,</span> <span style="color: #993399">0x79</span><span style="color: #990000">,</span> <span style="color: #993399">0x7b</span><span style="color: #990000">,</span> <span style="color: #993399">0x7c</span><span style="color: #990000">,</span> <span style="color: #993399">0x7e</span><span style="color: #990000">,</span> <span style="color: #993399">0x7f</span><span style="color: #990000">,</span> <span style="color: #993399">0x81</span><span style="color: #990000">,</span> <span style="color: #993399">0x82</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 50</span></span>
|
|
<span style="color: #993399">0x84</span><span style="color: #990000">,</span> <span style="color: #993399">0x85</span><span style="color: #990000">,</span> <span style="color: #993399">0x87</span><span style="color: #990000">,</span> <span style="color: #993399">0x88</span><span style="color: #990000">,</span> <span style="color: #993399">0x8a</span><span style="color: #990000">,</span> <span style="color: #993399">0x8b</span><span style="color: #990000">,</span> <span style="color: #993399">0x8d</span><span style="color: #990000">,</span> <span style="color: #993399">0x8e</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 58</span></span>
|
|
<span style="color: #993399">0x90</span><span style="color: #990000">,</span> <span style="color: #993399">0x91</span><span style="color: #990000">,</span> <span style="color: #993399">0x93</span><span style="color: #990000">,</span> <span style="color: #993399">0x94</span><span style="color: #990000">,</span> <span style="color: #993399">0x96</span><span style="color: #990000">,</span> <span style="color: #993399">0x97</span><span style="color: #990000">,</span> <span style="color: #993399">0x99</span><span style="color: #990000">,</span> <span style="color: #993399">0x9a</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 60</span></span>
|
|
<span style="color: #993399">0x9c</span><span style="color: #990000">,</span> <span style="color: #993399">0x9d</span><span style="color: #990000">,</span> <span style="color: #993399">0x9f</span><span style="color: #990000">,</span> <span style="color: #993399">0xa0</span><span style="color: #990000">,</span> <span style="color: #993399">0xa2</span><span style="color: #990000">,</span> <span style="color: #993399">0xa3</span><span style="color: #990000">,</span> <span style="color: #993399">0xa5</span><span style="color: #990000">,</span> <span style="color: #993399">0xa6</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 68</span></span>
|
|
<span style="color: #993399">0xa8</span><span style="color: #990000">,</span> <span style="color: #993399">0xa9</span><span style="color: #990000">,</span> <span style="color: #993399">0xab</span><span style="color: #990000">,</span> <span style="color: #993399">0xac</span><span style="color: #990000">,</span> <span style="color: #993399">0xae</span><span style="color: #990000">,</span> <span style="color: #993399">0xaf</span><span style="color: #990000">,</span> <span style="color: #993399">0xb1</span><span style="color: #990000">,</span> <span style="color: #993399">0xb2</span><span style="color: #990000">,</span> <span style="font-style: italic"><span style="color: #9A1900">// 70</span></span>
|
|
<span style="color: #993399">0xb4</span><span style="color: #990000">,</span> <span style="color: #993399">0xb5</span><span style="color: #990000">,</span> <span style="color: #993399">0xb7</span><span style="color: #990000">,</span> <span style="color: #993399">0xb8</span><span style="color: #990000">,</span> <span style="color: #993399">0xba</span><span style="color: #990000">,</span> <span style="color: #993399">0xbb</span><span style="color: #990000">,</span> <span style="color: #993399">0xbe</span><span style="color: #990000">,</span> <span style="color: #993399">0xc0</span> <span style="font-style: italic"><span style="color: #9A1900">// 78</span></span>
|
|
<span style="color: #FF0000">}</span><span style="color: #990000">;</span>
|
|
<span style="color: #008080">uint16_t</span> freqTable<span style="color: #990000">[]</span> <span style="color: #990000">=</span> <span style="color: #FF0000">{</span>
|
|
<span style="color: #993399">0x0000</span><span style="color: #990000">,</span> <span style="color: #993399">0x0016</span><span style="color: #990000">,</span> <span style="color: #993399">0x0017</span><span style="color: #990000">,</span> <span style="color: #993399">0x0018</span><span style="color: #990000">,</span> <span style="color: #993399">0x001a</span><span style="color: #990000">,</span> <span style="color: #993399">0x001b</span><span style="color: #990000">,</span> <span style="color: #993399">0x001d</span><span style="color: #990000">,</span> <span style="color: #993399">0x001e</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x0020</span><span style="color: #990000">,</span> <span style="color: #993399">0x0022</span><span style="color: #990000">,</span> <span style="color: #993399">0x0024</span><span style="color: #990000">,</span> <span style="color: #993399">0x0026</span><span style="color: #990000">,</span> <span style="color: #993399">0x0029</span><span style="color: #990000">,</span> <span style="color: #993399">0x002b</span><span style="color: #990000">,</span> <span style="color: #993399">0x002e</span><span style="color: #990000">,</span> <span style="color: #993399">0x0031</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x0033</span><span style="color: #990000">,</span> <span style="color: #993399">0x0036</span><span style="color: #990000">,</span> <span style="color: #993399">0x003a</span><span style="color: #990000">,</span> <span style="color: #993399">0x003d</span><span style="color: #990000">,</span> <span style="color: #993399">0x0041</span><span style="color: #990000">,</span> <span style="color: #993399">0x0045</span><span style="color: #990000">,</span> <span style="color: #993399">0x0049</span><span style="color: #990000">,</span> <span style="color: #993399">0x004d</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x0052</span><span style="color: #990000">,</span> <span style="color: #993399">0x0056</span><span style="color: #990000">,</span> <span style="color: #993399">0x005c</span><span style="color: #990000">,</span> <span style="color: #993399">0x0061</span><span style="color: #990000">,</span> <span style="color: #993399">0x0067</span><span style="color: #990000">,</span> <span style="color: #993399">0x006d</span><span style="color: #990000">,</span> <span style="color: #993399">0x0073</span><span style="color: #990000">,</span> <span style="color: #993399">0x007a</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x0081</span><span style="color: #990000">,</span> <span style="color: #993399">0x0089</span><span style="color: #990000">,</span> <span style="color: #993399">0x0091</span><span style="color: #990000">,</span> <span style="color: #993399">0x009a</span><span style="color: #990000">,</span> <span style="color: #993399">0x00a3</span><span style="color: #990000">,</span> <span style="color: #993399">0x00ad</span><span style="color: #990000">,</span> <span style="color: #993399">0x00b7</span><span style="color: #990000">,</span> <span style="color: #993399">0x00c2</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x00ce</span><span style="color: #990000">,</span> <span style="color: #993399">0x00d9</span><span style="color: #990000">,</span> <span style="color: #993399">0x00e6</span><span style="color: #990000">,</span> <span style="color: #993399">0x00f4</span><span style="color: #990000">,</span> <span style="color: #993399">0x0102</span><span style="color: #990000">,</span> <span style="color: #993399">0x0112</span><span style="color: #990000">,</span> <span style="color: #993399">0x0122</span><span style="color: #990000">,</span> <span style="color: #993399">0x0133</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x0146</span><span style="color: #990000">,</span> <span style="color: #993399">0x015a</span><span style="color: #990000">,</span> <span style="color: #993399">0x016f</span><span style="color: #990000">,</span> <span style="color: #993399">0x0184</span><span style="color: #990000">,</span> <span style="color: #993399">0x019b</span><span style="color: #990000">,</span> <span style="color: #993399">0x01b4</span><span style="color: #990000">,</span> <span style="color: #993399">0x01ce</span><span style="color: #990000">,</span> <span style="color: #993399">0x01e9</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x0206</span><span style="color: #990000">,</span> <span style="color: #993399">0x0225</span><span style="color: #990000">,</span> <span style="color: #993399">0x0246</span><span style="color: #990000">,</span> <span style="color: #993399">0x0269</span><span style="color: #990000">,</span> <span style="color: #993399">0x028d</span><span style="color: #990000">,</span> <span style="color: #993399">0x02b4</span><span style="color: #990000">,</span> <span style="color: #993399">0x02dd</span><span style="color: #990000">,</span> <span style="color: #993399">0x0309</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x0337</span><span style="color: #990000">,</span> <span style="color: #993399">0x0368</span><span style="color: #990000">,</span> <span style="color: #993399">0x039c</span><span style="color: #990000">,</span> <span style="color: #993399">0x03d3</span><span style="color: #990000">,</span> <span style="color: #993399">0x040d</span><span style="color: #990000">,</span> <span style="color: #993399">0x044a</span><span style="color: #990000">,</span> <span style="color: #993399">0x048c</span><span style="color: #990000">,</span> <span style="color: #993399">0x04d1</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x051a</span><span style="color: #990000">,</span> <span style="color: #993399">0x0568</span><span style="color: #990000">,</span> <span style="color: #993399">0x05ba</span><span style="color: #990000">,</span> <span style="color: #993399">0x0611</span><span style="color: #990000">,</span> <span style="color: #993399">0x066e</span><span style="color: #990000">,</span> <span style="color: #993399">0x06d0</span><span style="color: #990000">,</span> <span style="color: #993399">0x0737</span><span style="color: #990000">,</span> <span style="color: #993399">0x07a5</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x081a</span><span style="color: #990000">,</span> <span style="color: #993399">0x0895</span><span style="color: #990000">,</span> <span style="color: #993399">0x0918</span><span style="color: #990000">,</span> <span style="color: #993399">0x09a2</span><span style="color: #990000">,</span> <span style="color: #993399">0x0a35</span><span style="color: #990000">,</span> <span style="color: #993399">0x0ad0</span><span style="color: #990000">,</span> <span style="color: #993399">0x0b75</span><span style="color: #990000">,</span> <span style="color: #993399">0x0c23</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x0cdc</span><span style="color: #990000">,</span> <span style="color: #993399">0x0d9f</span><span style="color: #990000">,</span> <span style="color: #993399">0x0e6f</span><span style="color: #990000">,</span> <span style="color: #993399">0x0f4b</span><span style="color: #990000">,</span> <span style="color: #993399">0x1033</span><span style="color: #990000">,</span> <span style="color: #993399">0x112a</span><span style="color: #990000">,</span> <span style="color: #993399">0x122f</span><span style="color: #990000">,</span> <span style="color: #993399">0x1344</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x1469</span><span style="color: #990000">,</span> <span style="color: #993399">0x15a0</span><span style="color: #990000">,</span> <span style="color: #993399">0x16e9</span><span style="color: #990000">,</span> <span style="color: #993399">0x1846</span><span style="color: #990000">,</span> <span style="color: #993399">0x19b7</span><span style="color: #990000">,</span> <span style="color: #993399">0x1b3f</span><span style="color: #990000">,</span> <span style="color: #993399">0x1cde</span><span style="color: #990000">,</span> <span style="color: #993399">0x1e95</span><span style="color: #990000">,</span>
|
|
<span style="color: #993399">0x2066</span><span style="color: #990000">,</span> <span style="color: #993399">0x2254</span><span style="color: #990000">,</span> <span style="color: #993399">0x245e</span><span style="color: #990000">,</span> <span style="color: #993399">0x2688</span>
|
|
<span style="color: #FF0000">}</span><span style="color: #990000">;</span></tt></pre></div></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="footnotes"><hr /></div>
|
|
<div id="footer">
|
|
<div id="footer-text">
|
|
Last updated
|
|
2017-08-21 10:48:15 MST
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|