Files
Terrarum/work_files/romapidoc/api_speaker.tex
Song Minjae 0859544bd6 fixed crude implementation of speaker.retune
Former-commit-id: eb16dd94b10cc75150508b575c5c0210d18a46cd
Former-commit-id: 84585ddf7e9e839cdfebed086bc671f6b956a462
2016-09-30 21:01:25 +09:00

27 lines
1.1 KiB
TeX

The Speaker API provides means to control computer's built-in beeper speaker.
\section{Functions}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
speaker.enqueue(len: int, freq: num\footnote{Frequency in hertz (double) or the name of the note (``A-5'', ``B3'', ``F\#2'', ``Db6'', \ldots)}) & nil & Enqueues speaker driving information. Queues will be started automatically.
\\ \\
speaker.clear() & nil & Clears speaker queue.
\\ \\
speaker.retune(str or nil) & nil & Retunes speaker to specified tuning (e.g. ``A415'', ``C256'', ``A\#440''). If no argument is given, A440 will be used.
\\ \\
speaker.resetTune() & nil & Retunes speaker to A440.
\\ \\
speaker.toFreq(string) & int & Translates input note name to matching frequency based on current speaker tunining.
\end{tabularx}
\section{Constants}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Name} & \textbf{\large Type} & \textbf{\large Description}
\\ \\
\endhead
speaker.\_\_basefreq\_\_ & number & Frequency of note A-0.
\end{tabularx}