mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fcf920d3e | ||
|
|
c37de52787 | ||
|
|
5a8a65870f | ||
|
|
9af41126cb | ||
|
|
d2ed001eb5 | ||
|
|
3706458166 | ||
|
|
c92cf7468d | ||
|
|
e54b0cefab | ||
|
|
1a8403e203 | ||
|
|
554a74374b | ||
|
|
21b93795e7 | ||
|
|
11cf5faa0a | ||
|
|
de344668dd | ||
|
|
fe20fe92a2 | ||
|
|
e11bff2fe8 | ||
|
|
503ed3cc9f | ||
|
|
5d63b50e85 | ||
|
|
d12ef806ac | ||
|
|
ffce5357c6 | ||
|
|
b39c0bb101 | ||
|
|
f25eb5c3d7 | ||
|
|
71e5c027fb | ||
|
|
43dcd5775a |
441
doc/doxygen/html/doxygen.css
Normal file
441
doc/doxygen/html/doxygen.css
Normal file
@@ -0,0 +1,441 @@
|
||||
body, table, div, p, dl {
|
||||
font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* @group Heading Levels */
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 150%;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
caption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.qindex, div.navtab{
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
div.qindex, div.navpath {
|
||||
width: 100%;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
div.navtab {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
/* @group Link Styling */
|
||||
|
||||
a {
|
||||
color: #153788;
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.contents a:visited {
|
||||
color: #1b77c5;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a.qindex {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.qindexHL {
|
||||
font-weight: bold;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
border: 1px double #9295C2;
|
||||
}
|
||||
|
||||
.contents a.qindexHL:visited {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
a.el {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.elRef {
|
||||
}
|
||||
|
||||
a.code {
|
||||
}
|
||||
|
||||
a.codeRef {
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
dl.el {
|
||||
margin-left: -1cm;
|
||||
}
|
||||
|
||||
.fragment {
|
||||
font-family: monospace, fixed;
|
||||
font-size: 105%;
|
||||
}
|
||||
|
||||
pre.fragment {
|
||||
border: 1px solid #CCCCCC;
|
||||
background-color: #f5f5f5;
|
||||
padding: 4px 6px;
|
||||
margin: 4px 8px 4px 2px;
|
||||
}
|
||||
|
||||
div.ah {
|
||||
background-color: black;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
margin-bottom: 3px;
|
||||
margin-top: 3px
|
||||
}
|
||||
|
||||
div.groupHeader {
|
||||
margin-left: 16px;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.groupText {
|
||||
margin-left: 16px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
body {
|
||||
background: white;
|
||||
color: black;
|
||||
margin-right: 20px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
td.indexkey {
|
||||
background-color: #e8eef2;
|
||||
font-weight: bold;
|
||||
border: 1px solid #CCCCCC;
|
||||
margin: 2px 0px 2px 0;
|
||||
padding: 2px 10px;
|
||||
}
|
||||
|
||||
td.indexvalue {
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #CCCCCC;
|
||||
padding: 2px 10px;
|
||||
margin: 2px 0px;
|
||||
}
|
||||
|
||||
tr.memlist {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
p.formulaDsp {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
img.formulaDsp {
|
||||
|
||||
}
|
||||
|
||||
img.formulaInl {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* @group Code Colorization */
|
||||
|
||||
span.keyword {
|
||||
color: #008000
|
||||
}
|
||||
|
||||
span.keywordtype {
|
||||
color: #604020
|
||||
}
|
||||
|
||||
span.keywordflow {
|
||||
color: #e08000
|
||||
}
|
||||
|
||||
span.comment {
|
||||
color: #800000
|
||||
}
|
||||
|
||||
span.preprocessor {
|
||||
color: #806020
|
||||
}
|
||||
|
||||
span.stringliteral {
|
||||
color: #002080
|
||||
}
|
||||
|
||||
span.charliteral {
|
||||
color: #008080
|
||||
}
|
||||
|
||||
span.vhdldigit {
|
||||
color: #ff00ff
|
||||
}
|
||||
|
||||
span.vhdlchar {
|
||||
color: #000000
|
||||
}
|
||||
|
||||
span.vhdlkeyword {
|
||||
color: #700070
|
||||
}
|
||||
|
||||
span.vhdllogic {
|
||||
color: #ff0000
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
.search {
|
||||
color: #003399;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
form.search {
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
input.search {
|
||||
font-size: 75%;
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
background-color: #e8eef2;
|
||||
}
|
||||
|
||||
td.tiny {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.dirtab {
|
||||
padding: 4px;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #84b0c7;
|
||||
}
|
||||
|
||||
th.dirtab {
|
||||
background: #e8eef2;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
hr {
|
||||
height: 0;
|
||||
border: none;
|
||||
border-top: 1px solid #666;
|
||||
}
|
||||
|
||||
/* @group Member Descriptions */
|
||||
|
||||
.mdescLeft, .mdescRight,
|
||||
.memItemLeft, .memItemRight,
|
||||
.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
|
||||
background-color: #FAFAFA;
|
||||
border: none;
|
||||
margin: 4px;
|
||||
padding: 1px 0 0 8px;
|
||||
}
|
||||
|
||||
.mdescLeft, .mdescRight {
|
||||
padding: 0px 8px 4px 8px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.memItemLeft, .memItemRight, .memTemplParams {
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.memTemplParams {
|
||||
color: #606060;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Member Details */
|
||||
|
||||
/* Styles for detailed member documentation */
|
||||
|
||||
.memtemplate {
|
||||
font-size: 80%;
|
||||
color: #606060;
|
||||
font-weight: normal;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.memnav {
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
margin-right: 15px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.memitem {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.memname {
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.memproto, .memdoc {
|
||||
border: 1px solid #84b0c7;
|
||||
}
|
||||
|
||||
.memproto {
|
||||
padding: 0;
|
||||
background-color: #d5e1e8;
|
||||
font-weight: bold;
|
||||
-webkit-border-top-left-radius: 8px;
|
||||
-webkit-border-top-right-radius: 8px;
|
||||
-moz-border-radius-topleft: 8px;
|
||||
-moz-border-radius-topright: 8px;
|
||||
}
|
||||
|
||||
.memdoc {
|
||||
padding: 2px 5px;
|
||||
background-color: #eef3f5;
|
||||
border-top-width: 0;
|
||||
-webkit-border-bottom-left-radius: 8px;
|
||||
-webkit-border-bottom-right-radius: 8px;
|
||||
-moz-border-radius-bottomleft: 8px;
|
||||
-moz-border-radius-bottomright: 8px;
|
||||
}
|
||||
|
||||
.paramkey {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.paramtype {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.paramname {
|
||||
color: #602020;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.paramname em {
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Directory (tree) */
|
||||
|
||||
/* for the tree view */
|
||||
|
||||
.ftvtree {
|
||||
font-family: sans-serif;
|
||||
margin: 0.5em;
|
||||
}
|
||||
|
||||
/* these are for tree view when used as main index */
|
||||
|
||||
.directory {
|
||||
font-size: 9pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.directory h3 {
|
||||
margin: 0px;
|
||||
margin-top: 1em;
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
/*
|
||||
The following two styles can be used to replace the root node title
|
||||
with an image of your choice. Simply uncomment the next two styles,
|
||||
specify the name of your image and be sure to set 'height' to the
|
||||
proper pixel height of your image.
|
||||
*/
|
||||
|
||||
/*
|
||||
.directory h3.swap {
|
||||
height: 61px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url("yourimage.gif");
|
||||
}
|
||||
.directory h3.swap span {
|
||||
display: none;
|
||||
}
|
||||
*/
|
||||
|
||||
.directory > h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.directory p {
|
||||
margin: 0px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.directory div {
|
||||
display: none;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.directory img {
|
||||
vertical-align: -30%;
|
||||
}
|
||||
|
||||
/* these are for tree view when not used as main index */
|
||||
|
||||
.directory-alt {
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.directory-alt h3 {
|
||||
margin: 0px;
|
||||
margin-top: 1em;
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
.directory-alt > h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.directory-alt p {
|
||||
margin: 0px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.directory-alt div {
|
||||
display: none;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.directory-alt img {
|
||||
vertical-align: -30%;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
address {
|
||||
font-style: normal;
|
||||
color: #333;
|
||||
}
|
||||
BIN
doc/doxygen/html/doxygen.png
Normal file
BIN
doc/doxygen/html/doxygen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
23
doc/doxygen/html/index.html
Normal file
23
doc/doxygen/html/index.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Main Page</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css">
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head><body>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navigation" id="top">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li class="current"><a href="index.html"><span>Main Page</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1></h1>
|
||||
<p>
|
||||
</div>
|
||||
<hr size="1"><address style="text-align: right;"><small>Generated on Sun May 17 21:46:45 2009 by
|
||||
<a href="http://www.doxygen.org/index.html">
|
||||
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
|
||||
</body>
|
||||
</html>
|
||||
BIN
doc/doxygen/html/tab_b.gif
Normal file
BIN
doc/doxygen/html/tab_b.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 B |
BIN
doc/doxygen/html/tab_l.gif
Normal file
BIN
doc/doxygen/html/tab_l.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 706 B |
BIN
doc/doxygen/html/tab_r.gif
Normal file
BIN
doc/doxygen/html/tab_r.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
105
doc/doxygen/html/tabs.css
Normal file
105
doc/doxygen/html/tabs.css
Normal file
@@ -0,0 +1,105 @@
|
||||
/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */
|
||||
|
||||
DIV.tabs
|
||||
{
|
||||
float : left;
|
||||
width : 100%;
|
||||
background : url("tab_b.gif") repeat-x bottom;
|
||||
margin-bottom : 4px;
|
||||
}
|
||||
|
||||
DIV.tabs UL
|
||||
{
|
||||
margin : 0px;
|
||||
padding-left : 10px;
|
||||
list-style : none;
|
||||
}
|
||||
|
||||
DIV.tabs LI, DIV.tabs FORM
|
||||
{
|
||||
display : inline;
|
||||
margin : 0px;
|
||||
padding : 0px;
|
||||
}
|
||||
|
||||
DIV.tabs FORM
|
||||
{
|
||||
float : right;
|
||||
}
|
||||
|
||||
DIV.tabs A
|
||||
{
|
||||
float : left;
|
||||
background : url("tab_r.gif") no-repeat right top;
|
||||
border-bottom : 1px solid #84B0C7;
|
||||
font-size : 80%;
|
||||
font-weight : bold;
|
||||
text-decoration : none;
|
||||
}
|
||||
|
||||
DIV.tabs A:hover
|
||||
{
|
||||
background-position: 100% -150px;
|
||||
}
|
||||
|
||||
DIV.tabs A:link, DIV.tabs A:visited,
|
||||
DIV.tabs A:active, DIV.tabs A:hover
|
||||
{
|
||||
color: #1A419D;
|
||||
}
|
||||
|
||||
DIV.tabs SPAN
|
||||
{
|
||||
float : left;
|
||||
display : block;
|
||||
background : url("tab_l.gif") no-repeat left top;
|
||||
padding : 5px 9px;
|
||||
white-space : nowrap;
|
||||
}
|
||||
|
||||
DIV.tabs INPUT
|
||||
{
|
||||
float : right;
|
||||
display : inline;
|
||||
font-size : 1em;
|
||||
}
|
||||
|
||||
DIV.tabs TD
|
||||
{
|
||||
font-size : 80%;
|
||||
font-weight : bold;
|
||||
text-decoration : none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Commented Backslash Hack hides rule from IE5-Mac \*/
|
||||
DIV.tabs SPAN {float : none;}
|
||||
/* End IE5-Mac hack */
|
||||
|
||||
DIV.tabs A:hover SPAN
|
||||
{
|
||||
background-position: 0% -150px;
|
||||
}
|
||||
|
||||
DIV.tabs LI.current A
|
||||
{
|
||||
background-position: 100% -150px;
|
||||
border-width : 0px;
|
||||
}
|
||||
|
||||
DIV.tabs LI.current SPAN
|
||||
{
|
||||
background-position: 0% -150px;
|
||||
padding-bottom : 6px;
|
||||
}
|
||||
|
||||
DIV.navpath
|
||||
{
|
||||
background : none;
|
||||
border : none;
|
||||
border-bottom : 1px solid #84B0C7;
|
||||
text-align : center;
|
||||
margin : 2px;
|
||||
padding : 2px;
|
||||
}
|
||||
BIN
doc/doxygen/latex/FreeSans.ttf
Normal file
BIN
doc/doxygen/latex/FreeSans.ttf
Normal file
Binary file not shown.
86
doc/doxygen/latex/doxygen.sty
Normal file
86
doc/doxygen/latex/doxygen.sty
Normal file
@@ -0,0 +1,86 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{doxygen}
|
||||
\RequirePackage{calc}
|
||||
\RequirePackage{array}
|
||||
\pagestyle{fancyplain}
|
||||
\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}}
|
||||
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
|
||||
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
|
||||
\lhead[\fancyplain{}{\bfseries\thepage}]
|
||||
{\fancyplain{}{\bfseries\rightmark}}
|
||||
\rhead[\fancyplain{}{\bfseries\leftmark}]
|
||||
{\fancyplain{}{\bfseries\thepage}}
|
||||
\rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Sun May 17 21:46:45 2009 by Doxygen }]{}
|
||||
\lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Sun May 17 21:46:45 2009 by Doxygen }}
|
||||
\cfoot{}
|
||||
\newenvironment{Code}
|
||||
{\footnotesize}
|
||||
{\normalsize}
|
||||
\newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})}
|
||||
\newenvironment{DocInclude}
|
||||
{\footnotesize}
|
||||
{\normalsize}
|
||||
\newenvironment{VerbInclude}
|
||||
{\footnotesize}
|
||||
{\normalsize}
|
||||
\newenvironment{Image}
|
||||
{\begin{figure}[H]}
|
||||
{\end{figure}}
|
||||
\newenvironment{ImageNoCaption}{}{}
|
||||
\newenvironment{CompactList}
|
||||
{\begin{list}{}{
|
||||
\setlength{\leftmargin}{0.5cm}
|
||||
\setlength{\itemsep}{0pt}
|
||||
\setlength{\parsep}{0pt}
|
||||
\setlength{\topsep}{0pt}
|
||||
\renewcommand{\makelabel}{\hfill}}}
|
||||
{\end{list}}
|
||||
\newenvironment{CompactItemize}
|
||||
{
|
||||
\begin{itemize}
|
||||
\setlength{\itemsep}{-3pt}
|
||||
\setlength{\parsep}{0pt}
|
||||
\setlength{\topsep}{0pt}
|
||||
\setlength{\partopsep}{0pt}
|
||||
}
|
||||
{\end{itemize}}
|
||||
\newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp}
|
||||
\newlength{\tmplength}
|
||||
\newenvironment{TabularC}[1]
|
||||
{
|
||||
\setlength{\tmplength}
|
||||
{\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)}
|
||||
\par\begin{tabular*}{\linewidth}
|
||||
{*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|}
|
||||
}
|
||||
{\end{tabular*}\par}
|
||||
\newcommand{\entrylabel}[1]{
|
||||
{\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\vspace{1.5\baselineskip}}}}
|
||||
\newenvironment{Desc}
|
||||
{\begin{list}{}
|
||||
{
|
||||
\settowidth{\labelwidth}{40pt}
|
||||
\setlength{\leftmargin}{\labelwidth}
|
||||
\setlength{\parsep}{0pt}
|
||||
\setlength{\itemsep}{-4pt}
|
||||
\renewcommand{\makelabel}{\entrylabel}
|
||||
}
|
||||
}
|
||||
{\end{list}}
|
||||
\newenvironment{Indent}
|
||||
{\begin{list}{}{\setlength{\leftmargin}{0.5cm}}
|
||||
\item[]\ignorespaces}
|
||||
{\unskip\end{list}}
|
||||
\setlength{\parindent}{0cm}
|
||||
\setlength{\parskip}{0.2cm}
|
||||
\addtocounter{secnumdepth}{1}
|
||||
\sloppy
|
||||
\usepackage[T1]{fontenc}
|
||||
\makeatletter
|
||||
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{0ex}%
|
||||
{-3.25ex plus -1ex minus -0.2ex}%
|
||||
{1.5ex plus 0.2ex}%
|
||||
{\normalfont\normalsize\bfseries}}
|
||||
\makeatother
|
||||
\stepcounter{secnumdepth}
|
||||
\stepcounter{tocdepth}
|
||||
50
doc/doxygen/latex/refman.tex
Normal file
50
doc/doxygen/latex/refman.tex
Normal file
@@ -0,0 +1,50 @@
|
||||
\documentclass[a4paper]{book}
|
||||
\usepackage{a4wide}
|
||||
\usepackage{makeidx}
|
||||
\usepackage{fancyhdr}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{multicol}
|
||||
\usepackage{float}
|
||||
\usepackage{textcomp}
|
||||
\usepackage{alltt}
|
||||
\usepackage{times}
|
||||
\usepackage{ifpdf}
|
||||
\ifpdf
|
||||
\usepackage[pdftex,
|
||||
pagebackref=true,
|
||||
colorlinks=true,
|
||||
linkcolor=blue,
|
||||
unicode
|
||||
]{hyperref}
|
||||
\else
|
||||
\usepackage[ps2pdf,
|
||||
pagebackref=true,
|
||||
colorlinks=true,
|
||||
linkcolor=blue,
|
||||
unicode
|
||||
]{hyperref}
|
||||
\usepackage{pspicture}
|
||||
\fi
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{doxygen}
|
||||
\makeindex
|
||||
\setcounter{tocdepth}{3}
|
||||
\renewcommand{\footrulewidth}{0.4pt}
|
||||
\begin{document}
|
||||
\begin{titlepage}
|
||||
\vspace*{7cm}
|
||||
\begin{center}
|
||||
{\Large Reference Manual}\\
|
||||
\vspace*{1cm}
|
||||
{\large Generated by Doxygen 1.5.8}\\
|
||||
\vspace*{0.5cm}
|
||||
{\small Sun May 17 21:46:45 2009}\\
|
||||
\end{center}
|
||||
\end{titlepage}
|
||||
\clearemptydoublepage
|
||||
\pagenumbering{roman}
|
||||
\tableofcontents
|
||||
\clearemptydoublepage
|
||||
\pagenumbering{arabic}
|
||||
\printindex
|
||||
\end{document}
|
||||
152
doc/html/ADSR_8h-source.html
Normal file
152
doc/html/ADSR_8h-source.html
Normal file
@@ -0,0 +1,152 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>ADSR.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ADSR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ADSR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a><a class="code" href="namespacestk.html">00006</a> <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1ADSR.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <span class="keyword">enum</span> {
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba9518c737b76795fa49f997c09e074c8e">00027</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba9518c737b76795fa49f997c09e074c8e">ATTACK</a>,
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba75e1deeb861fe2989250b1977018cacf">00028</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba75e1deeb861fe2989250b1977018cacf">DECAY</a>,
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba139dc35648a28ddc99a7a606e185f6ad">00029</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>,
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba7efc189b0b53e581201fd64f357a1756">00030</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba7efc189b0b53e581201fd64f357a1756">RELEASE</a>,
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154bac9fd188b8e5ad469e002f7ba3498028b">00031</a> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154bac9fd188b8e5ad469e002f7ba3498028b">DONE</a>
|
||||
<a name="l00032"></a>00032 };
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1ADSR.html#c7473272021307b0dcf1ef602143e144" title="Default constructor.">ADSR</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1ADSR.html#714f0b9deb325050eba819bc1fe22127" title="Class destructor.">~ADSR</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#ad03e82010a20cfb49c1f04bae791631" title="Set target = 1, state = ADSR::ATTACK.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#9400e04b313ab8900a3ba9b693f448e6" title="Set target = 0, state = ADSR::RELEASE.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#ff18347235fd52ce307c4b5de18a9c62" title="Set the attack rate.">setAttackRate</a>( StkFloat rate );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#285f500b1e149aed48dba2a155b95cdd" title="Set the decay rate.">setDecayRate</a>( StkFloat rate );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#85138fb6bbcc7b7cd85ec8449d68f7d8" title="Set the sustain level.">setSustainLevel</a>( StkFloat level );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#29da04231df73c2968c0e9387b43be6e" title="Set the release rate.">setReleaseRate</a>( StkFloat rate );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#48885319b8175cd4d6312fdf7980f116" title="Set the attack rate based on a time duration.">setAttackTime</a>( StkFloat time );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#450703c45384ae27eb766551843ce82d" title="Set the decay rate based on a time duration.">setDecayTime</a>( StkFloat time );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#91c14442557cb65286a327f8b297237a" title="Set the release rate based on a time duration.">setReleaseTime</a>( StkFloat time );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#3567b02a0e8ab82d18eb949d362f9708" title="Set sustain level and attack, decay, and release time durations.">setAllTimes</a>( StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#428eebd510e464ccd7bb4e5728f80d63" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1ADSR.html#87f9918cfa4104a841dc5b44f26f8904">00074</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1ADSR.html#87f9918cfa4104a841dc5b44f26f8904" title="Return the current envelope state (ATTACK, DECAY, SUSTAIN, RELEASE, DONE).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a99bf5fca3885bf8d99a3edc4072a4b5" title="Set to state = ADSR::SUSTAIN with current and target values of value.">setValue</a>( StkFloat value );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1ADSR.html#edbcb85346c354139f139b3232f36f39">00080</a> StkFloat <a class="code" href="classstk_1_1ADSR.html#edbcb85346c354139f139b3232f36f39" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 StkFloat <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keyword">protected</span>:
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00100"></a>00100 StkFloat value_;
|
||||
<a name="l00101"></a>00101 StkFloat target_;
|
||||
<a name="l00102"></a>00102 StkFloat attackRate_;
|
||||
<a name="l00103"></a>00103 StkFloat decayRate_;
|
||||
<a name="l00104"></a>00104 StkFloat releaseRate_;
|
||||
<a name="l00105"></a>00105 StkFloat sustainLevel_;
|
||||
<a name="l00106"></a>00106 };
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a><a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975">00108</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00109"></a>00109 {
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">switch</span> ( state_ ) {
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba9518c737b76795fa49f997c09e074c8e">ATTACK</a>:
|
||||
<a name="l00113"></a>00113 value_ += attackRate_;
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00115"></a>00115 value_ = target_;
|
||||
<a name="l00116"></a>00116 target_ = sustainLevel_;
|
||||
<a name="l00117"></a>00117 state_ = <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba75e1deeb861fe2989250b1977018cacf">DECAY</a>;
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 lastFrame_[0] = value_;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">break</span>;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba75e1deeb861fe2989250b1977018cacf">DECAY</a>:
|
||||
<a name="l00123"></a>00123 value_ -= decayRate_;
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">if</span> ( value_ <= sustainLevel_ ) {
|
||||
<a name="l00125"></a>00125 value_ = sustainLevel_;
|
||||
<a name="l00126"></a>00126 state_ = <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>;
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = value_;
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">break</span>;
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154ba7efc189b0b53e581201fd64f357a1756">RELEASE</a>:
|
||||
<a name="l00132"></a>00132 value_ -= releaseRate_;
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">if</span> ( value_ <= 0.0 ) {
|
||||
<a name="l00134"></a>00134 value_ = (StkFloat) 0.0;
|
||||
<a name="l00135"></a>00135 state_ = <a class="code" href="classstk_1_1ADSR.html#e1cdd1f2886d69a76fcd5b1e0e9154bac9fd188b8e5ad469e002f7ba3498028b">DONE</a>;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 lastFrame_[0] = value_;
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a><a class="code" href="classstk_1_1ADSR.html#97a617c65e62aadb4f88bd10cf437a6a">00144</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00145"></a>00145 {
|
||||
<a name="l00146"></a>00146 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00147"></a>00147 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00148"></a>00148 errorString_ << <span class="stringliteral">"ADSR::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00149"></a>00149 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00150"></a>00150 }
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#endif</span>
|
||||
<a name="l00152"></a>00152 <span class="preprocessor"></span>
|
||||
<a name="l00153"></a>00153 StkFloat *samples = &frames[channel];
|
||||
<a name="l00154"></a>00154 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00156"></a>00156 *samples = <a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR::tick</a>();
|
||||
<a name="l00157"></a>00157
|
||||
<a name="l00158"></a>00158 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
152
doc/html/ADSR_8h_source.html
Normal file
152
doc/html/ADSR_8h_source.html
Normal file
@@ -0,0 +1,152 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>ADSR.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ADSR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ADSR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a><a class="code" href="namespacestk.html">00006</a> <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1ADSR.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <span class="keyword">enum</span> {
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa9518c737b76795fa49f997c09e074c8e">00027</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa9518c737b76795fa49f997c09e074c8e">ATTACK</a>,
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">00028</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">DECAY</a>,
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">00029</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>,
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa7efc189b0b53e581201fd64f357a1756">00030</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa7efc189b0b53e581201fd64f357a1756">RELEASE</a>,
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baac9fd188b8e5ad469e002f7ba3498028b">00031</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baac9fd188b8e5ad469e002f7ba3498028b">DONE</a>
|
||||
<a name="l00032"></a>00032 };
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1ADSR.html#ac7473272021307b0dcf1ef602143e144" title="Default constructor.">ADSR</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1ADSR.html#a714f0b9deb325050eba819bc1fe22127" title="Class destructor.">~ADSR</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#aad03e82009a20cfb49c1f04bae791631" title="Set target = 1, state = ADSR::ATTACK.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a9400e04b313ab8900a3ba9b693f448e6" title="Set target = 0, state = ADSR::RELEASE.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#aff18347235fd52ce307c4b5de18a9c62" title="Set the attack rate.">setAttackRate</a>( StkFloat rate );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a285f500b1e149aed48dba2a155b95cdd" title="Set the decay rate.">setDecayRate</a>( StkFloat rate );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a85138fb6bbcc7b7cd85ec8449d68f7d8" title="Set the sustain level.">setSustainLevel</a>( StkFloat level );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a29da04231df73c2968c0e9387b43be6e" title="Set the release rate.">setReleaseRate</a>( StkFloat rate );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a48885319b8175cd4d6312fdf7980f116" title="Set the attack rate based on a time duration.">setAttackTime</a>( StkFloat time );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a450703c45384ae27eb766551843ce82d" title="Set the decay rate based on a time duration.">setDecayTime</a>( StkFloat time );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a91c14442557cb65286a327f8b297237a" title="Set the release rate based on a time duration.">setReleaseTime</a>( StkFloat time );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a3567b02a0e8ab82d18eb949d362f9708" title="Set sustain level and attack, decay, and release time durations.">setAllTimes</a>( StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a428eebd510e464ccd7bb4e5728f80d63" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1ADSR.html#a87f9918cfa4104a841dc5b44f26f8904">00074</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1ADSR.html#a87f9918cfa4104a841dc5b44f26f8904" title="Return the current envelope state (ATTACK, DECAY, SUSTAIN, RELEASE, DONE).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#aa99bf5fca3885bf8d99a3edc4072a4b5" title="Set to state = ADSR::SUSTAIN with current and target values of value.">setValue</a>( StkFloat value );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1ADSR.html#aedbcb85346c354139f139b3232f36f39">00080</a> StkFloat <a class="code" href="classstk_1_1ADSR.html#aedbcb85346c354139f139b3232f36f39" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 StkFloat <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keyword">protected</span>:
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00100"></a>00100 StkFloat value_;
|
||||
<a name="l00101"></a>00101 StkFloat target_;
|
||||
<a name="l00102"></a>00102 StkFloat attackRate_;
|
||||
<a name="l00103"></a>00103 StkFloat decayRate_;
|
||||
<a name="l00104"></a>00104 StkFloat releaseRate_;
|
||||
<a name="l00105"></a>00105 StkFloat sustainLevel_;
|
||||
<a name="l00106"></a>00106 };
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a><a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975">00108</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00109"></a>00109 {
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">switch</span> ( state_ ) {
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa9518c737b76795fa49f997c09e074c8e">ATTACK</a>:
|
||||
<a name="l00113"></a>00113 value_ += attackRate_;
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00115"></a>00115 value_ = target_;
|
||||
<a name="l00116"></a>00116 target_ = sustainLevel_;
|
||||
<a name="l00117"></a>00117 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">DECAY</a>;
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 lastFrame_[0] = value_;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">break</span>;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">DECAY</a>:
|
||||
<a name="l00123"></a>00123 value_ -= decayRate_;
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">if</span> ( value_ <= sustainLevel_ ) {
|
||||
<a name="l00125"></a>00125 value_ = sustainLevel_;
|
||||
<a name="l00126"></a>00126 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>;
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = value_;
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">break</span>;
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa7efc189b0b53e581201fd64f357a1756">RELEASE</a>:
|
||||
<a name="l00132"></a>00132 value_ -= releaseRate_;
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">if</span> ( value_ <= 0.0 ) {
|
||||
<a name="l00134"></a>00134 value_ = (StkFloat) 0.0;
|
||||
<a name="l00135"></a>00135 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baac9fd188b8e5ad469e002f7ba3498028b">DONE</a>;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 lastFrame_[0] = value_;
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a><a class="code" href="classstk_1_1ADSR.html#a97a617c65e62aadb4f88bd10cf437a6a">00144</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00145"></a>00145 {
|
||||
<a name="l00146"></a>00146 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00147"></a>00147 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00148"></a>00148 errorString_ << <span class="stringliteral">"ADSR::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00149"></a>00149 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00150"></a>00150 }
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#endif</span>
|
||||
<a name="l00152"></a>00152 <span class="preprocessor"></span>
|
||||
<a name="l00153"></a>00153 StkFloat *samples = &frames[channel];
|
||||
<a name="l00154"></a>00154 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00156"></a>00156 *samples = <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR::tick</a>();
|
||||
<a name="l00157"></a>00157
|
||||
<a name="l00158"></a>00158 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
122
doc/html/Asymp_8h-source.html
Normal file
122
doc/html/Asymp_8h-source.html
Normal file
@@ -0,0 +1,122 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Asymp.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ASYMP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ASYMP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a>00033 <span class="keyword">const</span> StkFloat TARGET_THRESHOLD = 0.000001;
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Asymp.html">00035</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Asymp.html" title="STK asymptotic curve envelope class.">Asymp</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00036"></a>00036 {
|
||||
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Asymp.html#d8ea9fc5621a1d8b81001d459de265a0" title="Default constructor.">Asymp</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1Asymp.html#d869abbd938c263a2c177de636f5a57c" title="Class destructor.">~Asymp</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#51f0aad846eb6bda4c20eb63534786e2" title="Set target = 1.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#082e765dc3bd6b452e92b602af7a1042" title="Set target = 0.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#ebd8ebaf6f6c9570d3ee78e1bcbbcbd2" title="Set the asymptotic rate via the time factor tau (must be &gt; 0).">setTau</a>( StkFloat tau );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#ca998e9c4ae86b4958da59fc9433268c" title="Set the asymptotic rate based on a time duration (must be &gt; 0).">setTime</a>( StkFloat time );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#7b0f7025ba5f268f1e5ce097b209f0ec" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#81881bb8aca615f69bbbfd56267f971c" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a><a class="code" href="classstk_1_1Asymp.html#aba01ef0ac1a493a14a73c3b29259bde">00070</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Asymp.html#aba01ef0ac1a493a14a73c3b29259bde" title="Return the current envelope state (0 = at target, 1 otherwise).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Asymp.html#eb868c171e07206e2d5d30f8ce8f4436">00073</a> StkFloat <a class="code" href="classstk_1_1Asymp.html#eb868c171e07206e2d5d30f8ce8f4436" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="keyword">protected</span>:
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 StkFloat value_;
|
||||
<a name="l00093"></a>00093 StkFloat target_;
|
||||
<a name="l00094"></a>00094 StkFloat factor_;
|
||||
<a name="l00095"></a>00095 StkFloat constant_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00097"></a>00097 };
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e">00099</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 value_ = factor_ * value_ + constant_;
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="comment">// Check threshold.</span>
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">if</span> ( target_ - value_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00108"></a>00108 value_ = target_;
|
||||
<a name="l00109"></a>00109 state_ = 0;
|
||||
<a name="l00110"></a>00110 }
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">else</span> {
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">if</span> ( value_ - target_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00114"></a>00114 value_ = target_;
|
||||
<a name="l00115"></a>00115 state_ = 0;
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118 lastFrame_[0] = value_;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1Asymp.html#2647bc013816f026915b1e92ddd6a322">00124</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00125"></a>00125 {
|
||||
<a name="l00126"></a>00126 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00128"></a>00128 errorString_ << <span class="stringliteral">"Asymp::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00129"></a>00129 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#endif</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span>
|
||||
<a name="l00133"></a>00133 StkFloat *samples = &frames[channel];
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00136"></a>00136 *samples = <a class="code" href="classstk_1_1Asymp.html#64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp::tick</a>();
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
122
doc/html/Asymp_8h_source.html
Normal file
122
doc/html/Asymp_8h_source.html
Normal file
@@ -0,0 +1,122 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Asymp.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ASYMP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ASYMP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a>00033 <span class="keyword">const</span> StkFloat TARGET_THRESHOLD = 0.000001;
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Asymp.html">00035</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Asymp.html" title="STK asymptotic curve envelope class.">Asymp</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00036"></a>00036 {
|
||||
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Asymp.html#ad8ea9fc5621a1d8b81001d459de265a0" title="Default constructor.">Asymp</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1Asymp.html#ad869abbd938c263a2c177de636f5a57c" title="Class destructor.">~Asymp</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#a51f0aad846eb6bda4c20eb63534786e2" title="Set target = 1.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#a082e765dc3bd6b452e92b602af7a1042" title="Set target = 0.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#aebd8ebaf6f6c9570d3ee78e1bcbbcbd2" title="Set the asymptotic rate via the time factor tau (must be &gt; 0).">setTau</a>( StkFloat tau );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#aca998e9c4ae86b4958da59fc9433268c" title="Set the asymptotic rate based on a time duration (must be &gt; 0).">setTime</a>( StkFloat time );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#a7b0f7025ba5f268f1e5ce097b209f0ec" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#a81881bb8aca615f69bbbfd56267f971c" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a><a class="code" href="classstk_1_1Asymp.html#aaba01ef0ac1a493a14a73c3b29259bde">00070</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Asymp.html#aaba01ef0ac1a493a14a73c3b29259bde" title="Return the current envelope state (0 = at target, 1 otherwise).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Asymp.html#aeb868c171e07206e2d5d30f8ce8f4436">00073</a> StkFloat <a class="code" href="classstk_1_1Asymp.html#aeb868c171e07206e2d5d30f8ce8f4436" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="keyword">protected</span>:
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 StkFloat value_;
|
||||
<a name="l00093"></a>00093 StkFloat target_;
|
||||
<a name="l00094"></a>00094 StkFloat factor_;
|
||||
<a name="l00095"></a>00095 StkFloat constant_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00097"></a>00097 };
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e">00099</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 value_ = factor_ * value_ + constant_;
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="comment">// Check threshold.</span>
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">if</span> ( target_ - value_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00108"></a>00108 value_ = target_;
|
||||
<a name="l00109"></a>00109 state_ = 0;
|
||||
<a name="l00110"></a>00110 }
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">else</span> {
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">if</span> ( value_ - target_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00114"></a>00114 value_ = target_;
|
||||
<a name="l00115"></a>00115 state_ = 0;
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118 lastFrame_[0] = value_;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1Asymp.html#a2647bc013816f026915b1e92ddd6a322">00124</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00125"></a>00125 {
|
||||
<a name="l00126"></a>00126 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00128"></a>00128 errorString_ << <span class="stringliteral">"Asymp::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00129"></a>00129 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#endif</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span>
|
||||
<a name="l00133"></a>00133 StkFloat *samples = &frames[channel];
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00136"></a>00136 *samples = <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp::tick</a>();
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
99
doc/html/BandedWG_8h-source.html
Normal file
99
doc/html/BandedWG_8h-source.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BandedWG.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BANDEDWG_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BANDEDWG_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BowTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a>00043 <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_BANDED_MODES = 20;
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1BandedWG.html">00045</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BandedWG.html" title="Banded waveguide modeling class.">BandedWG</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00046"></a>00046 {
|
||||
<a name="l00047"></a>00047 <span class="keyword">public</span>:
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BandedWG.html#d449f248adaa49344c2bd25be4a7872d" title="Class constructor.">BandedWG</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1BandedWG.html#c4044055c28bad672c9537b985d18289" title="Class destructor.">~BandedWG</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#182dbf5d75aebf5714bd6df15b0df90c" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#4394ee4cd1c84a8b3f92713e60715c4d" title="Set strike position (0.0 - 1.0).">setStrikePosition</a>( StkFloat position );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#b1e3a367eef86e6cb372b4ee232e1804" title="Select a preset.">setPreset</a>( <span class="keywordtype">int</span> preset );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#cf104d4ed663b5f0cd034c8025f4d420" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#37b20c2554e7100241a99758f5a4433e" title="Apply bow velocity/pressure to instrument with given amplitude and rate of increase...">startBowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a14786c32af030311e2118db3b68a892" title="Decrease bow velocity/breath pressure with given rate of decrease.">stopBowing</a>( StkFloat rate );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#271573afaa2dc655446482bad6745cc1" title="Pluck the instrument with given amplitude.">pluck</a>( StkFloat amp );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#8f334ae49b7baf561d74a0b6ec3c4f9a" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#c9c3c3ec0e821b1a080774bb55d3b881" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#16baac1cc6612332d6d0aa40a661c137" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085 StkFloat <a class="code" href="classstk_1_1BandedWG.html#44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="keyword">protected</span>:
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">bool</span> doPluck_;
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">bool</span> trackVelocity_;
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">int</span> nModes_;
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">int</span> presetModes_;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> bandpass_[MAX_BANDED_MODES];
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delay_[MAX_BANDED_MODES];
|
||||
<a name="l00097"></a>00097 StkFloat maxVelocity_;
|
||||
<a name="l00098"></a>00098 StkFloat modes_[MAX_BANDED_MODES];
|
||||
<a name="l00099"></a>00099 StkFloat frequency_;
|
||||
<a name="l00100"></a>00100 StkFloat baseGain_;
|
||||
<a name="l00101"></a>00101 StkFloat gains_[MAX_BANDED_MODES];
|
||||
<a name="l00102"></a>00102 StkFloat basegains_[MAX_BANDED_MODES];
|
||||
<a name="l00103"></a>00103 StkFloat excitation_[MAX_BANDED_MODES];
|
||||
<a name="l00104"></a>00104 StkFloat integrationConstant_;
|
||||
<a name="l00105"></a>00105 StkFloat velocityInput_;
|
||||
<a name="l00106"></a>00106 StkFloat bowVelocity_;
|
||||
<a name="l00107"></a>00107 StkFloat bowTarget_;
|
||||
<a name="l00108"></a>00108 StkFloat bowPosition_;
|
||||
<a name="l00109"></a>00109 StkFloat strikeAmp_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">int</span> strikePosition_;
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
99
doc/html/BandedWG_8h_source.html
Normal file
99
doc/html/BandedWG_8h_source.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BandedWG.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BANDEDWG_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BANDEDWG_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BowTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a>00043 <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_BANDED_MODES = 20;
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1BandedWG.html">00045</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BandedWG.html" title="Banded waveguide modeling class.">BandedWG</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00046"></a>00046 {
|
||||
<a name="l00047"></a>00047 <span class="keyword">public</span>:
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BandedWG.html#ad449f248adaa49344c2bd25be4a7872d" title="Class constructor.">BandedWG</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1BandedWG.html#ac4044055c28bad672c9537b985d18289" title="Class destructor.">~BandedWG</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a182dbf5d75aebf5714bd6df15b0df90c" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a4394ee4cd1c84a8b3f92713e60715c4d" title="Set strike position (0.0 - 1.0).">setStrikePosition</a>( StkFloat position );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#ab1e3a367eef86e6cb372b4ee232e1804" title="Select a preset.">setPreset</a>( <span class="keywordtype">int</span> preset );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#acf104d4ed663b5f0cd034c8025f4d420" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a37b20c2554e7100241a99758f5a4433e" title="Apply bow velocity/pressure to instrument with given amplitude and rate of increase...">startBowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#aa14786c32af030311e2118db3b68a892" title="Decrease bow velocity/breath pressure with given rate of decrease.">stopBowing</a>( StkFloat rate );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a271573afaa2dc655446482bad6745cc1" title="Pluck the instrument with given amplitude.">pluck</a>( StkFloat amp );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a8f334ae49b7baf561d74a0b6ec3c4f9a" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#ac9c3c3ec0e821b1a080774bb55d3b881" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a16baac1cc6612332d6d0aa40a661c137" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085 StkFloat <a class="code" href="classstk_1_1BandedWG.html#a44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="keyword">protected</span>:
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">bool</span> doPluck_;
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">bool</span> trackVelocity_;
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">int</span> nModes_;
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">int</span> presetModes_;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> bandpass_[MAX_BANDED_MODES];
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delay_[MAX_BANDED_MODES];
|
||||
<a name="l00097"></a>00097 StkFloat maxVelocity_;
|
||||
<a name="l00098"></a>00098 StkFloat modes_[MAX_BANDED_MODES];
|
||||
<a name="l00099"></a>00099 StkFloat frequency_;
|
||||
<a name="l00100"></a>00100 StkFloat baseGain_;
|
||||
<a name="l00101"></a>00101 StkFloat gains_[MAX_BANDED_MODES];
|
||||
<a name="l00102"></a>00102 StkFloat basegains_[MAX_BANDED_MODES];
|
||||
<a name="l00103"></a>00103 StkFloat excitation_[MAX_BANDED_MODES];
|
||||
<a name="l00104"></a>00104 StkFloat integrationConstant_;
|
||||
<a name="l00105"></a>00105 StkFloat velocityInput_;
|
||||
<a name="l00106"></a>00106 StkFloat bowVelocity_;
|
||||
<a name="l00107"></a>00107 StkFloat bowTarget_;
|
||||
<a name="l00108"></a>00108 StkFloat bowPosition_;
|
||||
<a name="l00109"></a>00109 StkFloat strikeAmp_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">int</span> strikePosition_;
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
77
doc/html/BeeThree_8h-source.html
Normal file
77
doc/html/BeeThree_8h-source.html
Normal file
@@ -0,0 +1,77 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BeeThree.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BEETHREE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BEETHREE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BeeThree.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BeeThree.html" title="STK Hammond-oid organ FM synthesis instrument.">BeeThree</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BeeThree.html#b4534210b85a2c4798bf1c88b348c20a" title="Class constructor.">BeeThree</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1BeeThree.html#f2a0c982731438cf6200b3e5642a288d" title="Class destructor.">~BeeThree</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BeeThree.html#480c0fe8d4c2df9c00b82b192dd7eae4" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1BeeThree.html#4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a>00060 <span class="keyword">protected</span>:
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a><a class="code" href="classstk_1_1BeeThree.html#4649b9471bde3b978c20fcafcbef0fc7">00064</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BeeThree.html#4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">BeeThree :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00065"></a>00065 {
|
||||
<a name="l00066"></a>00066 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <span class="keywordflow">if</span> ( modDepth_ > 0.0 ) {
|
||||
<a name="l00069"></a>00069 temp = 1.0 + ( modDepth_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * 0.1 );
|
||||
<a name="l00070"></a>00070 waves_[0]->setFrequency( baseFrequency_ * temp * ratios_[0] );
|
||||
<a name="l00071"></a>00071 waves_[1]->setFrequency( baseFrequency_ * temp * ratios_[1] );
|
||||
<a name="l00072"></a>00072 waves_[2]->setFrequency( baseFrequency_ * temp * ratios_[2] );
|
||||
<a name="l00073"></a>00073 waves_[3]->setFrequency( baseFrequency_ * temp * ratios_[3] );
|
||||
<a name="l00074"></a>00074 }
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#e9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00077"></a>00077 temp = control1_ * 2.0 * gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00078"></a>00078 twozero_.<a class="code" href="classstk_1_1TwoZero.html#cf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 temp += control2_ * 2.0 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00081"></a>00081 temp += gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00082"></a>00082 temp += gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 lastFrame_[0] = temp * 0.125;
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00086"></a>00086 }
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
77
doc/html/BeeThree_8h_source.html
Normal file
77
doc/html/BeeThree_8h_source.html
Normal file
@@ -0,0 +1,77 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BeeThree.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BEETHREE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BEETHREE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BeeThree.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BeeThree.html" title="STK Hammond-oid organ FM synthesis instrument.">BeeThree</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BeeThree.html#ab4534210b85a2c4798bf1c88b348c20a" title="Class constructor.">BeeThree</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1BeeThree.html#af2a0c982731438cf6200b3e5642a288d" title="Class destructor.">~BeeThree</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BeeThree.html#a480c0fe8d4c2df9c00b82b192dd7eae4" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a>00060 <span class="keyword">protected</span>:
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a><a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7">00064</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">BeeThree :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00065"></a>00065 {
|
||||
<a name="l00066"></a>00066 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <span class="keywordflow">if</span> ( modDepth_ > 0.0 ) {
|
||||
<a name="l00069"></a>00069 temp = 1.0 + ( modDepth_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * 0.1 );
|
||||
<a name="l00070"></a>00070 waves_[0]->setFrequency( baseFrequency_ * temp * ratios_[0] );
|
||||
<a name="l00071"></a>00071 waves_[1]->setFrequency( baseFrequency_ * temp * ratios_[1] );
|
||||
<a name="l00072"></a>00072 waves_[2]->setFrequency( baseFrequency_ * temp * ratios_[2] );
|
||||
<a name="l00073"></a>00073 waves_[3]->setFrequency( baseFrequency_ * temp * ratios_[3] );
|
||||
<a name="l00074"></a>00074 }
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00077"></a>00077 temp = control1_ * 2.0 * gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00078"></a>00078 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 temp += control2_ * 2.0 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00081"></a>00081 temp += gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00082"></a>00082 temp += gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 lastFrame_[0] = temp * 0.125;
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00086"></a>00086 }
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
148
doc/html/BiQuad_8h-source.html
Normal file
148
doc/html/BiQuad_8h-source.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BiQuad.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BIQUAD_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BIQUAD_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1BiQuad.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1BiQuad.html#91aab9d1b4833e156edcf59cbe276e3f" title="Default constructor creates a second-order pass-through filter.">BiQuad</a>();
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1BiQuad.html#d7e81be1c4e5c5ab69474f6df2610984" title="Class destructor.">~BiQuad</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1BiQuad.html#ab468cd1aa79b95442b15bb04d8bb211">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#ab468cd1aa79b95442b15bb04d8bb211" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#eed58196cf798f664cddbb9a8564c7b5" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat b1, StkFloat b2, StkFloat a1, StkFloat a2, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1BiQuad.html#26ee25d08116b20f326001166f087853">00037</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#26ee25d08116b20f326001166f087853" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1BiQuad.html#dd364ed410b3ed2a2b29b8a5fea127c8">00040</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#dd364ed410b3ed2a2b29b8a5fea127c8" title="Set the b[1] coefficient value.">setB1</a>( StkFloat b1 ) { b_[1] = b1; };
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1BiQuad.html#208a654dd3393ed0b2b86ad56d9cf3e1">00043</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#208a654dd3393ed0b2b86ad56d9cf3e1" title="Set the b[2] coefficient value.">setB2</a>( StkFloat b2 ) { b_[2] = b2; };
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a><a class="code" href="classstk_1_1BiQuad.html#1c9799e47163fe8a59fd85196c089cb3">00046</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#1c9799e47163fe8a59fd85196c089cb3" title="Set the a[1] coefficient value.">setA1</a>( StkFloat a1 ) { a_[1] = a1; };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1BiQuad.html#e28afd560df11435ea54f128d23b9383">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#e28afd560df11435ea54f128d23b9383" title="Set the a[2] coefficient value.">setA2</a>( StkFloat a2 ) { a_[2] = a2; };
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#55aaa01fd4156f1fac1168f526e3d969" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( StkFloat frequency, StkFloat radius, <span class="keywordtype">bool</span> normalize = <span class="keyword">false</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#e10a26fc319ba357bc92df4e528c2d8f" title="Set the filter coefficients for a notch at frequency (in Hz).">setNotch</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#28881f5876ce5bdcc846367cca9363f7" title="Sets the filter zeroes for equal resonance gain.">setEqualGainZeroes</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a><a class="code" href="classstk_1_1BiQuad.html#412f224363b1a222423ecf0cd7be9063">00084</a> StkFloat <a class="code" href="classstk_1_1BiQuad.html#412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087 StkFloat <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( StkFloat input );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keyword">protected</span>:
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00114"></a>00114 };
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a><a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635">00116</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( StkFloat input )
|
||||
<a name="l00117"></a>00117 {
|
||||
<a name="l00118"></a>00118 inputs_[0] = gain_ * input;
|
||||
<a name="l00119"></a>00119 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00120"></a>00120 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00121"></a>00121 inputs_[2] = inputs_[1];
|
||||
<a name="l00122"></a>00122 inputs_[1] = inputs_[0];
|
||||
<a name="l00123"></a>00123 outputs_[2] = outputs_[1];
|
||||
<a name="l00124"></a>00124 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a><a class="code" href="classstk_1_1BiQuad.html#f903e41217838470a5f267a20b905a12">00129</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00130"></a>00130 {
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00133"></a>00133 errorString_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00134"></a>00134 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 <span class="preprocessor">#endif</span>
|
||||
<a name="l00137"></a>00137 <span class="preprocessor"></span>
|
||||
<a name="l00138"></a>00138 StkFloat *samples = &frames[channel];
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00141"></a>00141 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00142"></a>00142 *samples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00143"></a>00143 *samples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00144"></a>00144 inputs_[2] = inputs_[1];
|
||||
<a name="l00145"></a>00145 inputs_[1] = inputs_[0];
|
||||
<a name="l00146"></a>00146 outputs_[2] = outputs_[1];
|
||||
<a name="l00147"></a>00147 outputs_[1] = *samples;
|
||||
<a name="l00148"></a>00148 }
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a><a class="code" href="classstk_1_1BiQuad.html#c9836f0e074ea9516727f27eb9b411aa">00154</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00155"></a>00155 {
|
||||
<a name="l00156"></a>00156 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00157"></a>00157 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00158"></a>00158 errorString_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00159"></a>00159 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00160"></a>00160 }
|
||||
<a name="l00161"></a>00161 <span class="preprocessor">#endif</span>
|
||||
<a name="l00162"></a>00162 <span class="preprocessor"></span>
|
||||
<a name="l00163"></a>00163 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00164"></a>00164 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00166"></a>00166 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00167"></a>00167 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00168"></a>00168 *oSamples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00169"></a>00169 *oSamples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00170"></a>00170 inputs_[2] = inputs_[1];
|
||||
<a name="l00171"></a>00171 inputs_[1] = inputs_[0];
|
||||
<a name="l00172"></a>00172 outputs_[2] = outputs_[1];
|
||||
<a name="l00173"></a>00173 outputs_[1] = *oSamples;
|
||||
<a name="l00174"></a>00174 }
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00176"></a>00176 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00177"></a>00177 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00180"></a>00180 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 <span class="preprocessor">#endif</span>
|
||||
<a name="l00183"></a>00183 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
148
doc/html/BiQuad_8h_source.html
Normal file
148
doc/html/BiQuad_8h_source.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BiQuad.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BIQUAD_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BIQUAD_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1BiQuad.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1BiQuad.html#a91aab9d1b4833e156edcf59cbe276e3f" title="Default constructor creates a second-order pass-through filter.">BiQuad</a>();
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1BiQuad.html#ad7e81be1c4e5c5ab69474f6df2610984" title="Class destructor.">~BiQuad</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1BiQuad.html#aab468cd1aa79b95442b15bb04d8bb211">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#aab468cd1aa79b95442b15bb04d8bb211" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#aeed58196cf798f664cddbb9a8564c7b5" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat b1, StkFloat b2, StkFloat a1, StkFloat a2, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1BiQuad.html#a26ee25d08116b20f326001166f087853">00037</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a26ee25d08116b20f326001166f087853" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1BiQuad.html#add364ed410b3ed2a2b29b8a5fea127c8">00040</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#add364ed410b3ed2a2b29b8a5fea127c8" title="Set the b[1] coefficient value.">setB1</a>( StkFloat b1 ) { b_[1] = b1; };
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1BiQuad.html#a208a654dd3393ed0b2b86ad56d9cf3e1">00043</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a208a654dd3393ed0b2b86ad56d9cf3e1" title="Set the b[2] coefficient value.">setB2</a>( StkFloat b2 ) { b_[2] = b2; };
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a><a class="code" href="classstk_1_1BiQuad.html#a1c9799e47163fe8a59fd85196c089cb3">00046</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a1c9799e47163fe8a59fd85196c089cb3" title="Set the a[1] coefficient value.">setA1</a>( StkFloat a1 ) { a_[1] = a1; };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1BiQuad.html#ae28afd560df11435ea54f128d23b9383">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#ae28afd560df11435ea54f128d23b9383" title="Set the a[2] coefficient value.">setA2</a>( StkFloat a2 ) { a_[2] = a2; };
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a55aaa01fd4156f1fac1168f526e3d969" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( StkFloat frequency, StkFloat radius, <span class="keywordtype">bool</span> normalize = <span class="keyword">false</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#ae10a26fc319ba357bc92df4e528c2d8f" title="Set the filter coefficients for a notch at frequency (in Hz).">setNotch</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a28881f5876ce5bdcc846367cca9363f7" title="Sets the filter zeroes for equal resonance gain.">setEqualGainZeroes</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a><a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063">00084</a> StkFloat <a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087 StkFloat <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( StkFloat input );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keyword">protected</span>:
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00114"></a>00114 };
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a><a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635">00116</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( StkFloat input )
|
||||
<a name="l00117"></a>00117 {
|
||||
<a name="l00118"></a>00118 inputs_[0] = gain_ * input;
|
||||
<a name="l00119"></a>00119 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00120"></a>00120 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00121"></a>00121 inputs_[2] = inputs_[1];
|
||||
<a name="l00122"></a>00122 inputs_[1] = inputs_[0];
|
||||
<a name="l00123"></a>00123 outputs_[2] = outputs_[1];
|
||||
<a name="l00124"></a>00124 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a><a class="code" href="classstk_1_1BiQuad.html#af903e41217838470a5f267a20b905a12">00129</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00130"></a>00130 {
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00133"></a>00133 errorString_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00134"></a>00134 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 <span class="preprocessor">#endif</span>
|
||||
<a name="l00137"></a>00137 <span class="preprocessor"></span>
|
||||
<a name="l00138"></a>00138 StkFloat *samples = &frames[channel];
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00141"></a>00141 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00142"></a>00142 *samples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00143"></a>00143 *samples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00144"></a>00144 inputs_[2] = inputs_[1];
|
||||
<a name="l00145"></a>00145 inputs_[1] = inputs_[0];
|
||||
<a name="l00146"></a>00146 outputs_[2] = outputs_[1];
|
||||
<a name="l00147"></a>00147 outputs_[1] = *samples;
|
||||
<a name="l00148"></a>00148 }
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a><a class="code" href="classstk_1_1BiQuad.html#ac9836f0e074ea9516727f27eb9b411aa">00154</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00155"></a>00155 {
|
||||
<a name="l00156"></a>00156 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00157"></a>00157 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00158"></a>00158 errorString_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00159"></a>00159 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00160"></a>00160 }
|
||||
<a name="l00161"></a>00161 <span class="preprocessor">#endif</span>
|
||||
<a name="l00162"></a>00162 <span class="preprocessor"></span>
|
||||
<a name="l00163"></a>00163 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00164"></a>00164 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00166"></a>00166 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00167"></a>00167 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00168"></a>00168 *oSamples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00169"></a>00169 *oSamples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00170"></a>00170 inputs_[2] = inputs_[1];
|
||||
<a name="l00171"></a>00171 inputs_[1] = inputs_[0];
|
||||
<a name="l00172"></a>00172 outputs_[2] = outputs_[1];
|
||||
<a name="l00173"></a>00173 outputs_[1] = *oSamples;
|
||||
<a name="l00174"></a>00174 }
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00176"></a>00176 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00177"></a>00177 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00180"></a>00180 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 <span class="preprocessor">#endif</span>
|
||||
<a name="l00183"></a>00183 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
129
doc/html/BlitSaw_8h-source.html
Normal file
129
doc/html/BlitSaw_8h-source.html
Normal file
@@ -0,0 +1,129 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlitSaw.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLITSAW_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLITSAW_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1BlitSaw.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlitSaw.html" title="STK band-limited sawtooth wave class.">BlitSaw</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1BlitSaw.html#8a245ef05cc58c521edaded5c6cdd5ee" title="Class constructor.">BlitSaw</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1BlitSaw.html#24cd2cc9852ce73252a99f7eff63879b" title="Class destructor.">~BlitSaw</a>();
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#3010cf9a0905368b857df2d332968036" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#fa6f1103a61221eebf5f49f3a7df4145" title="Set the sawtooth oscillator rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#8abd2b9a5b8d26926a383c1e56605545" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1BlitSaw.html#254758ecd4166cc4e7d6fced5650a198">00062</a> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#254758ecd4166cc4e7d6fced5650a198" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 StkFloat <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 <span class="keyword">protected</span>:
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00083"></a>00083 StkFloat rate_;
|
||||
<a name="l00084"></a>00084 StkFloat phase_;
|
||||
<a name="l00085"></a>00085 StkFloat p_;
|
||||
<a name="l00086"></a>00086 StkFloat C2_;
|
||||
<a name="l00087"></a>00087 StkFloat a_;
|
||||
<a name="l00088"></a>00088 StkFloat state_;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 };
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 <span class="comment">// The code below implements the BLIT algorithm of Stilson and</span>
|
||||
<a name="l00095"></a>00095 <span class="comment">// Smith, followed by a summation and filtering operation to produce</span>
|
||||
<a name="l00096"></a>00096 <span class="comment">// a sawtooth waveform. After experimenting with various approaches</span>
|
||||
<a name="l00097"></a>00097 <span class="comment">// to calculate the average value of the BLIT over one period, I</span>
|
||||
<a name="l00098"></a>00098 <span class="comment">// found that an estimate of C2_ = 1.0 / period (in samples) worked</span>
|
||||
<a name="l00099"></a>00099 <span class="comment">// most consistently. A "leaky integrator" is then applied to the</span>
|
||||
<a name="l00100"></a>00100 <span class="comment">// difference of the BLIT output and C2_. (GPS - 1 October 2005)</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// A fully optimized version of this code would replace the two sin </span>
|
||||
<a name="l00103"></a>00103 <span class="comment">// calls with a pair of fast sin oscillators, for which stable fast </span>
|
||||
<a name="l00104"></a>00104 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00105"></a>00105 <span class="comment">// which favors clarity over performance, the optimization has </span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// not been made here.</span>
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Avoid a divide by zero, or use of a denormalized divisor </span>
|
||||
<a name="l00109"></a>00109 <span class="comment">// at the sinc peak, which has a limiting value of m_ / p_.</span>
|
||||
<a name="l00110"></a>00110 StkFloat tmp, denominator = sin( phase_ );
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">if</span> ( fabs(denominator) <= std::numeric_limits<StkFloat>::epsilon() )
|
||||
<a name="l00112"></a>00112 tmp = a_;
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">else</span> {
|
||||
<a name="l00114"></a>00114 tmp = sin( m_ * phase_ );
|
||||
<a name="l00115"></a>00115 tmp /= p_ * denominator;
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 tmp += state_ - C2_;
|
||||
<a name="l00119"></a>00119 state_ = tmp * 0.995;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 phase_ += rate_;
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">if</span> ( phase_ >= PI ) phase_ -= PI;
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 lastFrame_[0] = tmp;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a><a class="code" href="classstk_1_1BlitSaw.html#b53f6ba99ef5c4f8982f6c0f07bf2e1d">00128</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00129"></a>00129 {
|
||||
<a name="l00130"></a>00130 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00131"></a>00131 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00132"></a>00132 errorString_ << <span class="stringliteral">"BlitSaw::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00133"></a>00133 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135 <span class="preprocessor">#endif</span>
|
||||
<a name="l00136"></a>00136 <span class="preprocessor"></span>
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 StkFloat *samples = &frames[channel];
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00141"></a>00141 *samples = <a class="code" href="classstk_1_1BlitSaw.html#03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw::tick</a>();
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00144"></a>00144 }
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
129
doc/html/BlitSaw_8h_source.html
Normal file
129
doc/html/BlitSaw_8h_source.html
Normal file
@@ -0,0 +1,129 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlitSaw.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLITSAW_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLITSAW_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1BlitSaw.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlitSaw.html" title="STK band-limited sawtooth wave class.">BlitSaw</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1BlitSaw.html#a8a245ef05cc58c521edaded5c6cdd5ee" title="Class constructor.">BlitSaw</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1BlitSaw.html#a24cd2cc9852ce73252a99f7eff63879b" title="Class destructor.">~BlitSaw</a>();
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#a3010cf9a0905368b857df2d332968036" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#afa6f1103a61221eebf5f49f3a7df4145" title="Set the sawtooth oscillator rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#a8abd2b9a5b8d26926a383c1e56605545" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1BlitSaw.html#a254758ecd4166cc4e7d6fced5650a198">00062</a> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#a254758ecd4166cc4e7d6fced5650a198" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 StkFloat <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 <span class="keyword">protected</span>:
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00083"></a>00083 StkFloat rate_;
|
||||
<a name="l00084"></a>00084 StkFloat phase_;
|
||||
<a name="l00085"></a>00085 StkFloat p_;
|
||||
<a name="l00086"></a>00086 StkFloat C2_;
|
||||
<a name="l00087"></a>00087 StkFloat a_;
|
||||
<a name="l00088"></a>00088 StkFloat state_;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 };
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 <span class="comment">// The code below implements the BLIT algorithm of Stilson and</span>
|
||||
<a name="l00095"></a>00095 <span class="comment">// Smith, followed by a summation and filtering operation to produce</span>
|
||||
<a name="l00096"></a>00096 <span class="comment">// a sawtooth waveform. After experimenting with various approaches</span>
|
||||
<a name="l00097"></a>00097 <span class="comment">// to calculate the average value of the BLIT over one period, I</span>
|
||||
<a name="l00098"></a>00098 <span class="comment">// found that an estimate of C2_ = 1.0 / period (in samples) worked</span>
|
||||
<a name="l00099"></a>00099 <span class="comment">// most consistently. A "leaky integrator" is then applied to the</span>
|
||||
<a name="l00100"></a>00100 <span class="comment">// difference of the BLIT output and C2_. (GPS - 1 October 2005)</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// A fully optimized version of this code would replace the two sin </span>
|
||||
<a name="l00103"></a>00103 <span class="comment">// calls with a pair of fast sin oscillators, for which stable fast </span>
|
||||
<a name="l00104"></a>00104 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00105"></a>00105 <span class="comment">// which favors clarity over performance, the optimization has </span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// not been made here.</span>
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Avoid a divide by zero, or use of a denormalized divisor </span>
|
||||
<a name="l00109"></a>00109 <span class="comment">// at the sinc peak, which has a limiting value of m_ / p_.</span>
|
||||
<a name="l00110"></a>00110 StkFloat tmp, denominator = sin( phase_ );
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">if</span> ( fabs(denominator) <= std::numeric_limits<StkFloat>::epsilon() )
|
||||
<a name="l00112"></a>00112 tmp = a_;
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">else</span> {
|
||||
<a name="l00114"></a>00114 tmp = sin( m_ * phase_ );
|
||||
<a name="l00115"></a>00115 tmp /= p_ * denominator;
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 tmp += state_ - C2_;
|
||||
<a name="l00119"></a>00119 state_ = tmp * 0.995;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 phase_ += rate_;
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">if</span> ( phase_ >= PI ) phase_ -= PI;
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 lastFrame_[0] = tmp;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a><a class="code" href="classstk_1_1BlitSaw.html#ab53f6ba99ef5c4f8982f6c0f07bf2e1d">00128</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00129"></a>00129 {
|
||||
<a name="l00130"></a>00130 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00131"></a>00131 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00132"></a>00132 errorString_ << <span class="stringliteral">"BlitSaw::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00133"></a>00133 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135 <span class="preprocessor">#endif</span>
|
||||
<a name="l00136"></a>00136 <span class="preprocessor"></span>
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 StkFloat *samples = &frames[channel];
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00141"></a>00141 *samples = <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw::tick</a>();
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00144"></a>00144 }
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/BlitSquare_8h-source.html
Normal file
134
doc/html/BlitSquare_8h-source.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlitSquare.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLITSQUARE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLITSQUARE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BlitSquare.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlitSquare.html" title="STK band-limited square wave class.">BlitSquare</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1BlitSquare.html#2cb3aee415a6ee75fa85b01e4e85d70b" title="Default constructor that initializes BLIT frequency to 220 Hz.">BlitSquare</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BlitSquare.html#4bc6e424ca1631f353f55846084634ef" title="Class destructor.">~BlitSquare</a>();
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#8f6dbe07d7f64b24cc9a41f6208dd6c4" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a><a class="code" href="classstk_1_1BlitSquare.html#eface58980a3ec865131f3cad59bbbef">00058</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#eface58980a3ec865131f3cad59bbbef" title="Set the phase of the signal.">setPhase</a>( StkFloat phase ) { phase_ = PI * phase; };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00064"></a><a class="code" href="classstk_1_1BlitSquare.html#bbda8cb84bcd36fc6d96130e9832a6af">00064</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#bbda8cb84bcd36fc6d96130e9832a6af" title="Get the current phase of the signal.">getPhase</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> phase_ / PI; };
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#8d0d8e0a12987ebccc56c09c7e7dbd6a" title="Set the impulse train rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#94521b4224d0873f5e783c721c123b21" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a><a class="code" href="classstk_1_1BlitSquare.html#77972e4e1c53600bf80cf692601ccae1">00085</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#77972e4e1c53600bf80cf692601ccae1" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00088"></a>00088 StkFloat <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00106"></a>00106 StkFloat rate_;
|
||||
<a name="l00107"></a>00107 StkFloat phase_;
|
||||
<a name="l00108"></a>00108 StkFloat p_;
|
||||
<a name="l00109"></a>00109 StkFloat a_;
|
||||
<a name="l00110"></a>00110 StkFloat lastBlitOutput_;
|
||||
<a name="l00111"></a>00111 StkFloat dcbState_;
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 StkFloat temp = lastBlitOutput_;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// A fully optimized version of this would replace the two sin calls</span>
|
||||
<a name="l00119"></a>00119 <span class="comment">// with a pair of fast sin oscillators, for which stable fast </span>
|
||||
<a name="l00120"></a>00120 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00121"></a>00121 <span class="comment">// which favors clarity over performance, the optimization has </span>
|
||||
<a name="l00122"></a>00122 <span class="comment">// not been made here.</span>
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="comment">// Avoid a divide by zero, or use of a denomralized divisor</span>
|
||||
<a name="l00125"></a>00125 <span class="comment">// at the sinc peak, which has a limiting value of 1.0.</span>
|
||||
<a name="l00126"></a>00126 StkFloat denominator = sin( phase_ );
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( fabs( denominator ) < std::numeric_limits<StkFloat>::epsilon() ) {
|
||||
<a name="l00128"></a>00128 <span class="comment">// Inexact comparison safely distinguishes betwen *close to zero*, and *close to PI*.</span>
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">if</span> ( phase_ < 0.1f || phase_ > TWO_PI - 0.1f )
|
||||
<a name="l00130"></a>00130 lastBlitOutput_ = a_;
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">else</span>
|
||||
<a name="l00132"></a>00132 lastBlitOutput_ = -a_;
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">else</span> {
|
||||
<a name="l00135"></a>00135 lastBlitOutput_ = sin( m_ * phase_ );
|
||||
<a name="l00136"></a>00136 lastBlitOutput_ /= p_ * denominator;
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 lastBlitOutput_ += temp;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Now apply DC blocker.</span>
|
||||
<a name="l00142"></a>00142 lastFrame_[0] = lastBlitOutput_ - dcbState_ + 0.999 * lastFrame_[0];
|
||||
<a name="l00143"></a>00143 dcbState_ = lastBlitOutput_;
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 phase_ += rate_;
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">if</span> ( phase_ >= TWO_PI ) phase_ -= TWO_PI;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a><a class="code" href="classstk_1_1BlitSquare.html#7df894d40b3d6effbb2a09819356258d">00151</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00152"></a>00152 {
|
||||
<a name="l00153"></a>00153 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00154"></a>00154 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00155"></a>00155 errorString_ << <span class="stringliteral">"BlitSquare::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#endif</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span>
|
||||
<a name="l00160"></a>00160 StkFloat *samples = &frames[channel];
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00163"></a>00163 *samples = <a class="code" href="classstk_1_1BlitSquare.html#04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare::tick</a>();
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a>00170 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/BlitSquare_8h_source.html
Normal file
134
doc/html/BlitSquare_8h_source.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlitSquare.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLITSQUARE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLITSQUARE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BlitSquare.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlitSquare.html" title="STK band-limited square wave class.">BlitSquare</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1BlitSquare.html#a2cb3aee415a6ee75fa85b01e4e85d70b" title="Default constructor that initializes BLIT frequency to 220 Hz.">BlitSquare</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BlitSquare.html#a4bc6e424ca1631f353f55846084634ef" title="Class destructor.">~BlitSquare</a>();
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#a8f6dbe07d7f64b24cc9a41f6208dd6c4" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a><a class="code" href="classstk_1_1BlitSquare.html#aeface58980a3ec865131f3cad59bbbef">00058</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#aeface58980a3ec865131f3cad59bbbef" title="Set the phase of the signal.">setPhase</a>( StkFloat phase ) { phase_ = PI * phase; };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00064"></a><a class="code" href="classstk_1_1BlitSquare.html#abbda8cb84bcd36fc6d96130e9832a6af">00064</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#abbda8cb84bcd36fc6d96130e9832a6af" title="Get the current phase of the signal.">getPhase</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> phase_ / PI; };
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#a8d0d8e0a12987ebccc56c09c7e7dbd6a" title="Set the impulse train rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#a94521b4224d0873f5e783c721c123b21" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a><a class="code" href="classstk_1_1BlitSquare.html#a77972e4e1c53600bf80cf692601ccae1">00085</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#a77972e4e1c53600bf80cf692601ccae1" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00088"></a>00088 StkFloat <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00106"></a>00106 StkFloat rate_;
|
||||
<a name="l00107"></a>00107 StkFloat phase_;
|
||||
<a name="l00108"></a>00108 StkFloat p_;
|
||||
<a name="l00109"></a>00109 StkFloat a_;
|
||||
<a name="l00110"></a>00110 StkFloat lastBlitOutput_;
|
||||
<a name="l00111"></a>00111 StkFloat dcbState_;
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 StkFloat temp = lastBlitOutput_;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// A fully optimized version of this would replace the two sin calls</span>
|
||||
<a name="l00119"></a>00119 <span class="comment">// with a pair of fast sin oscillators, for which stable fast </span>
|
||||
<a name="l00120"></a>00120 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00121"></a>00121 <span class="comment">// which favors clarity over performance, the optimization has </span>
|
||||
<a name="l00122"></a>00122 <span class="comment">// not been made here.</span>
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="comment">// Avoid a divide by zero, or use of a denomralized divisor</span>
|
||||
<a name="l00125"></a>00125 <span class="comment">// at the sinc peak, which has a limiting value of 1.0.</span>
|
||||
<a name="l00126"></a>00126 StkFloat denominator = sin( phase_ );
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( fabs( denominator ) < std::numeric_limits<StkFloat>::epsilon() ) {
|
||||
<a name="l00128"></a>00128 <span class="comment">// Inexact comparison safely distinguishes betwen *close to zero*, and *close to PI*.</span>
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">if</span> ( phase_ < 0.1f || phase_ > TWO_PI - 0.1f )
|
||||
<a name="l00130"></a>00130 lastBlitOutput_ = a_;
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">else</span>
|
||||
<a name="l00132"></a>00132 lastBlitOutput_ = -a_;
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">else</span> {
|
||||
<a name="l00135"></a>00135 lastBlitOutput_ = sin( m_ * phase_ );
|
||||
<a name="l00136"></a>00136 lastBlitOutput_ /= p_ * denominator;
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 lastBlitOutput_ += temp;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Now apply DC blocker.</span>
|
||||
<a name="l00142"></a>00142 lastFrame_[0] = lastBlitOutput_ - dcbState_ + 0.999 * lastFrame_[0];
|
||||
<a name="l00143"></a>00143 dcbState_ = lastBlitOutput_;
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 phase_ += rate_;
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">if</span> ( phase_ >= TWO_PI ) phase_ -= TWO_PI;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a><a class="code" href="classstk_1_1BlitSquare.html#a7df894d40b3d6effbb2a09819356258d">00151</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00152"></a>00152 {
|
||||
<a name="l00153"></a>00153 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00154"></a>00154 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00155"></a>00155 errorString_ << <span class="stringliteral">"BlitSquare::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#endif</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span>
|
||||
<a name="l00160"></a>00160 StkFloat *samples = &frames[channel];
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00163"></a>00163 *samples = <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare::tick</a>();
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a>00170 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
124
doc/html/Blit_8h-source.html
Normal file
124
doc/html/Blit_8h-source.html
Normal file
@@ -0,0 +1,124 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Blit.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLIT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLIT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1Blit.html">00033</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Blit.html" title="STK band-limited impulse train class.">Blit</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00034"></a>00034 {
|
||||
<a name="l00035"></a>00035 <span class="keyword">public</span>:
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Blit.html#63c5e6dca28aa3b3c01808e049f3da33" title="Default constructor that initializes BLIT frequency to 220 Hz.">Blit</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Blit.html#bed25206cc6cdb5fa8d667e7db0056a9" title="Class destructor.">~Blit</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#bbe50319cd6ed762c15e148a8abb4920" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1Blit.html#58e2197cedfc366145b729256bf365cb">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#58e2197cedfc366145b729256bf365cb" title="Set the phase of the signal.">setPhase</a>( StkFloat phase ) { phase_ = PI * phase; };
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Blit.html#01fb40970e8905e47b7f39a1fb01589f">00055</a> StkFloat <a class="code" href="classstk_1_1Blit.html#01fb40970e8905e47b7f39a1fb01589f" title="Get the current phase of the signal.">getPhase</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> phase_ / PI; };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#5571562e489947c4beccc206ecccfbdd" title="Set the impulse train rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#5a1fd506ab12ae614afaf0e402d24d30" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Blit.html#530af82a27731734af4f4b58bce283de">00076</a> StkFloat <a class="code" href="classstk_1_1Blit.html#530af82a27731734af4f4b58bce283de" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00097"></a>00097 StkFloat rate_;
|
||||
<a name="l00098"></a>00098 StkFloat phase_;
|
||||
<a name="l00099"></a>00099 StkFloat p_;
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 };
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a><a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717">00103</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00104"></a>00104 {
|
||||
<a name="l00105"></a>00105 <span class="comment">// The code below implements the SincM algorithm of Stilson and</span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// Smith with an additional scale factor of P / M applied to</span>
|
||||
<a name="l00107"></a>00107 <span class="comment">// normalize the output.</span>
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="comment">// A fully optimized version of this code would replace the two sin</span>
|
||||
<a name="l00110"></a>00110 <span class="comment">// calls with a pair of fast sin oscillators, for which stable fast</span>
|
||||
<a name="l00111"></a>00111 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00112"></a>00112 <span class="comment">// which favors clarity over performance, the optimization has not</span>
|
||||
<a name="l00113"></a>00113 <span class="comment">// been made here.</span>
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="comment">// Avoid a divide by zero at the sinc peak, which has a limiting</span>
|
||||
<a name="l00116"></a>00116 <span class="comment">// value of 1.0.</span>
|
||||
<a name="l00117"></a>00117 StkFloat tmp, denominator = sin( phase_ );
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">if</span> ( denominator <= std::numeric_limits<StkFloat>::epsilon() )
|
||||
<a name="l00119"></a>00119 tmp = 1.0;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">else</span> {
|
||||
<a name="l00121"></a>00121 tmp = sin( m_ * phase_ );
|
||||
<a name="l00122"></a>00122 tmp /= m_ * denominator;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 phase_ += rate_;
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">if</span> ( phase_ >= PI ) phase_ -= PI;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = tmp;
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a><a class="code" href="classstk_1_1Blit.html#20a3634131ff890641931c1d04df19ad">00132</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00133"></a>00133 {
|
||||
<a name="l00134"></a>00134 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00135"></a>00135 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00136"></a>00136 errorString_ << <span class="stringliteral">"Blit::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00137"></a>00137 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139 <span class="preprocessor">#endif</span>
|
||||
<a name="l00140"></a>00140 <span class="preprocessor"></span>
|
||||
<a name="l00141"></a>00141 StkFloat *samples = &frames[channel];
|
||||
<a name="l00142"></a>00142 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00144"></a>00144 *samples = <a class="code" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit::tick</a>();
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
124
doc/html/Blit_8h_source.html
Normal file
124
doc/html/Blit_8h_source.html
Normal file
@@ -0,0 +1,124 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Blit.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLIT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLIT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1Blit.html">00033</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Blit.html" title="STK band-limited impulse train class.">Blit</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00034"></a>00034 {
|
||||
<a name="l00035"></a>00035 <span class="keyword">public</span>:
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Blit.html#a63c5e6dca28aa3b3c01808e049f3da33" title="Default constructor that initializes BLIT frequency to 220 Hz.">Blit</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Blit.html#abed25206cc6cdb5fa8d667e7db0056a9" title="Class destructor.">~Blit</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#abbe50319cd6ed762c15e148a8abb4920" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1Blit.html#a58e2197cedfc366145b729256bf365cb">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#a58e2197cedfc366145b729256bf365cb" title="Set the phase of the signal.">setPhase</a>( StkFloat phase ) { phase_ = PI * phase; };
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Blit.html#a01fb40970e8905e47b7f39a1fb01589f">00055</a> StkFloat <a class="code" href="classstk_1_1Blit.html#a01fb40970e8905e47b7f39a1fb01589f" title="Get the current phase of the signal.">getPhase</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> phase_ / PI; };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#a5571562e489947c4beccc206ecccfbdd" title="Set the impulse train rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#a5a1fd506ab12ae614afaf0e402d24d30" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Blit.html#a530af82a27731734af4f4b58bce283de">00076</a> StkFloat <a class="code" href="classstk_1_1Blit.html#a530af82a27731734af4f4b58bce283de" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00097"></a>00097 StkFloat rate_;
|
||||
<a name="l00098"></a>00098 StkFloat phase_;
|
||||
<a name="l00099"></a>00099 StkFloat p_;
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 };
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a><a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717">00103</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00104"></a>00104 {
|
||||
<a name="l00105"></a>00105 <span class="comment">// The code below implements the SincM algorithm of Stilson and</span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// Smith with an additional scale factor of P / M applied to</span>
|
||||
<a name="l00107"></a>00107 <span class="comment">// normalize the output.</span>
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="comment">// A fully optimized version of this code would replace the two sin</span>
|
||||
<a name="l00110"></a>00110 <span class="comment">// calls with a pair of fast sin oscillators, for which stable fast</span>
|
||||
<a name="l00111"></a>00111 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00112"></a>00112 <span class="comment">// which favors clarity over performance, the optimization has not</span>
|
||||
<a name="l00113"></a>00113 <span class="comment">// been made here.</span>
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="comment">// Avoid a divide by zero at the sinc peak, which has a limiting</span>
|
||||
<a name="l00116"></a>00116 <span class="comment">// value of 1.0.</span>
|
||||
<a name="l00117"></a>00117 StkFloat tmp, denominator = sin( phase_ );
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">if</span> ( denominator <= std::numeric_limits<StkFloat>::epsilon() )
|
||||
<a name="l00119"></a>00119 tmp = 1.0;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">else</span> {
|
||||
<a name="l00121"></a>00121 tmp = sin( m_ * phase_ );
|
||||
<a name="l00122"></a>00122 tmp /= m_ * denominator;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 phase_ += rate_;
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">if</span> ( phase_ >= PI ) phase_ -= PI;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = tmp;
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a><a class="code" href="classstk_1_1Blit.html#a20a3634131ff890641931c1d04df19ad">00132</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00133"></a>00133 {
|
||||
<a name="l00134"></a>00134 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00135"></a>00135 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00136"></a>00136 errorString_ << <span class="stringliteral">"Blit::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00137"></a>00137 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139 <span class="preprocessor">#endif</span>
|
||||
<a name="l00140"></a>00140 <span class="preprocessor"></span>
|
||||
<a name="l00141"></a>00141 StkFloat *samples = &frames[channel];
|
||||
<a name="l00142"></a>00142 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00144"></a>00144 *samples = <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit::tick</a>();
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
104
doc/html/BlowBotl_8h-source.html
Normal file
104
doc/html/BlowBotl_8h-source.html
Normal file
@@ -0,0 +1,104 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlowBotl.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLOWBOTL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLOWBOTL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "JetTable.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1BlowBotl.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlowBotl.html" title="STK blown bottle instrument class.">BlowBotl</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1BlowBotl.html#a505b4fc32ffe974b5840163395c321c" title="Class constructor.">BlowBotl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1BlowBotl.html#dae826b0487471da1779761b0f885cb8" title="Class destructor.">~BlowBotl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#271161f45e0a706d8ccd299f9aaf2ada" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#75b679cd641bb4bae9bc4ac3021a03e3" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#926d428669edf9c87a1f88faf01550c4" title="Apply breath velocity to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#91a174c3501aafbbfe6841f6915fe4f3" title="Decrease breath velocity with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#faf3f964cbdf99eddd7af99626169c02" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#132c87a453ecf25301243dc62f57f587" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#21a4b2aaaac7afcc67b4abe5ed833bfd" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 StkFloat <a class="code" href="classstk_1_1BlowBotl.html#68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <span class="keyword">protected</span>:
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00071"></a>00071 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> resonator_;
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00073"></a>00073 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00074"></a>00074 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00076"></a>00076 StkFloat maxPressure_;
|
||||
<a name="l00077"></a>00077 StkFloat noiseGain_;
|
||||
<a name="l00078"></a>00078 StkFloat vibratoGain_;
|
||||
<a name="l00079"></a>00079 StkFloat outputGain_;
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 };
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1BlowBotl.html#68501c2422994c8dca50086b3d944119">00083</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowBotl.html#68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">BlowBotl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00084"></a>00084 {
|
||||
<a name="l00085"></a>00085 StkFloat breathPressure;
|
||||
<a name="l00086"></a>00086 StkFloat randPressure;
|
||||
<a name="l00087"></a>00087 StkFloat pressureDiff;
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="comment">// Calculate the breath pressure (envelope + vibrato)</span>
|
||||
<a name="l00090"></a>00090 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00091"></a>00091 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 pressureDiff = breathPressure - resonator_.<a class="code" href="classstk_1_1BiQuad.html#412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 randPressure = noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00096"></a>00096 randPressure *= breathPressure;
|
||||
<a name="l00097"></a>00097 randPressure *= (1.0 + pressureDiff);
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 resonator_.<a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( breathPressure + randPressure - ( jetTable_.<a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) * pressureDiff ) );
|
||||
<a name="l00100"></a>00100 lastFrame_[0] = 0.2 * outputGain_ * dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
104
doc/html/BlowBotl_8h_source.html
Normal file
104
doc/html/BlowBotl_8h_source.html
Normal file
@@ -0,0 +1,104 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlowBotl.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLOWBOTL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLOWBOTL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "JetTable.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1BlowBotl.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlowBotl.html" title="STK blown bottle instrument class.">BlowBotl</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1BlowBotl.html#aa505b4fc32ffe974b5840163395c321c" title="Class constructor.">BlowBotl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1BlowBotl.html#adae826b0487471da1779761b0f885cb8" title="Class destructor.">~BlowBotl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a271161f45e0a706d8ccd299f9aaf2ada" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a75b679cd641bb4bae9bc4ac3021a03e3" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a926d428669edf9c87a1f88faf01550c4" title="Apply breath velocity to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a91a174c3501aafbbfe6841f6915fe4f3" title="Decrease breath velocity with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#afaf3f964cbdf99eddd7af99626169c02" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a132c87a453ecf25301243dc62f57f587" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a21a4b2aaaac7afcc67b4abe5ed833bfd" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 StkFloat <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <span class="keyword">protected</span>:
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00071"></a>00071 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> resonator_;
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00073"></a>00073 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00074"></a>00074 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00076"></a>00076 StkFloat maxPressure_;
|
||||
<a name="l00077"></a>00077 StkFloat noiseGain_;
|
||||
<a name="l00078"></a>00078 StkFloat vibratoGain_;
|
||||
<a name="l00079"></a>00079 StkFloat outputGain_;
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 };
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119">00083</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">BlowBotl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00084"></a>00084 {
|
||||
<a name="l00085"></a>00085 StkFloat breathPressure;
|
||||
<a name="l00086"></a>00086 StkFloat randPressure;
|
||||
<a name="l00087"></a>00087 StkFloat pressureDiff;
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="comment">// Calculate the breath pressure (envelope + vibrato)</span>
|
||||
<a name="l00090"></a>00090 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00091"></a>00091 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 pressureDiff = breathPressure - resonator_.<a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 randPressure = noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00096"></a>00096 randPressure *= breathPressure;
|
||||
<a name="l00097"></a>00097 randPressure *= (1.0 + pressureDiff);
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 resonator_.<a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( breathPressure + randPressure - ( jetTable_.<a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) * pressureDiff ) );
|
||||
<a name="l00100"></a>00100 lastFrame_[0] = 0.2 * outputGain_ * dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
127
doc/html/BlowHole_8h-source.html
Normal file
127
doc/html/BlowHole_8h-source.html
Normal file
@@ -0,0 +1,127 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlowHole.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLOWHOLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLOWHOLE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "ReedTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00048"></a>00048 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00050"></a><a class="code" href="classstk_1_1BlowHole.html">00050</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlowHole.html" title="STK clarinet physical model with one register hole and one tonehole.">BlowHole</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00051"></a>00051 {
|
||||
<a name="l00052"></a>00052 <span class="keyword">public</span>:
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00057"></a>00057 <a class="code" href="classstk_1_1BlowHole.html#7f0aed9f79544d930c7f91dfa3e0efd9" title="Class constructor.">BlowHole</a>( StkFloat lowestFrequency );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <a class="code" href="classstk_1_1BlowHole.html#691a14023e9283d12b0105dd886fba86" title="Class destructor.">~BlowHole</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#43b829201197f2d0f0e8a72072e6798a" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#023aa77cd11c9dc3a8013242ff92f982" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#aacb152624133d82e311b9e0b8218289" title="Set the tonehole state (0.0 = closed, 1.0 = fully open).">setTonehole</a>( StkFloat newValue );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#11c8a4a8483acf0f3e73c1d00008daff" title="Set the register hole state (0.0 = closed, 1.0 = fully open).">setVent</a>( StkFloat newValue );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#1be64a601f2fbc8e9efaec5a53c55866" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#eb4dfd7d75b1996e15833c0928ed39c4" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#67e071cb26c1bba35e32f168d59b9be1" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#bc3743ac2c8a9620c44cca41ce73e5b0" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#0d8ad0201c455894acb1416ffb21614b" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090 StkFloat <a class="code" href="classstk_1_1BlowHole.html#3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="keyword">protected</span>:
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delays_[3];
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> tonehole_;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> vent_;
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00103"></a>00103 StkFloat scatter_;
|
||||
<a name="l00104"></a>00104 StkFloat thCoeff_;
|
||||
<a name="l00105"></a>00105 StkFloat rhGain_;
|
||||
<a name="l00106"></a>00106 StkFloat outputGain_;
|
||||
<a name="l00107"></a>00107 StkFloat noiseGain_;
|
||||
<a name="l00108"></a>00108 StkFloat vibratoGain_;
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 };
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a><a class="code" href="classstk_1_1BlowHole.html#3438c72b975481dae7d51f33f6f6fd94">00112</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowHole.html#3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">BlowHole :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00113"></a>00113 {
|
||||
<a name="l00114"></a>00114 StkFloat pressureDiff;
|
||||
<a name="l00115"></a>00115 StkFloat breathPressure;
|
||||
<a name="l00116"></a>00116 StkFloat temp;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00119"></a>00119 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00120"></a>00120 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00121"></a>00121 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="comment">// Calculate the differential pressure = reflected - mouthpiece pressures</span>
|
||||
<a name="l00124"></a>00124 pressureDiff = delays_[0].<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() - breathPressure;
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">// Do two-port junction scattering for register vent</span>
|
||||
<a name="l00127"></a>00127 StkFloat pa = breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff );
|
||||
<a name="l00128"></a>00128 StkFloat pb = delays_[1].<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00129"></a>00129 vent_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa+pb );
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 lastFrame_[0] = delays_[0].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( vent_.<a class="code" href="classstk_1_1PoleZero.html#03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>()+pb );
|
||||
<a name="l00132"></a>00132 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="comment">// Do three-port junction scattering (under tonehole)</span>
|
||||
<a name="l00135"></a>00135 pa += vent_.<a class="code" href="classstk_1_1PoleZero.html#03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00136"></a>00136 pb = delays_[2].<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00137"></a>00137 StkFloat pth = tonehole_.<a class="code" href="classstk_1_1PoleZero.html#03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00138"></a>00138 temp = scatter_ * (pa + pb - 2 * pth);
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 delays_[2].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>(pa + temp) * -0.95 );
|
||||
<a name="l00141"></a>00141 delays_[1].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pb + temp );
|
||||
<a name="l00142"></a>00142 tonehole_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa + pb - pth + temp );
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
127
doc/html/BlowHole_8h_source.html
Normal file
127
doc/html/BlowHole_8h_source.html
Normal file
@@ -0,0 +1,127 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlowHole.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLOWHOLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLOWHOLE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "ReedTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00048"></a>00048 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00050"></a><a class="code" href="classstk_1_1BlowHole.html">00050</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlowHole.html" title="STK clarinet physical model with one register hole and one tonehole.">BlowHole</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00051"></a>00051 {
|
||||
<a name="l00052"></a>00052 <span class="keyword">public</span>:
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00057"></a>00057 <a class="code" href="classstk_1_1BlowHole.html#a7f0aed9f79544d930c7f91dfa3e0efd9" title="Class constructor.">BlowHole</a>( StkFloat lowestFrequency );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <a class="code" href="classstk_1_1BlowHole.html#a691a14023e9283d12b0105dd886fba86" title="Class destructor.">~BlowHole</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a43b829201197f2d0f0e8a72072e6798a" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a023aa77cd11c9dc3a8013242ff92f982" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#aaacb152624133d82e311b9e0b8218289" title="Set the tonehole state (0.0 = closed, 1.0 = fully open).">setTonehole</a>( StkFloat newValue );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a11c8a4a8483acf0f3e73c1d00008daff" title="Set the register hole state (0.0 = closed, 1.0 = fully open).">setVent</a>( StkFloat newValue );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a1be64a601f2fbc8e9efaec5a53c55866" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#aeb4dfd7d75b1996e15833c0928ed39c4" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a67e071cb26c1bba35e32f168d59b9be1" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#abc3743ac2c8a9620c44cca41ce73e5b0" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a0d8ad0201c455894acb1416ffb21614b" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090 StkFloat <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="keyword">protected</span>:
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delays_[3];
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> tonehole_;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> vent_;
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00103"></a>00103 StkFloat scatter_;
|
||||
<a name="l00104"></a>00104 StkFloat thCoeff_;
|
||||
<a name="l00105"></a>00105 StkFloat rhGain_;
|
||||
<a name="l00106"></a>00106 StkFloat outputGain_;
|
||||
<a name="l00107"></a>00107 StkFloat noiseGain_;
|
||||
<a name="l00108"></a>00108 StkFloat vibratoGain_;
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 };
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a><a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94">00112</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">BlowHole :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00113"></a>00113 {
|
||||
<a name="l00114"></a>00114 StkFloat pressureDiff;
|
||||
<a name="l00115"></a>00115 StkFloat breathPressure;
|
||||
<a name="l00116"></a>00116 StkFloat temp;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00119"></a>00119 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00120"></a>00120 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00121"></a>00121 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="comment">// Calculate the differential pressure = reflected - mouthpiece pressures</span>
|
||||
<a name="l00124"></a>00124 pressureDiff = delays_[0].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() - breathPressure;
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">// Do two-port junction scattering for register vent</span>
|
||||
<a name="l00127"></a>00127 StkFloat pa = breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff );
|
||||
<a name="l00128"></a>00128 StkFloat pb = delays_[1].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00129"></a>00129 vent_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa+pb );
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 lastFrame_[0] = delays_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( vent_.<a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>()+pb );
|
||||
<a name="l00132"></a>00132 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="comment">// Do three-port junction scattering (under tonehole)</span>
|
||||
<a name="l00135"></a>00135 pa += vent_.<a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00136"></a>00136 pb = delays_[2].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00137"></a>00137 StkFloat pth = tonehole_.<a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00138"></a>00138 temp = scatter_ * (pa + pb - 2 * pth);
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 delays_[2].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>(pa + temp) * -0.95 );
|
||||
<a name="l00141"></a>00141 delays_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pb + temp );
|
||||
<a name="l00142"></a>00142 tonehole_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa + pb - pth + temp );
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
128
doc/html/BowTable_8h-source.html
Normal file
128
doc/html/BowTable_8h-source.html
Normal file
@@ -0,0 +1,128 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BowTable.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BOWTABL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BOWTABL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1BowTable.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1BowTable.html#25d0985fd6821a7e1608af1e8f51952a">00024</a> <a class="code" href="classstk_1_1BowTable.html#25d0985fd6821a7e1608af1e8f51952a" title="Default constructor.">BowTable</a>( <span class="keywordtype">void</span> ) : offset_(0.0), slope_(0.1) {};
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1BowTable.html#9adcc3c36085b73d3b877828071a3b2c">00033</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#9adcc3c36085b73d3b877828071a3b2c" title="Set the table offset value.">setOffset</a>( StkFloat offset ) { offset_ = offset; };
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1BowTable.html#d8391e46941ff9f49b78bf4f77c35143">00040</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#d8391e46941ff9f49b78bf4f77c35143" title="Set the table slope value.">setSlope</a>( StkFloat slope ) { slope_ = slope; };
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 StkFloat <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00054"></a>00054 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00065"></a>00065 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="keyword">protected</span>:
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 StkFloat offset_;
|
||||
<a name="l00070"></a>00070 StkFloat slope_;
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19">00074</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( StkFloat input )
|
||||
<a name="l00075"></a>00075 {
|
||||
<a name="l00076"></a>00076 <span class="comment">// The input represents differential string vs. bow velocity.</span>
|
||||
<a name="l00077"></a>00077 StkFloat sample = input + offset_; <span class="comment">// add bias to input</span>
|
||||
<a name="l00078"></a>00078 sample *= slope_; <span class="comment">// then scale it</span>
|
||||
<a name="l00079"></a>00079 lastFrame_[0] = (StkFloat) fabs( (<span class="keywordtype">double</span>) sample ) + (StkFloat) 0.75;
|
||||
<a name="l00080"></a>00080 lastFrame_[0] = (StkFloat) pow( lastFrame_[0], (StkFloat) -4.0 );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="comment">// Set minimum friction to 0.0</span>
|
||||
<a name="l00083"></a>00083 <span class="comment">// if ( lastFrame_[0] < 0.0 ) lastFrame_[0] = 0.0;</span>
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00085"></a>00085 <span class="comment">// Set maximum friction to 1.0.</span>
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">if</span> ( lastFrame_[0] > 1.0 ) lastFrame_[0] = (StkFloat) 1.0;
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00089"></a>00089 }
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a><a class="code" href="classstk_1_1BowTable.html#8ad2766def014b62dcbbd8765e133246">00091</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00092"></a>00092 {
|
||||
<a name="l00093"></a>00093 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00094"></a>00094 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00095"></a>00095 errorString_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
|
||||
<a name="l00099"></a>00099 <span class="preprocessor"></span>
|
||||
<a name="l00100"></a>00100 StkFloat *samples = &frames[channel];
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00103"></a>00103 *samples = *samples + offset_;
|
||||
<a name="l00104"></a>00104 *samples *= slope_;
|
||||
<a name="l00105"></a>00105 *samples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *samples ) + 0.75;
|
||||
<a name="l00106"></a>00106 *samples = (StkFloat) pow( *samples, (StkFloat) -4.0 );
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1BowTable.html#af72f823f210b18f417337ac7181cde5">00114</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00117"></a>00117 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00118"></a>00118 errorString_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00119"></a>00119 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121 <span class="preprocessor">#endif</span>
|
||||
<a name="l00122"></a>00122 <span class="preprocessor"></span>
|
||||
<a name="l00123"></a>00123 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00124"></a>00124 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00127"></a>00127 *oSamples = *iSamples + offset_;
|
||||
<a name="l00128"></a>00128 *oSamples *= slope_;
|
||||
<a name="l00129"></a>00129 *oSamples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *oSamples ) + 0.75;
|
||||
<a name="l00130"></a>00130 *oSamples = (StkFloat) pow( *oSamples, (StkFloat) -4.0 );
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
128
doc/html/BowTable_8h_source.html
Normal file
128
doc/html/BowTable_8h_source.html
Normal file
@@ -0,0 +1,128 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BowTable.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BOWTABL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BOWTABL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1BowTable.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1BowTable.html#a25d0985fd6821a7e1608af1e8f51952a">00024</a> <a class="code" href="classstk_1_1BowTable.html#a25d0985fd6821a7e1608af1e8f51952a" title="Default constructor.">BowTable</a>( <span class="keywordtype">void</span> ) : offset_(0.0), slope_(0.1) {};
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1BowTable.html#a9adcc3c36085b73d3b877828071a3b2c">00033</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#a9adcc3c36085b73d3b877828071a3b2c" title="Set the table offset value.">setOffset</a>( StkFloat offset ) { offset_ = offset; };
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1BowTable.html#ad8391e46941ff9f49b78bf4f77c35143">00040</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#ad8391e46941ff9f49b78bf4f77c35143" title="Set the table slope value.">setSlope</a>( StkFloat slope ) { slope_ = slope; };
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 StkFloat <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00054"></a>00054 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00065"></a>00065 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="keyword">protected</span>:
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 StkFloat offset_;
|
||||
<a name="l00070"></a>00070 StkFloat slope_;
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19">00074</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( StkFloat input )
|
||||
<a name="l00075"></a>00075 {
|
||||
<a name="l00076"></a>00076 <span class="comment">// The input represents differential string vs. bow velocity.</span>
|
||||
<a name="l00077"></a>00077 StkFloat sample = input + offset_; <span class="comment">// add bias to input</span>
|
||||
<a name="l00078"></a>00078 sample *= slope_; <span class="comment">// then scale it</span>
|
||||
<a name="l00079"></a>00079 lastFrame_[0] = (StkFloat) fabs( (<span class="keywordtype">double</span>) sample ) + (StkFloat) 0.75;
|
||||
<a name="l00080"></a>00080 lastFrame_[0] = (StkFloat) pow( lastFrame_[0], (StkFloat) -4.0 );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="comment">// Set minimum friction to 0.0</span>
|
||||
<a name="l00083"></a>00083 <span class="comment">// if ( lastFrame_[0] < 0.0 ) lastFrame_[0] = 0.0;</span>
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00085"></a>00085 <span class="comment">// Set maximum friction to 1.0.</span>
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">if</span> ( lastFrame_[0] > 1.0 ) lastFrame_[0] = (StkFloat) 1.0;
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00089"></a>00089 }
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a><a class="code" href="classstk_1_1BowTable.html#a8ad2766def014b62dcbbd8765e133246">00091</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00092"></a>00092 {
|
||||
<a name="l00093"></a>00093 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00094"></a>00094 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00095"></a>00095 errorString_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
|
||||
<a name="l00099"></a>00099 <span class="preprocessor"></span>
|
||||
<a name="l00100"></a>00100 StkFloat *samples = &frames[channel];
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00103"></a>00103 *samples = *samples + offset_;
|
||||
<a name="l00104"></a>00104 *samples *= slope_;
|
||||
<a name="l00105"></a>00105 *samples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *samples ) + 0.75;
|
||||
<a name="l00106"></a>00106 *samples = (StkFloat) pow( *samples, (StkFloat) -4.0 );
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1BowTable.html#aaf72f823f210b18f417337ac7181cde5">00114</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00117"></a>00117 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00118"></a>00118 errorString_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00119"></a>00119 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121 <span class="preprocessor">#endif</span>
|
||||
<a name="l00122"></a>00122 <span class="preprocessor"></span>
|
||||
<a name="l00123"></a>00123 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00124"></a>00124 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00127"></a>00127 *oSamples = *iSamples + offset_;
|
||||
<a name="l00128"></a>00128 *oSamples *= slope_;
|
||||
<a name="l00129"></a>00129 *oSamples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *oSamples ) + 0.75;
|
||||
<a name="l00130"></a>00130 *oSamples = (StkFloat) pow( *oSamples, (StkFloat) -4.0 );
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
105
doc/html/Bowed_8h-source.html
Normal file
105
doc/html/Bowed_8h-source.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Bowed.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BOWED_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BOWED_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BowTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1Bowed.html">00037</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Bowed.html" title="STK bowed string instrument class.">Bowed</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00038"></a>00038 {
|
||||
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Bowed.html#b776c34c271de25c0cd036946d764158" title="Class constructor, taking the lowest desired playing frequency.">Bowed</a>( StkFloat lowestFrequency );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1Bowed.html#8067e4808bf7576922be4698f853c96c" title="Class destructor.">~Bowed</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#8d522c36a35b86f90a06cf135fc83b11" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#02dbcfbd0766fee8a2e75a8df809e62c" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#7cf229e206a61259d381cf153a1c5096" title="Set vibrato gain.">setVibrato</a>( StkFloat gain );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#519d511ddcc1cf23e897aeacdfe45020" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#ae2a57d8e23536fd37a00af1fe07f21c" title="Decrease breath pressure with given rate of decrease.">stopBowing</a>( StkFloat rate );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#4ebaf6bd27d90975e7b0aea0ee727dc1" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#b86db568328b51e4adfae8b62987fc85" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#d066af9bb1340b6fcf9002d6922021f4" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 StkFloat <a class="code" href="classstk_1_1Bowed.html#4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 <span class="keyword">protected</span>:
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> neckDelay_;
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> bridgeDelay_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> stringFilter_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> bodyFilter_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00082"></a>00082 StkFloat maxVelocity_;
|
||||
<a name="l00083"></a>00083 StkFloat baseDelay_;
|
||||
<a name="l00084"></a>00084 StkFloat vibratoGain_;
|
||||
<a name="l00085"></a>00085 StkFloat betaRatio_;
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Bowed.html#4d583369f0b22335fff8cee3ce6f2750">00089</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Bowed.html#4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">Bowed :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 StkFloat bowVelocity = maxVelocity_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00092"></a>00092 StkFloat bridgeRefl = -stringFilter_.<a class="code" href="classstk_1_1OnePole.html#3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00093"></a>00093 StkFloat nutRefl = -neckDelay_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00094"></a>00094 StkFloat stringVel = bridgeRefl + nutRefl; <span class="comment">// Sum is string velocity</span>
|
||||
<a name="l00095"></a>00095 StkFloat velDiff = bowVelocity - stringVel; <span class="comment">// Differential velocity</span>
|
||||
<a name="l00096"></a>00096 StkFloat newVel = velDiff * bowTable_.<a class="code" href="classstk_1_1BowTable.html#8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( velDiff ); <span class="comment">// Non-Linear bow function</span>
|
||||
<a name="l00097"></a>00097 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(bridgeRefl + newVel); <span class="comment">// Do string propagations</span>
|
||||
<a name="l00098"></a>00098 bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(nutRefl + newVel);
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">if</span> ( vibratoGain_ > 0.0 ) {
|
||||
<a name="l00101"></a>00101 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( (baseDelay_ * (1.0 - betaRatio_) ) +
|
||||
<a name="l00102"></a>00102 (baseDelay_ * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>()) );
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 lastFrame_[0] = bodyFilter_.<a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
105
doc/html/Bowed_8h_source.html
Normal file
105
doc/html/Bowed_8h_source.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Bowed.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BOWED_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BOWED_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BowTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1Bowed.html">00037</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Bowed.html" title="STK bowed string instrument class.">Bowed</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00038"></a>00038 {
|
||||
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Bowed.html#ab776c34c271de25c0cd036946d764158" title="Class constructor, taking the lowest desired playing frequency.">Bowed</a>( StkFloat lowestFrequency );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1Bowed.html#a8067e4808bf7576922be4698f853c96c" title="Class destructor.">~Bowed</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a8d522c36a35b86f90a06cf135fc83b11" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a02dbcfbd0766fee8a2e75a8df809e62c" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a7cf229e206a61259d381cf153a1c5096" title="Set vibrato gain.">setVibrato</a>( StkFloat gain );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a519d511ddcc1cf23e897aeacdfe45020" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#aae2a57d8e23536fd37a00af1fe07f21c" title="Decrease breath pressure with given rate of decrease.">stopBowing</a>( StkFloat rate );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a4ebaf6bd27d90975e7b0aea0ee727dc1" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#ab86db568328b51e4adfae8b62987fc85" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#ad066af9bb1340b6fcf9002d6922021f4" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 StkFloat <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 <span class="keyword">protected</span>:
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> neckDelay_;
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> bridgeDelay_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> stringFilter_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> bodyFilter_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00082"></a>00082 StkFloat maxVelocity_;
|
||||
<a name="l00083"></a>00083 StkFloat baseDelay_;
|
||||
<a name="l00084"></a>00084 StkFloat vibratoGain_;
|
||||
<a name="l00085"></a>00085 StkFloat betaRatio_;
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750">00089</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">Bowed :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 StkFloat bowVelocity = maxVelocity_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00092"></a>00092 StkFloat bridgeRefl = -stringFilter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00093"></a>00093 StkFloat nutRefl = -neckDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00094"></a>00094 StkFloat stringVel = bridgeRefl + nutRefl; <span class="comment">// Sum is string velocity</span>
|
||||
<a name="l00095"></a>00095 StkFloat velDiff = bowVelocity - stringVel; <span class="comment">// Differential velocity</span>
|
||||
<a name="l00096"></a>00096 StkFloat newVel = velDiff * bowTable_.<a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( velDiff ); <span class="comment">// Non-Linear bow function</span>
|
||||
<a name="l00097"></a>00097 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(bridgeRefl + newVel); <span class="comment">// Do string propagations</span>
|
||||
<a name="l00098"></a>00098 bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(nutRefl + newVel);
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">if</span> ( vibratoGain_ > 0.0 ) {
|
||||
<a name="l00101"></a>00101 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( (baseDelay_ * (1.0 - betaRatio_) ) +
|
||||
<a name="l00102"></a>00102 (baseDelay_ * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>()) );
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 lastFrame_[0] = bodyFilter_.<a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
102
doc/html/Brass_8h-source.html
Normal file
102
doc/html/Brass_8h-source.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Brass.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BRASS_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BRASS_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayA.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00010"></a>00010
|
||||
<a name="l00011"></a>00011 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Brass.html">00035</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Brass.html" title="STK simple brass instrument class.">Brass</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00036"></a>00036 {
|
||||
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Brass.html#96b223221f536efdaad4e724db01f11b" title="Class constructor, taking the lowest desired playing frequency.">Brass</a>( StkFloat lowestFrequency );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Brass.html#474528a75bd4fb88cdb9c783d73df8f6" title="Class destructor.">~Brass</a>( );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#64e48334efdc8f2508c29c5ea4281f2d" title="Reset and clear all internal state.">clear</a>( );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#5e99e7fee1b92138566a46c828df93e8" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#2e1a150328504050499c5cb9fa0e536f" title="Set the lips frequency.">setLip</a>( StkFloat frequency );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#02533e02818e2848fb6480106a54ce94" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#8bf1624aca6283fafb830a3f22546199" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#e74eba698f27abd43e66e825f5ce72da" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#32e2a6d2c9285bb5cf033d8a6b90e3c9" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#4d75ac361d11fcc870a330d393dbad80" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Brass.html#4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <span class="keyword">protected</span>:
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> lipFilter_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00082"></a>00082 StkFloat lipTarget_;
|
||||
<a name="l00083"></a>00083 StkFloat slideTarget_;
|
||||
<a name="l00084"></a>00084 StkFloat vibratoGain_;
|
||||
<a name="l00085"></a>00085 StkFloat maxPressure_;
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Brass.html#4af1b7c4c1b374b65e04ccaa90886321">00089</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Brass.html#4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">Brass :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 StkFloat breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00092"></a>00092 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 StkFloat mouthPressure = 0.3 * breathPressure;
|
||||
<a name="l00095"></a>00095 StkFloat borePressure = 0.85 * delayLine_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00096"></a>00096 StkFloat deltaPressure = mouthPressure - borePressure; <span class="comment">// Differential pressure.</span>
|
||||
<a name="l00097"></a>00097 deltaPressure = lipFilter_.<a class="code" href="classstk_1_1BiQuad.html#648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( deltaPressure ); <span class="comment">// Force - > position.</span>
|
||||
<a name="l00098"></a>00098 deltaPressure *= deltaPressure; <span class="comment">// Basic position to area mapping.</span>
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">if</span> ( deltaPressure > 1.0 ) deltaPressure = 1.0; <span class="comment">// Non-linear saturation.</span>
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="comment">// The following input scattering assumes the mouthPressure = area.</span>
|
||||
<a name="l00102"></a>00102 lastFrame_[0] = deltaPressure * mouthPressure + ( 1.0 - deltaPressure) * borePressure;
|
||||
<a name="l00103"></a>00103 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( lastFrame_[0] ) );
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
102
doc/html/Brass_8h_source.html
Normal file
102
doc/html/Brass_8h_source.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Brass.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BRASS_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BRASS_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayA.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00010"></a>00010
|
||||
<a name="l00011"></a>00011 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Brass.html">00035</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Brass.html" title="STK simple brass instrument class.">Brass</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00036"></a>00036 {
|
||||
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Brass.html#a96b223221f536efdaad4e724db01f11b" title="Class constructor, taking the lowest desired playing frequency.">Brass</a>( StkFloat lowestFrequency );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Brass.html#a474528a75bd4fb88cdb9c783d73df8f6" title="Class destructor.">~Brass</a>( );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a64e48334efdc8f2508c29c5ea4281f2d" title="Reset and clear all internal state.">clear</a>( );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a5e99e7fee1b92138566a46c828df93e8" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a2e1a150328504050499c5cb9fa0e536f" title="Set the lips frequency.">setLip</a>( StkFloat frequency );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a02533e02818e2848fb6480106a54ce94" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a8bf1624aca6283fafb830a3f22546199" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#ae74eba698f27abd43e66e825f5ce72da" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a32e2a6d2c9285bb5cf033d8a6b90e3c9" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a4d75ac361d11fcc870a330d393dbad80" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <span class="keyword">protected</span>:
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> lipFilter_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00082"></a>00082 StkFloat lipTarget_;
|
||||
<a name="l00083"></a>00083 StkFloat slideTarget_;
|
||||
<a name="l00084"></a>00084 StkFloat vibratoGain_;
|
||||
<a name="l00085"></a>00085 StkFloat maxPressure_;
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321">00089</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">Brass :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 StkFloat breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00092"></a>00092 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 StkFloat mouthPressure = 0.3 * breathPressure;
|
||||
<a name="l00095"></a>00095 StkFloat borePressure = 0.85 * delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00096"></a>00096 StkFloat deltaPressure = mouthPressure - borePressure; <span class="comment">// Differential pressure.</span>
|
||||
<a name="l00097"></a>00097 deltaPressure = lipFilter_.<a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( deltaPressure ); <span class="comment">// Force - > position.</span>
|
||||
<a name="l00098"></a>00098 deltaPressure *= deltaPressure; <span class="comment">// Basic position to area mapping.</span>
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">if</span> ( deltaPressure > 1.0 ) deltaPressure = 1.0; <span class="comment">// Non-linear saturation.</span>
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="comment">// The following input scattering assumes the mouthPressure = area.</span>
|
||||
<a name="l00102"></a>00102 lastFrame_[0] = deltaPressure * mouthPressure + ( 1.0 - deltaPressure) * borePressure;
|
||||
<a name="l00103"></a>00103 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( lastFrame_[0] ) );
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
145
doc/html/Chorus_8h-source.html
Normal file
145
doc/html/Chorus_8h-source.html
Normal file
@@ -0,0 +1,145 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Chorus.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CHORUS_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CHORUS_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Chorus.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Chorus.html" title="STK chorus effect class.">Chorus</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1Chorus.html#529f668e66188ae5a42e4cc30779059f" title="Class constructor, taking the median desired delay length.">Chorus</a>( StkFloat baseDelay = 6000 );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#63acbdd04d13110712c36a5cac5d972d" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Chorus.html#cb3a55518c919dafa6c19698c1ab3389">00034</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#cb3a55518c919dafa6c19698c1ab3389" title="Set modulation depth.">setModDepth</a>( StkFloat depth ) { modDepth_ = depth; };
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#a4372095b8526d62ff9cfbdb03f21c4d" title="Set modulation frequency.">setModFrequency</a>( StkFloat frequency );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00048"></a>00048 StkFloat <a class="code" href="classstk_1_1Chorus.html#abcc110787ec3b443c21845b2f06bb3c" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_[2];
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> mods_[2];
|
||||
<a name="l00088"></a>00088 StkFloat baseLength_;
|
||||
<a name="l00089"></a>00089 StkFloat modDepth_;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 };
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a><a class="code" href="classstk_1_1Chorus.html#abcc110787ec3b443c21845b2f06bb3c">00093</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#abcc110787ec3b443c21845b2f06bb3c" title="Return the specified channel value of the last computed stereo frame.">Chorus :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00094"></a>00094 {
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00097"></a>00097 errorString_ << <span class="stringliteral">"Chorus::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00099"></a>00099 }
|
||||
<a name="l00100"></a>00100 <span class="preprocessor">#endif</span>
|
||||
<a name="l00101"></a>00101 <span class="preprocessor"></span>
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a><a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf">00105</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00106"></a>00106 {
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00109"></a>00109 errorString_ << <span class="stringliteral">"Chorus::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00110"></a>00110 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
<a name="l00113"></a>00113 <span class="preprocessor"></span>
|
||||
<a name="l00114"></a>00114 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].<a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00115"></a>00115 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].<a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00116"></a>00116 lastFrame_[0] = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00117"></a>00117 lastFrame_[1] = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1Chorus.html#ef55c6fb93a1d00498ae436868f84501">00121</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00124"></a>00124 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00125"></a>00125 errorString_ << <span class="stringliteral">"Chorus::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00126"></a>00126 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#endif</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span>
|
||||
<a name="l00130"></a>00130 StkFloat *samples = &frames[channel];
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1;
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00133"></a>00133 *samples = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00134"></a>00134 samples++;
|
||||
<a name="l00135"></a>00135 *samples = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00139"></a>00139 lastFrame_[1] = *(samples-hop+1);
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a><a class="code" href="classstk_1_1Chorus.html#bdb8802a83f6b89716316399138e3032">00143</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00144"></a>00144 {
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00147"></a>00147 errorString_ << <span class="stringliteral">"Chorus::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00148"></a>00148 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150 <span class="preprocessor">#endif</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span>
|
||||
<a name="l00152"></a>00152 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00153"></a>00153 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00154"></a>00154 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00156"></a>00156 *oSamples++ = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00157"></a>00157 *oSamples = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00161"></a>00161 lastFrame_[1] = *(oSamples-oHop+1);
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00163"></a>00163 }
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a>00167 <span class="preprocessor">#endif</span>
|
||||
<a name="l00168"></a>00168 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
145
doc/html/Chorus_8h_source.html
Normal file
145
doc/html/Chorus_8h_source.html
Normal file
@@ -0,0 +1,145 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Chorus.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CHORUS_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CHORUS_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Chorus.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Chorus.html" title="STK chorus effect class.">Chorus</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1Chorus.html#a529f668e66188ae5a42e4cc30779059f" title="Class constructor, taking the median desired delay length.">Chorus</a>( StkFloat baseDelay = 6000 );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#a63acbdd04d13110712c36a5cac5d972d" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Chorus.html#acb3a55518c919dafa6c19698c1ab3389">00034</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#acb3a55518c919dafa6c19698c1ab3389" title="Set modulation depth.">setModDepth</a>( StkFloat depth ) { modDepth_ = depth; };
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#aa4372095b8526d62ff9cfbdb03f21c4d" title="Set modulation frequency.">setModFrequency</a>( StkFloat frequency );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00048"></a>00048 StkFloat <a class="code" href="classstk_1_1Chorus.html#aabcc110787ec3b443c21845b2f06bb3c" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_[2];
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> mods_[2];
|
||||
<a name="l00088"></a>00088 StkFloat baseLength_;
|
||||
<a name="l00089"></a>00089 StkFloat modDepth_;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 };
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a><a class="code" href="classstk_1_1Chorus.html#aabcc110787ec3b443c21845b2f06bb3c">00093</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#aabcc110787ec3b443c21845b2f06bb3c" title="Return the specified channel value of the last computed stereo frame.">Chorus :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00094"></a>00094 {
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00097"></a>00097 errorString_ << <span class="stringliteral">"Chorus::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00099"></a>00099 }
|
||||
<a name="l00100"></a>00100 <span class="preprocessor">#endif</span>
|
||||
<a name="l00101"></a>00101 <span class="preprocessor"></span>
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a><a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf">00105</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00106"></a>00106 {
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00109"></a>00109 errorString_ << <span class="stringliteral">"Chorus::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00110"></a>00110 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
<a name="l00113"></a>00113 <span class="preprocessor"></span>
|
||||
<a name="l00114"></a>00114 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00115"></a>00115 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00116"></a>00116 lastFrame_[0] = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00117"></a>00117 lastFrame_[1] = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1Chorus.html#aef55c6fb93a1d00498ae436868f84501">00121</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00124"></a>00124 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00125"></a>00125 errorString_ << <span class="stringliteral">"Chorus::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00126"></a>00126 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#endif</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span>
|
||||
<a name="l00130"></a>00130 StkFloat *samples = &frames[channel];
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1;
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00133"></a>00133 *samples = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00134"></a>00134 samples++;
|
||||
<a name="l00135"></a>00135 *samples = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00139"></a>00139 lastFrame_[1] = *(samples-hop+1);
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a><a class="code" href="classstk_1_1Chorus.html#abdb8802a83f6b89716316399138e3032">00143</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00144"></a>00144 {
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00147"></a>00147 errorString_ << <span class="stringliteral">"Chorus::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00148"></a>00148 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150 <span class="preprocessor">#endif</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span>
|
||||
<a name="l00152"></a>00152 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00153"></a>00153 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00154"></a>00154 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00156"></a>00156 *oSamples++ = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00157"></a>00157 *oSamples = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00161"></a>00161 lastFrame_[1] = *(oSamples-oHop+1);
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00163"></a>00163 }
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a>00167 <span class="preprocessor">#endif</span>
|
||||
<a name="l00168"></a>00168 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/Clarinet_8h-source.html
Normal file
107
doc/html/Clarinet_8h-source.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Clarinet.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CLARINET_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CLARINET_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "ReedTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Clarinet.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Clarinet.html" title="STK clarinet physical model class.">Clarinet</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Clarinet.html#82e32a30e6d9664ac9fe748070bec23c" title="Class constructor, taking the lowest desired playing frequency.">Clarinet</a>( StkFloat lowestFrequency );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Clarinet.html#5166db9f4cf180fa189ba2e135affe34" title="Class destructor.">~Clarinet</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#7eae4377eb4178067c2dba704032a2d1" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#f7c1cda6af97908c9b81b1be0c2a896d" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#0e4d016135c3ee291f4d74e9b030caee" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#e33627365f66f30c3685dc72cd7fadce" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#35f9158176c1b654c74bdf6f1296df67" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#501413064397d1650e18edac92a98b2e" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#63582205ab940101f5f9419fc717ff78" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Clarinet.html#4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <span class="keyword">protected</span>:
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">long</span> length_;
|
||||
<a name="l00083"></a>00083 StkFloat outputGain_;
|
||||
<a name="l00084"></a>00084 StkFloat noiseGain_;
|
||||
<a name="l00085"></a>00085 StkFloat vibratoGain_;
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Clarinet.html#4cd08bca954ad434bc636eda957ca8d5">00089</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Clarinet.html#4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">Clarinet :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 StkFloat pressureDiff;
|
||||
<a name="l00092"></a>00092 StkFloat breathPressure;
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00095"></a>00095 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00096"></a>00096 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00097"></a>00097 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="comment">// Perform commuted loss filtering.</span>
|
||||
<a name="l00100"></a>00100 pressureDiff = -0.95 * filter_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( delayLine_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// Calculate pressure difference of reflected and mouthpiece pressures.</span>
|
||||
<a name="l00103"></a>00103 pressureDiff = pressureDiff - breathPressure;
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="comment">// Perform non-linear scattering using pressure difference in reed function.</span>
|
||||
<a name="l00106"></a>00106 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>(pressureDiff));
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Apply output gain.</span>
|
||||
<a name="l00109"></a>00109 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/Clarinet_8h_source.html
Normal file
107
doc/html/Clarinet_8h_source.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Clarinet.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CLARINET_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CLARINET_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "ReedTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Clarinet.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Clarinet.html" title="STK clarinet physical model class.">Clarinet</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Clarinet.html#a82e32a30e6d9664ac9fe748070bec23c" title="Class constructor, taking the lowest desired playing frequency.">Clarinet</a>( StkFloat lowestFrequency );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Clarinet.html#a5166db9f4cf180fa189ba2e135affe34" title="Class destructor.">~Clarinet</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#a7eae4377eb4178067c2dba704032a2d1" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#af7c1cda6af97908c9b81b1be0c2a896d" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#a0e4d016135c3ee291f4d74e9b030caee" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#ae33627365f66f30c3685dc72cd7fadce" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#a35f9158176c1b654c74bdf6f1296df67" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#a501413064397d1650e18edac92a98b2e" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#a63582205ab940101f5f9419fc717ff78" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <span class="keyword">protected</span>:
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">long</span> length_;
|
||||
<a name="l00083"></a>00083 StkFloat outputGain_;
|
||||
<a name="l00084"></a>00084 StkFloat noiseGain_;
|
||||
<a name="l00085"></a>00085 StkFloat vibratoGain_;
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5">00089</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">Clarinet :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 StkFloat pressureDiff;
|
||||
<a name="l00092"></a>00092 StkFloat breathPressure;
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00095"></a>00095 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00096"></a>00096 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00097"></a>00097 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="comment">// Perform commuted loss filtering.</span>
|
||||
<a name="l00100"></a>00100 pressureDiff = -0.95 * filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( delayLine_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// Calculate pressure difference of reflected and mouthpiece pressures.</span>
|
||||
<a name="l00103"></a>00103 pressureDiff = pressureDiff - breathPressure;
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="comment">// Perform non-linear scattering using pressure difference in reed function.</span>
|
||||
<a name="l00106"></a>00106 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>(pressureDiff));
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Apply output gain.</span>
|
||||
<a name="l00109"></a>00109 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
164
doc/html/DelayA_8h-source.html
Normal file
164
doc/html/DelayA_8h-source.html
Normal file
@@ -0,0 +1,164 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>DelayA.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAYA_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAYA_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1DelayA.html">00028</a> <span class="keyword">class </span><a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00029"></a>00029 {
|
||||
<a name="l00030"></a>00030 <span class="keyword">public</span>:
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1DelayA.html#9beb31f924bca961df99c1ea7789c42d" title="Default constructor creates a delay-line with maximum length of 4095 samples and...">DelayA</a>( StkFloat delay = 0.5, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1DelayA.html#b6f2ee45d350b4bb3515fcdaf25a986a" title="Class destructor.">~DelayA</a>();
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#e5e59f497eb84280fd94d60257ffae69" title="Clears all internal states of the delay line.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#b10bb5eb8316ce8b3c6667bdf4c98389" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#83ddc9bdf2f5059159160fdac0e25eda" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a><a class="code" href="classstk_1_1DelayA.html#363d9ccc50acbd1f3bb533aa1ab3d9c7">00063</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#363d9ccc50acbd1f3bb533aa1ab3d9c7" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00071"></a>00071 StkFloat <a class="code" href="classstk_1_1DelayA.html#355422e50c1d2e89385f11aafffd064d" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566">00074</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00080"></a>00080 StkFloat <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 StkFloat <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="keyword">protected</span>:
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00111"></a>00111 StkFloat delay_;
|
||||
<a name="l00112"></a>00112 StkFloat alpha_;
|
||||
<a name="l00113"></a>00113 StkFloat coeff_;
|
||||
<a name="l00114"></a>00114 StkFloat apInput_;
|
||||
<a name="l00115"></a>00115 StkFloat nextOutput_;
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00117"></a>00117 };
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a><a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314">00119</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">DelayA :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00120"></a>00120 {
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00122"></a>00122 <span class="comment">// Do allpass interpolation delay.</span>
|
||||
<a name="l00123"></a>00123 nextOutput_ = -coeff_ * lastFrame_[0];
|
||||
<a name="l00124"></a>00124 nextOutput_ += apInput_ + ( coeff_ * inputs_[outPoint_] );
|
||||
<a name="l00125"></a>00125 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a><a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74">00131</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( StkFloat input )
|
||||
<a name="l00132"></a>00132 {
|
||||
<a name="l00133"></a>00133 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00137"></a>00137 inPoint_ = 0;
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 lastFrame_[0] = <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00140"></a>00140 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="comment">// Save the allpass input and increment modulo length.</span>
|
||||
<a name="l00143"></a>00143 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00145"></a>00145 outPoint_ = 0;
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00148"></a>00148 }
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a><a class="code" href="classstk_1_1DelayA.html#57c568d56e5ed35926cfc23f83d48d98">00150</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00151"></a>00151 {
|
||||
<a name="l00152"></a>00152 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00153"></a>00153 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00154"></a>00154 errorString_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00155"></a>00155 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00156"></a>00156 }
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
<a name="l00158"></a>00158 <span class="preprocessor"></span>
|
||||
<a name="l00159"></a>00159 StkFloat *samples = &frames[channel];
|
||||
<a name="l00160"></a>00160 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00162"></a>00162 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00163"></a>00163 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00164"></a>00164 *samples = <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00165"></a>00165 lastFrame_[0] = *samples;
|
||||
<a name="l00166"></a>00166 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00167"></a>00167 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00168"></a>00168 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00169"></a>00169 }
|
||||
<a name="l00170"></a>00170
|
||||
<a name="l00171"></a>00171 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00172"></a>00172 }
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a><a class="code" href="classstk_1_1DelayA.html#94a2998c9b2d1697ed9a747973be0a89">00174</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00175"></a>00175 {
|
||||
<a name="l00176"></a>00176 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00177"></a>00177 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00178"></a>00178 errorString_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00179"></a>00179 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00180"></a>00180 }
|
||||
<a name="l00181"></a>00181 <span class="preprocessor">#endif</span>
|
||||
<a name="l00182"></a>00182 <span class="preprocessor"></span>
|
||||
<a name="l00183"></a>00183 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00184"></a>00184 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00185"></a>00185 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00186"></a>00186 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00187"></a>00187 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00189"></a>00189 *oSamples = <a class="code" href="classstk_1_1DelayA.html#08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00190"></a>00190 lastFrame_[0] = *oSamples;
|
||||
<a name="l00191"></a>00191 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00192"></a>00192 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00193"></a>00193 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00194"></a>00194 }
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a>00196 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00197"></a>00197 }
|
||||
<a name="l00198"></a>00198
|
||||
<a name="l00199"></a>00199 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00200"></a>00200
|
||||
<a name="l00201"></a>00201 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
164
doc/html/DelayA_8h_source.html
Normal file
164
doc/html/DelayA_8h_source.html
Normal file
@@ -0,0 +1,164 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>DelayA.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAYA_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAYA_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1DelayA.html">00028</a> <span class="keyword">class </span><a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00029"></a>00029 {
|
||||
<a name="l00030"></a>00030 <span class="keyword">public</span>:
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1DelayA.html#a9beb31f924bca961df99c1ea7789c42d" title="Default constructor creates a delay-line with maximum length of 4095 samples and...">DelayA</a>( StkFloat delay = 0.5, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1DelayA.html#ab6f2ee45d350b4bb3515fcdaf25a986a" title="Class destructor.">~DelayA</a>();
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#ae5e59f497eb84280fd94d60257ffae69" title="Clears all internal states of the delay line.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#ab10bb5eb8316ce8b3c6667bdf4c98389" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#a83ddc9bdf2f5059159160fdac0e25eda" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a><a class="code" href="classstk_1_1DelayA.html#a363d9ccc50acbd1f3bb533aa1ab3d9c7">00063</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#a363d9ccc50acbd1f3bb533aa1ab3d9c7" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00071"></a>00071 StkFloat <a class="code" href="classstk_1_1DelayA.html#a355422e50c1d2e89385f11aafffd064d" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566">00074</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00080"></a>00080 StkFloat <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 StkFloat <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="keyword">protected</span>:
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00111"></a>00111 StkFloat delay_;
|
||||
<a name="l00112"></a>00112 StkFloat alpha_;
|
||||
<a name="l00113"></a>00113 StkFloat coeff_;
|
||||
<a name="l00114"></a>00114 StkFloat apInput_;
|
||||
<a name="l00115"></a>00115 StkFloat nextOutput_;
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00117"></a>00117 };
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a><a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314">00119</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">DelayA :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00120"></a>00120 {
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00122"></a>00122 <span class="comment">// Do allpass interpolation delay.</span>
|
||||
<a name="l00123"></a>00123 nextOutput_ = -coeff_ * lastFrame_[0];
|
||||
<a name="l00124"></a>00124 nextOutput_ += apInput_ + ( coeff_ * inputs_[outPoint_] );
|
||||
<a name="l00125"></a>00125 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a><a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74">00131</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( StkFloat input )
|
||||
<a name="l00132"></a>00132 {
|
||||
<a name="l00133"></a>00133 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00137"></a>00137 inPoint_ = 0;
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 lastFrame_[0] = <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00140"></a>00140 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="comment">// Save the allpass input and increment modulo length.</span>
|
||||
<a name="l00143"></a>00143 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00145"></a>00145 outPoint_ = 0;
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00148"></a>00148 }
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a><a class="code" href="classstk_1_1DelayA.html#a57c568d56e5ed35926cfc23f83d48d98">00150</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00151"></a>00151 {
|
||||
<a name="l00152"></a>00152 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00153"></a>00153 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00154"></a>00154 errorString_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00155"></a>00155 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00156"></a>00156 }
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
<a name="l00158"></a>00158 <span class="preprocessor"></span>
|
||||
<a name="l00159"></a>00159 StkFloat *samples = &frames[channel];
|
||||
<a name="l00160"></a>00160 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00162"></a>00162 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00163"></a>00163 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00164"></a>00164 *samples = <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00165"></a>00165 lastFrame_[0] = *samples;
|
||||
<a name="l00166"></a>00166 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00167"></a>00167 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00168"></a>00168 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00169"></a>00169 }
|
||||
<a name="l00170"></a>00170
|
||||
<a name="l00171"></a>00171 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00172"></a>00172 }
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a><a class="code" href="classstk_1_1DelayA.html#a94a2998c9b2d1697ed9a747973be0a89">00174</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00175"></a>00175 {
|
||||
<a name="l00176"></a>00176 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00177"></a>00177 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00178"></a>00178 errorString_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00179"></a>00179 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00180"></a>00180 }
|
||||
<a name="l00181"></a>00181 <span class="preprocessor">#endif</span>
|
||||
<a name="l00182"></a>00182 <span class="preprocessor"></span>
|
||||
<a name="l00183"></a>00183 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00184"></a>00184 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00185"></a>00185 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00186"></a>00186 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00187"></a>00187 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00189"></a>00189 *oSamples = <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00190"></a>00190 lastFrame_[0] = *oSamples;
|
||||
<a name="l00191"></a>00191 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00192"></a>00192 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00193"></a>00193 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00194"></a>00194 }
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a>00196 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00197"></a>00197 }
|
||||
<a name="l00198"></a>00198
|
||||
<a name="l00199"></a>00199 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00200"></a>00200
|
||||
<a name="l00201"></a>00201 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
162
doc/html/DelayL_8h-source.html
Normal file
162
doc/html/DelayL_8h-source.html
Normal file
@@ -0,0 +1,162 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>DelayL.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAYL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAYL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1DelayL.html">00027</a> <span class="keyword">class </span><a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00028"></a>00028 {
|
||||
<a name="l00029"></a>00029 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1DelayL.html#d60f2222397e19fe524fc3b76b59b846" title="Default constructor creates a delay-line with maximum length of 4095 samples and...">DelayL</a>( StkFloat delay = 0.0, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1DelayL.html#8f9b49c7b098d9e379baf44b0c345457" title="Class destructor.">~DelayL</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#18b40806591654a9c9c32603990fce40" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a><a class="code" href="classstk_1_1DelayL.html#af2d5ef7dba47ff1fb279c327021beb0">00059</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#af2d5ef7dba47ff1fb279c327021beb0" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00067"></a>00067 StkFloat <a class="code" href="classstk_1_1DelayL.html#7a84a3a188f2de7cc05f81ad06e04874" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a><a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9">00070</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keyword">protected</span>:
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00107"></a>00107 StkFloat delay_;
|
||||
<a name="l00108"></a>00108 StkFloat alpha_;
|
||||
<a name="l00109"></a>00109 StkFloat omAlpha_;
|
||||
<a name="l00110"></a>00110 StkFloat nextOutput_;
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">DelayL :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00117"></a>00117 <span class="comment">// First 1/2 of interpolation</span>
|
||||
<a name="l00118"></a>00118 nextOutput_ = inputs_[outPoint_] * omAlpha_;
|
||||
<a name="l00119"></a>00119 <span class="comment">// Second 1/2 of interpolation</span>
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">if</span> (outPoint_+1 < inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>())
|
||||
<a name="l00121"></a>00121 nextOutput_ += inputs_[outPoint_+1] * alpha_;
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">else</span>
|
||||
<a name="l00123"></a>00123 nextOutput_ += inputs_[0] * alpha_;
|
||||
<a name="l00124"></a>00124 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a><a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f">00130</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( StkFloat input )
|
||||
<a name="l00131"></a>00131 {
|
||||
<a name="l00132"></a>00132 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00136"></a>00136 inPoint_ = 0;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 lastFrame_[0] = <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00139"></a>00139 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Increment output pointer modulo length.</span>
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00143"></a>00143 outPoint_ = 0;
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a><a class="code" href="classstk_1_1DelayL.html#cdc5d41de53c53d9d4b39ee8a46fb96c">00148</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00149"></a>00149 {
|
||||
<a name="l00150"></a>00150 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00152"></a>00152 errorString_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00153"></a>00153 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155 <span class="preprocessor">#endif</span>
|
||||
<a name="l00156"></a>00156 <span class="preprocessor"></span>
|
||||
<a name="l00157"></a>00157 StkFloat *samples = &frames[channel];
|
||||
<a name="l00158"></a>00158 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00159"></a>00159 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00160"></a>00160 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00162"></a>00162 *samples = <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00163"></a>00163 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00165"></a>00165 }
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a>00167 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00168"></a>00168 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00169"></a>00169 }
|
||||
<a name="l00170"></a>00170
|
||||
<a name="l00171"></a><a class="code" href="classstk_1_1DelayL.html#56ee486fb01fbf45d5a3dbad754a838e">00171</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00172"></a>00172 {
|
||||
<a name="l00173"></a>00173 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00174"></a>00174 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00175"></a>00175 errorString_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00176"></a>00176 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178 <span class="preprocessor">#endif</span>
|
||||
<a name="l00179"></a>00179 <span class="preprocessor"></span>
|
||||
<a name="l00180"></a>00180 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00181"></a>00181 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00182"></a>00182 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00184"></a>00184 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00185"></a>00185 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00186"></a>00186 *oSamples = <a class="code" href="classstk_1_1DelayL.html#bfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00187"></a>00187 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00189"></a>00189 }
|
||||
<a name="l00190"></a>00190
|
||||
<a name="l00191"></a>00191 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00192"></a>00192 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00193"></a>00193 }
|
||||
<a name="l00194"></a>00194
|
||||
<a name="l00195"></a>00195 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00196"></a>00196
|
||||
<a name="l00197"></a>00197 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
162
doc/html/DelayL_8h_source.html
Normal file
162
doc/html/DelayL_8h_source.html
Normal file
@@ -0,0 +1,162 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>DelayL.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAYL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAYL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1DelayL.html">00027</a> <span class="keyword">class </span><a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00028"></a>00028 {
|
||||
<a name="l00029"></a>00029 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1DelayL.html#ad60f2222397e19fe524fc3b76b59b846" title="Default constructor creates a delay-line with maximum length of 4095 samples and...">DelayL</a>( StkFloat delay = 0.0, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1DelayL.html#a8f9b49c7b098d9e379baf44b0c345457" title="Class destructor.">~DelayL</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#a18b40806591654a9c9c32603990fce40" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a><a class="code" href="classstk_1_1DelayL.html#aaf2d5ef7dba47ff1fb279c327021beb0">00059</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#aaf2d5ef7dba47ff1fb279c327021beb0" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00067"></a>00067 StkFloat <a class="code" href="classstk_1_1DelayL.html#a7a84a3a188f2de7cc05f81ad06e04874" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a><a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9">00070</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keyword">protected</span>:
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00107"></a>00107 StkFloat delay_;
|
||||
<a name="l00108"></a>00108 StkFloat alpha_;
|
||||
<a name="l00109"></a>00109 StkFloat omAlpha_;
|
||||
<a name="l00110"></a>00110 StkFloat nextOutput_;
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">DelayL :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00117"></a>00117 <span class="comment">// First 1/2 of interpolation</span>
|
||||
<a name="l00118"></a>00118 nextOutput_ = inputs_[outPoint_] * omAlpha_;
|
||||
<a name="l00119"></a>00119 <span class="comment">// Second 1/2 of interpolation</span>
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">if</span> (outPoint_+1 < inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>())
|
||||
<a name="l00121"></a>00121 nextOutput_ += inputs_[outPoint_+1] * alpha_;
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">else</span>
|
||||
<a name="l00123"></a>00123 nextOutput_ += inputs_[0] * alpha_;
|
||||
<a name="l00124"></a>00124 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a><a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f">00130</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( StkFloat input )
|
||||
<a name="l00131"></a>00131 {
|
||||
<a name="l00132"></a>00132 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00136"></a>00136 inPoint_ = 0;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 lastFrame_[0] = <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00139"></a>00139 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Increment output pointer modulo length.</span>
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00143"></a>00143 outPoint_ = 0;
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a><a class="code" href="classstk_1_1DelayL.html#acdc5d41de53c53d9d4b39ee8a46fb96c">00148</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00149"></a>00149 {
|
||||
<a name="l00150"></a>00150 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00152"></a>00152 errorString_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00153"></a>00153 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155 <span class="preprocessor">#endif</span>
|
||||
<a name="l00156"></a>00156 <span class="preprocessor"></span>
|
||||
<a name="l00157"></a>00157 StkFloat *samples = &frames[channel];
|
||||
<a name="l00158"></a>00158 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00159"></a>00159 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00160"></a>00160 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00162"></a>00162 *samples = <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00163"></a>00163 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00165"></a>00165 }
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a>00167 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00168"></a>00168 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00169"></a>00169 }
|
||||
<a name="l00170"></a>00170
|
||||
<a name="l00171"></a><a class="code" href="classstk_1_1DelayL.html#a56ee486fb01fbf45d5a3dbad754a838e">00171</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00172"></a>00172 {
|
||||
<a name="l00173"></a>00173 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00174"></a>00174 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00175"></a>00175 errorString_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00176"></a>00176 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178 <span class="preprocessor">#endif</span>
|
||||
<a name="l00179"></a>00179 <span class="preprocessor"></span>
|
||||
<a name="l00180"></a>00180 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00181"></a>00181 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00182"></a>00182 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00184"></a>00184 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00185"></a>00185 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00186"></a>00186 *oSamples = <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00187"></a>00187 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00189"></a>00189 }
|
||||
<a name="l00190"></a>00190
|
||||
<a name="l00191"></a>00191 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00192"></a>00192 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00193"></a>00193 }
|
||||
<a name="l00194"></a>00194
|
||||
<a name="l00195"></a>00195 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00196"></a>00196
|
||||
<a name="l00197"></a>00197 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
141
doc/html/Delay_8h-source.html
Normal file
141
doc/html/Delay_8h-source.html
Normal file
@@ -0,0 +1,141 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Delay.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAY_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAY_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Delay.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1Delay.html#9644532bfea44fae046e54f2509cf1ef" title="The default constructor creates a delay-line with maximum length of 4095 samples...">Delay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Delay.html#24b6ed6c7c5fc6d15935ec2a118b6b4f" title="Class destructor.">~Delay</a>();
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#0cf4c8da14bd4105eef06e35caaf1532" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#5eaeed55ea0c7b30ed66fedd6ef52fc2" title="Set the delay-line length.">setDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Delay.html#7ae307dc997ff07ff986ca5c4d287441">00056</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Delay.html#7ae307dc997ff07ff986ca5c4d287441" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00064"></a>00064 StkFloat <a class="code" href="classstk_1_1Delay.html#7d4c9c21e752f860ba683e9849d14665" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a><a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2">00067</a> StkFloat <a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Delay.html#2433e3246551f4fdf1366884cd2ae426">00073</a> StkFloat <a class="code" href="classstk_1_1Delay.html#2433e3246551f4fdf1366884cd2ae426" title="Return the value that will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_[outPoint_]; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1Delay.html#240830690cd8fa26e0604fd82c65dda1" title="Calculate and return the signal energy in the delay-line.">energy</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span>;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keyword">protected</span>:
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay_;
|
||||
<a name="l00108"></a>00108 };
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a><a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9">00110</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( StkFloat input )
|
||||
<a name="l00111"></a>00111 {
|
||||
<a name="l00112"></a>00112 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="comment">// Check for end condition</span>
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00116"></a>00116 inPoint_ = 0;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Read out next value</span>
|
||||
<a name="l00119"></a>00119 lastFrame_[0] = inputs_[outPoint_++];
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00122"></a>00122 outPoint_ = 0;
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a><a class="code" href="classstk_1_1Delay.html#93fe8e45acb933889be812f35810f977">00127</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00128"></a>00128 {
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00130"></a>00130 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00131"></a>00131 errorString_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00132"></a>00132 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="preprocessor">#endif</span>
|
||||
<a name="l00135"></a>00135 <span class="preprocessor"></span>
|
||||
<a name="l00136"></a>00136 StkFloat *samples = &frames[channel];
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00139"></a>00139 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00141"></a>00141 *samples = inputs_[outPoint_++];
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a><a class="code" href="classstk_1_1Delay.html#de0d544e45e535fd792fe70a2a22da6f">00149</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00150"></a>00150 {
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00152"></a>00152 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00153"></a>00153 errorString_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00154"></a>00154 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156 <span class="preprocessor">#endif</span>
|
||||
<a name="l00157"></a>00157 <span class="preprocessor"></span>
|
||||
<a name="l00158"></a>00158 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00159"></a>00159 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00160"></a>00160 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00162"></a>00162 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00163"></a>00163 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00164"></a>00164 *oSamples = inputs_[outPoint_++];
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00169"></a>00169 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00170"></a>00170 }
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a>00172 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a>00174 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
144
doc/html/Delay_8h_source.html
Normal file
144
doc/html/Delay_8h_source.html
Normal file
@@ -0,0 +1,144 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Delay.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAY_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAY_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Delay.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1Delay.html#a9644532bfea44fae046e54f2509cf1ef" title="The default constructor creates a delay-line with maximum length of 4095 samples...">Delay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Delay.html#a24b6ed6c7c5fc6d15935ec2a118b6b4f" title="Class destructor.">~Delay</a>();
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#a0cf4c8da14bd4105eef06e35caaf1532" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#a5eaeed55ea0c7b30ed66fedd6ef52fc2" title="Set the delay-line length.">setDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Delay.html#a7ae307dc997ff07ff986ca5c4d287441">00056</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Delay.html#a7ae307dc997ff07ff986ca5c4d287441" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00064"></a>00064 StkFloat <a class="code" href="classstk_1_1Delay.html#a7d4c9c21e752f860ba683e9849d14665" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Delay.html#aea5580dd84ea6982d1f7b92b53314118" title="Sum the provided value into the delay line at tapDelay samples from the input.">addTo</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay, StkFloat value );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2">00075</a> StkFloat <a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1Delay.html#a2433e3246551f4fdf1366884cd2ae426">00081</a> StkFloat <a class="code" href="classstk_1_1Delay.html#a2433e3246551f4fdf1366884cd2ae426" title="Return the value that will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_[outPoint_]; };
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084 StkFloat <a class="code" href="classstk_1_1Delay.html#a240830690cd8fa26e0604fd82c65dda1" title="Calculate and return the signal energy in the delay-line.">energy</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span>;
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087 StkFloat <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keyword">protected</span>:
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00115"></a>00115 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay_;
|
||||
<a name="l00116"></a>00116 };
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a><a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9">00118</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( StkFloat input )
|
||||
<a name="l00119"></a>00119 {
|
||||
<a name="l00120"></a>00120 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="comment">// Check for end condition</span>
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00124"></a>00124 inPoint_ = 0;
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">// Read out next value</span>
|
||||
<a name="l00127"></a>00127 lastFrame_[0] = inputs_[outPoint_++];
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00130"></a>00130 outPoint_ = 0;
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a><a class="code" href="classstk_1_1Delay.html#a93fe8e45acb933889be812f35810f977">00135</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00136"></a>00136 {
|
||||
<a name="l00137"></a>00137 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00138"></a>00138 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00139"></a>00139 errorString_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00140"></a>00140 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#endif</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span>
|
||||
<a name="l00144"></a>00144 StkFloat *samples = &frames[channel];
|
||||
<a name="l00145"></a>00145 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00147"></a>00147 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00149"></a>00149 *samples = inputs_[outPoint_++];
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a><a class="code" href="classstk_1_1Delay.html#ade0d544e45e535fd792fe70a2a22da6f">00157</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00158"></a>00158 {
|
||||
<a name="l00159"></a>00159 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00160"></a>00160 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00161"></a>00161 errorString_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00162"></a>00162 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00163"></a>00163 }
|
||||
<a name="l00164"></a>00164 <span class="preprocessor">#endif</span>
|
||||
<a name="l00165"></a>00165 <span class="preprocessor"></span>
|
||||
<a name="l00166"></a>00166 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00167"></a>00167 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00168"></a>00168 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00169"></a>00169 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00170"></a>00170 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00171"></a>00171 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00172"></a>00172 *oSamples = inputs_[outPoint_++];
|
||||
<a name="l00173"></a>00173 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00174"></a>00174 }
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00176"></a>00176 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00177"></a>00177 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00180"></a>00180 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
90
doc/html/Drummer_8h-source.html
Normal file
90
doc/html/Drummer_8h-source.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Drummer.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DRUMMER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DRUMMER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a>00027 <span class="keyword">const</span> <span class="keywordtype">int</span> DRUM_NUMWAVES = 11;
|
||||
<a name="l00028"></a>00028 <span class="keyword">const</span> <span class="keywordtype">int</span> DRUM_POLYPHONY = 4;
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Drummer.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Drummer.html" title="STK drum sample player class.">Drummer</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00031"></a>00031 {
|
||||
<a name="l00032"></a>00032 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Drummer.html#f5262dd2b29ae453323c0a514d79d26a" title="Class constructor.">Drummer</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Drummer.html#365fb4b2c501129f2efd6edfad1f5453" title="Class destructor.">~Drummer</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Drummer.html#5ea03a0ef9a3db02942799b5cbca2ea2" title="Start a note with the given drum type and amplitude.">noteOn</a>( StkFloat instrument, StkFloat amplitude );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Drummer.html#a735313fbdf7f1201fcb167874ecc7cc" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1Drummer.html#d65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00057"></a>00057 <span class="keyword">protected</span>:
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00059"></a>00059 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> waves_[DRUM_POLYPHONY];
|
||||
<a name="l00060"></a>00060 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filters_[DRUM_POLYPHONY];
|
||||
<a name="l00061"></a>00061 std::vector<int> soundOrder_;
|
||||
<a name="l00062"></a>00062 std::vector<int> soundNumber_;
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">int</span> nSounding_;
|
||||
<a name="l00064"></a>00064 };
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00066"></a><a class="code" href="classstk_1_1Drummer.html#d65c63bfad0ffac03db7f56cf706e4ba">00066</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Drummer.html#d65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">Drummer :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00067"></a>00067 {
|
||||
<a name="l00068"></a>00068 lastFrame_[0] = 0.0;
|
||||
<a name="l00069"></a>00069 <span class="keywordflow">if</span> ( nSounding_ == 0 ) <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<DRUM_POLYPHONY; i++ ) {
|
||||
<a name="l00072"></a>00072 <span class="keywordflow">if</span> ( soundOrder_[i] >= 0 ) {
|
||||
<a name="l00073"></a>00073 <span class="keywordflow">if</span> ( waves_[i].isFinished() ) {
|
||||
<a name="l00074"></a>00074 <span class="comment">// Re-order the list.</span>
|
||||
<a name="l00075"></a>00075 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j=0; j<DRUM_POLYPHONY; j++ ) {
|
||||
<a name="l00076"></a>00076 <span class="keywordflow">if</span> ( soundOrder_[j] > soundOrder_[i] )
|
||||
<a name="l00077"></a>00077 soundOrder_[j] -= 1;
|
||||
<a name="l00078"></a>00078 }
|
||||
<a name="l00079"></a>00079 soundOrder_[i] = -1;
|
||||
<a name="l00080"></a>00080 nSounding_--;
|
||||
<a name="l00081"></a>00081 }
|
||||
<a name="l00082"></a>00082 <span class="keywordflow">else</span>
|
||||
<a name="l00083"></a>00083 lastFrame_[0] += filters_[i].<a class="code" href="classstk_1_1OnePole.html#3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( waves_[i].<a class="code" href="classstk_1_1Drummer.html#d65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
90
doc/html/Drummer_8h_source.html
Normal file
90
doc/html/Drummer_8h_source.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Drummer.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DRUMMER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DRUMMER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a>00027 <span class="keyword">const</span> <span class="keywordtype">int</span> DRUM_NUMWAVES = 11;
|
||||
<a name="l00028"></a>00028 <span class="keyword">const</span> <span class="keywordtype">int</span> DRUM_POLYPHONY = 4;
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Drummer.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Drummer.html" title="STK drum sample player class.">Drummer</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00031"></a>00031 {
|
||||
<a name="l00032"></a>00032 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Drummer.html#af5262dd2b29ae453323c0a514d79d26a" title="Class constructor.">Drummer</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Drummer.html#a365fb4b2c501129f2efd6edfad1f5453" title="Class destructor.">~Drummer</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Drummer.html#a5ea03a0ef9a3db02942799b5cbca2ea2" title="Start a note with the given drum type and amplitude.">noteOn</a>( StkFloat instrument, StkFloat amplitude );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Drummer.html#aa735313fbdf7f1201fcb167874ecc7cc" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00057"></a>00057 <span class="keyword">protected</span>:
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00059"></a>00059 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> waves_[DRUM_POLYPHONY];
|
||||
<a name="l00060"></a>00060 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filters_[DRUM_POLYPHONY];
|
||||
<a name="l00061"></a>00061 std::vector<int> soundOrder_;
|
||||
<a name="l00062"></a>00062 std::vector<int> soundNumber_;
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">int</span> nSounding_;
|
||||
<a name="l00064"></a>00064 };
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00066"></a><a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba">00066</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">Drummer :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00067"></a>00067 {
|
||||
<a name="l00068"></a>00068 lastFrame_[0] = 0.0;
|
||||
<a name="l00069"></a>00069 <span class="keywordflow">if</span> ( nSounding_ == 0 ) <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<DRUM_POLYPHONY; i++ ) {
|
||||
<a name="l00072"></a>00072 <span class="keywordflow">if</span> ( soundOrder_[i] >= 0 ) {
|
||||
<a name="l00073"></a>00073 <span class="keywordflow">if</span> ( waves_[i].isFinished() ) {
|
||||
<a name="l00074"></a>00074 <span class="comment">// Re-order the list.</span>
|
||||
<a name="l00075"></a>00075 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j=0; j<DRUM_POLYPHONY; j++ ) {
|
||||
<a name="l00076"></a>00076 <span class="keywordflow">if</span> ( soundOrder_[j] > soundOrder_[i] )
|
||||
<a name="l00077"></a>00077 soundOrder_[j] -= 1;
|
||||
<a name="l00078"></a>00078 }
|
||||
<a name="l00079"></a>00079 soundOrder_[i] = -1;
|
||||
<a name="l00080"></a>00080 nSounding_--;
|
||||
<a name="l00081"></a>00081 }
|
||||
<a name="l00082"></a>00082 <span class="keywordflow">else</span>
|
||||
<a name="l00083"></a>00083 lastFrame_[0] += filters_[i].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( waves_[i].<a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
113
doc/html/Echo_8h-source.html
Normal file
113
doc/html/Echo_8h-source.html
Normal file
@@ -0,0 +1,113 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Echo.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ECHO_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ECHO_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00017"></a>00017 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classstk_1_1Echo.html">00019</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Echo.html" title="STK echo effect class.">Echo</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1Echo.html#5f3320986d5c9b02ad10663ff11b6505" title="Class constructor, taking the longest desired delay length (one second default value)...">Echo</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maximumDelay = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>) <a class="code" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#253e0f8e4c628b431fdfcb6d880548c2" title="Reset and clear all internal state.">clear</a>();
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#421a6f5f06f8e7df09edd179d397da7d" title="Set the maximum delay line length in samples.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#e58ea12a2864481cb7049c10810867ce" title="Set the delay line length in samples.">setDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Echo.html#00a2a5949133a06680b026db7b21cc51">00038</a> StkFloat <a class="code" href="classstk_1_1Echo.html#00a2a5949133a06680b026db7b21cc51" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 StkFloat <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00063"></a>00063 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> delayLine_;
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91">00072</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( StkFloat input )
|
||||
<a name="l00073"></a>00073 {
|
||||
<a name="l00074"></a>00074 lastFrame_[0] = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00075"></a>00075 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00076"></a>00076 }
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1Echo.html#efe863b7aa43d6a94c2a56bd31a30e7d">00078</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00079"></a>00079 {
|
||||
<a name="l00080"></a>00080 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00081"></a>00081 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00082"></a>00082 errorString_ << <span class="stringliteral">"Echo::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085 <span class="preprocessor">#endif</span>
|
||||
<a name="l00086"></a>00086 <span class="preprocessor"></span>
|
||||
<a name="l00087"></a>00087 StkFloat *samples = &frames[channel];
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00089"></a>00089 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00090"></a>00090 *samples = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00094"></a>00094 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a><a class="code" href="classstk_1_1Echo.html#1778a7da06b222afbe9281c886f678d8">00097</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00098"></a>00098 {
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00101"></a>00101 errorString_ << <span class="stringliteral">"Echo::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#endif</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span>
|
||||
<a name="l00106"></a>00106 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00107"></a>00107 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00110"></a>00110 *oSamples = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="preprocessor">#endif</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
113
doc/html/Echo_8h_source.html
Normal file
113
doc/html/Echo_8h_source.html
Normal file
@@ -0,0 +1,113 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Echo.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ECHO_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ECHO_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00017"></a>00017 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classstk_1_1Echo.html">00019</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Echo.html" title="STK echo effect class.">Echo</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1Echo.html#a5f3320986d5c9b02ad10663ff11b6505" title="Class constructor, taking the longest desired delay length (one second default value)...">Echo</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maximumDelay = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>) <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#a253e0f8e4c628b431fdfcb6d880548c2" title="Reset and clear all internal state.">clear</a>();
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#a421a6f5f06f8e7df09edd179d397da7d" title="Set the maximum delay line length in samples.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#ae58ea12a2864481cb7049c10810867ce" title="Set the delay line length in samples.">setDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Echo.html#a00a2a5949133a06680b026db7b21cc51">00038</a> StkFloat <a class="code" href="classstk_1_1Echo.html#a00a2a5949133a06680b026db7b21cc51" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 StkFloat <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00063"></a>00063 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> delayLine_;
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91">00072</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( StkFloat input )
|
||||
<a name="l00073"></a>00073 {
|
||||
<a name="l00074"></a>00074 lastFrame_[0] = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00075"></a>00075 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00076"></a>00076 }
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1Echo.html#aefe863b7aa43d6a94c2a56bd31a30e7d">00078</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00079"></a>00079 {
|
||||
<a name="l00080"></a>00080 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00081"></a>00081 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00082"></a>00082 errorString_ << <span class="stringliteral">"Echo::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085 <span class="preprocessor">#endif</span>
|
||||
<a name="l00086"></a>00086 <span class="preprocessor"></span>
|
||||
<a name="l00087"></a>00087 StkFloat *samples = &frames[channel];
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00089"></a>00089 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00090"></a>00090 *samples = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00094"></a>00094 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a><a class="code" href="classstk_1_1Echo.html#a1778a7da06b222afbe9281c886f678d8">00097</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00098"></a>00098 {
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00101"></a>00101 errorString_ << <span class="stringliteral">"Echo::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#endif</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span>
|
||||
<a name="l00106"></a>00106 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00107"></a>00107 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00110"></a>00110 *oSamples = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="preprocessor">#endif</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
89
doc/html/Effect_8h-source.html
Normal file
89
doc/html/Effect_8h-source.html
Normal file
@@ -0,0 +1,89 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Effect.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_EFFECT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_EFFECT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Effect.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Effect.html#f6eb27819aed132dd1edf2ce9640893e">00025</a> <a class="code" href="classstk_1_1Effect.html#f6eb27819aed132dd1edf2ce9640893e" title="Class constructor.">Effect</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Effect.html#bfdef9ce644c251607acfd183e3d7f7b">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Effect.html#bfdef9ce644c251607acfd183e3d7f7b" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Effect.html#3d7e2b8942bf7adcc71dfc6dccbb7aa0">00031</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Effect.html#3d7e2b8942bf7adcc71dfc6dccbb7aa0" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#0598128d1edc97729951310cc5df5171" title="Reset and clear all internal state.">clear</a>() = 0;
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#b4facbc9b317f18c139577e52fd69c3d" title="Set the mixture of input and &quot;effected&quot; levels in the output (0.0 = input...">setEffectMix</a>( StkFloat mix );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a>00039 <span class="keyword">protected</span>:
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00041"></a>00041 <span class="comment">// Returns true if argument value is prime.</span>
|
||||
<a name="l00042"></a>00042 <span class="keywordtype">bool</span> isPrime( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> number );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00045"></a>00045 StkFloat effectMix_;
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00047"></a>00047 };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1Effect.html#b4facbc9b317f18c139577e52fd69c3d">00049</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#b4facbc9b317f18c139577e52fd69c3d" title="Set the mixture of input and &quot;effected&quot; levels in the output (0.0 = input...">Effect :: setEffectMix</a>( StkFloat mix )
|
||||
<a name="l00050"></a>00050 {
|
||||
<a name="l00051"></a>00051 <span class="keywordflow">if</span> ( mix < 0.0 ) {
|
||||
<a name="l00052"></a>00052 errorString_ << <span class="stringliteral">"Effect::setEffectMix: mix parameter is less than zero ... setting to zero!"</span>;
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00054"></a>00054 effectMix_ = 0.0;
|
||||
<a name="l00055"></a>00055 }
|
||||
<a name="l00056"></a>00056 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( mix > 1.0 ) {
|
||||
<a name="l00057"></a>00057 errorString_ << <span class="stringliteral">"Effect::setEffectMix: mix parameter is greater than 1.0 ... setting to one!"</span>;
|
||||
<a name="l00058"></a>00058 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00059"></a>00059 effectMix_ = 1.0;
|
||||
<a name="l00060"></a>00060 }
|
||||
<a name="l00061"></a>00061 <span class="keywordflow">else</span>
|
||||
<a name="l00062"></a>00062 effectMix_ = mix;
|
||||
<a name="l00063"></a>00063 }
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">inline</span> <span class="keywordtype">bool</span> Effect :: isPrime( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> number )
|
||||
<a name="l00066"></a>00066 {
|
||||
<a name="l00067"></a>00067 <span class="keywordflow">if</span> ( number == 2 ) <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
||||
<a name="l00068"></a>00068 <span class="keywordflow">if</span> ( number & 1 ) {
|
||||
<a name="l00069"></a>00069 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=3; i<(int)sqrt((<span class="keywordtype">double</span>)number)+1; i+=2 )
|
||||
<a name="l00070"></a>00070 <span class="keywordflow">if</span> ( (number % i) == 0 ) <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||
<a name="l00071"></a>00071 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// prime</span>
|
||||
<a name="l00072"></a>00072 }
|
||||
<a name="l00073"></a>00073 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// even</span>
|
||||
<a name="l00074"></a>00074 }
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="preprocessor">#endif</span>
|
||||
<a name="l00079"></a>00079 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
89
doc/html/Effect_8h_source.html
Normal file
89
doc/html/Effect_8h_source.html
Normal file
@@ -0,0 +1,89 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Effect.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_EFFECT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_EFFECT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Effect.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Effect.html#af6eb27819aed132dd1edf2ce9640893e">00025</a> <a class="code" href="classstk_1_1Effect.html#af6eb27819aed132dd1edf2ce9640893e" title="Class constructor.">Effect</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Effect.html#abfdef9ce644c251607acfd183e3d7f7b">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Effect.html#abfdef9ce644c251607acfd183e3d7f7b" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Effect.html#a3d7e2b8942bf7adcc71dfc6dccbb7aa0">00031</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Effect.html#a3d7e2b8942bf7adcc71dfc6dccbb7aa0" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#a0598128d1edc97729951310cc5df5171" title="Reset and clear all internal state.">clear</a>() = 0;
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#ab4facbc9b317f18c139577e52fd69c3d" title="Set the mixture of input and &quot;effected&quot; levels in the output (0.0 = input...">setEffectMix</a>( StkFloat mix );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a>00039 <span class="keyword">protected</span>:
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00041"></a>00041 <span class="comment">// Returns true if argument value is prime.</span>
|
||||
<a name="l00042"></a>00042 <span class="keywordtype">bool</span> isPrime( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> number );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00045"></a>00045 StkFloat effectMix_;
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00047"></a>00047 };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1Effect.html#ab4facbc9b317f18c139577e52fd69c3d">00049</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#ab4facbc9b317f18c139577e52fd69c3d" title="Set the mixture of input and &quot;effected&quot; levels in the output (0.0 = input...">Effect :: setEffectMix</a>( StkFloat mix )
|
||||
<a name="l00050"></a>00050 {
|
||||
<a name="l00051"></a>00051 <span class="keywordflow">if</span> ( mix < 0.0 ) {
|
||||
<a name="l00052"></a>00052 errorString_ << <span class="stringliteral">"Effect::setEffectMix: mix parameter is less than zero ... setting to zero!"</span>;
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00054"></a>00054 effectMix_ = 0.0;
|
||||
<a name="l00055"></a>00055 }
|
||||
<a name="l00056"></a>00056 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( mix > 1.0 ) {
|
||||
<a name="l00057"></a>00057 errorString_ << <span class="stringliteral">"Effect::setEffectMix: mix parameter is greater than 1.0 ... setting to one!"</span>;
|
||||
<a name="l00058"></a>00058 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00059"></a>00059 effectMix_ = 1.0;
|
||||
<a name="l00060"></a>00060 }
|
||||
<a name="l00061"></a>00061 <span class="keywordflow">else</span>
|
||||
<a name="l00062"></a>00062 effectMix_ = mix;
|
||||
<a name="l00063"></a>00063 }
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">inline</span> <span class="keywordtype">bool</span> Effect :: isPrime( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> number )
|
||||
<a name="l00066"></a>00066 {
|
||||
<a name="l00067"></a>00067 <span class="keywordflow">if</span> ( number == 2 ) <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
||||
<a name="l00068"></a>00068 <span class="keywordflow">if</span> ( number & 1 ) {
|
||||
<a name="l00069"></a>00069 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=3; i<(int)sqrt((<span class="keywordtype">double</span>)number)+1; i+=2 )
|
||||
<a name="l00070"></a>00070 <span class="keywordflow">if</span> ( (number % i) == 0 ) <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||
<a name="l00071"></a>00071 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// prime</span>
|
||||
<a name="l00072"></a>00072 }
|
||||
<a name="l00073"></a>00073 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// even</span>
|
||||
<a name="l00074"></a>00074 }
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="preprocessor">#endif</span>
|
||||
<a name="l00079"></a>00079 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
157
doc/html/Envelope_8h-source.html
Normal file
157
doc/html/Envelope_8h-source.html
Normal file
@@ -0,0 +1,157 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Envelope.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ENVELOPE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ENVELOPE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Envelope.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1Envelope.html#86ea29237a8d94c109388654703a0039" title="Default constructor.">Envelope</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1Envelope.html#64365d24b6cdd3ea3bdcaa1abcbcb60a" title="Class destructor.">~Envelope</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a>& <a class="code" href="classstk_1_1Envelope.html#42a1acf6a4606163056ad7d4122d2281" title="Assignment operator.">operator= </a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a>& e );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Envelope.html#18cf8f21ef70227bd5cd17f53752bd0f">00035</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#18cf8f21ef70227bd5cd17f53752bd0f" title="Set target = 1.">keyOn</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( 1.0 ); };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Envelope.html#9dbefb15f8d64aac3969f77d38791774">00038</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#9dbefb15f8d64aac3969f77d38791774" title="Set target = 0.">keyOff</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( 0.0 ); };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#de99b5c7cb974f71f1d2919868d774a0" title="Set the rate.">setRate</a>( StkFloat rate );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#deeb1676f9111980a0c1a48a6780c8f7" title="Set the rate based on a time duration.">setTime</a>( StkFloat time );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#b8164a90c57616dc8bd55a6e5ba02fb6" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a><a class="code" href="classstk_1_1Envelope.html#ddb2084add959a65733805bc2c1c39a9">00053</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Envelope.html#ddb2084add959a65733805bc2c1c39a9" title="Return the current envelope state (0 = at target, 1 otherwise).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Envelope.html#31044eab6eaf668ba7e74ea17bed109d">00056</a> StkFloat <a class="code" href="classstk_1_1Envelope.html#31044eab6eaf668ba7e74ea17bed109d" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 StkFloat <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <span class="keyword">protected</span>:
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 StkFloat value_;
|
||||
<a name="l00076"></a>00076 StkFloat target_;
|
||||
<a name="l00077"></a>00077 StkFloat rate_;
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00079"></a>00079 };
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1Envelope.html#de99b5c7cb974f71f1d2919868d774a0">00081</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#de99b5c7cb974f71f1d2919868d774a0" title="Set the rate.">Envelope :: setRate</a>( StkFloat rate )
|
||||
<a name="l00082"></a>00082 {
|
||||
<a name="l00083"></a>00083 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00084"></a>00084 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( rate < 0.0 ) {
|
||||
<a name="l00085"></a>00085 errorString_ << <span class="stringliteral">"Envelope::setRate: negative rates not allowed ... correcting!"</span>;
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00087"></a>00087 rate_ = -rate;
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089 <span class="keywordflow">else</span>
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#endif</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span> rate_ = rate;
|
||||
<a name="l00092"></a>00092 }
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a><a class="code" href="classstk_1_1Envelope.html#deeb1676f9111980a0c1a48a6780c8f7">00094</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#deeb1676f9111980a0c1a48a6780c8f7" title="Set the rate based on a time duration.">Envelope :: setTime</a>( StkFloat time )
|
||||
<a name="l00095"></a>00095 {
|
||||
<a name="l00096"></a>00096 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00097"></a>00097 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( time < 0.0 ) {
|
||||
<a name="l00098"></a>00098 errorString_ << <span class="stringliteral">"Envelope::setTime: negative times not allowed ... correcting!"</span>;
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00100"></a>00100 rate_ = 1.0 / ( -time * <a class="code" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00101"></a>00101 }
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">else</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor">#endif</span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor"></span> rate_ = 1.0 / ( time * <a class="code" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a><a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e">00107</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">Envelope :: setTarget</a>( StkFloat target )
|
||||
<a name="l00108"></a>00108 {
|
||||
<a name="l00109"></a>00109 target_ = target;
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( value_ != target_ ) state_ = 1;
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a><a class="code" href="classstk_1_1Envelope.html#b8164a90c57616dc8bd55a6e5ba02fb6">00113</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#b8164a90c57616dc8bd55a6e5ba02fb6" title="Set current and target values to value.">Envelope :: setValue</a>( StkFloat value )
|
||||
<a name="l00114"></a>00114 {
|
||||
<a name="l00115"></a>00115 state_ = 0;
|
||||
<a name="l00116"></a>00116 target_ = value;
|
||||
<a name="l00117"></a>00117 value_ = value;
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a><a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601">00120</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">Envelope :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00121"></a>00121 {
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00124"></a>00124 value_ += rate_;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00126"></a>00126 value_ = target_;
|
||||
<a name="l00127"></a>00127 state_ = 0;
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">else</span> {
|
||||
<a name="l00131"></a>00131 value_ -= rate_;
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">if</span> ( value_ <= target_ ) {
|
||||
<a name="l00133"></a>00133 value_ = target_;
|
||||
<a name="l00134"></a>00134 state_ = 0;
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 lastFrame_[0] = value_;
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a><a class="code" href="classstk_1_1Envelope.html#9341c9dea4fd54c360a4a23254319cf7">00143</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">Envelope :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00144"></a>00144 {
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00147"></a>00147 errorString_ << <span class="stringliteral">"Envelope::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00148"></a>00148 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150 <span class="preprocessor">#endif</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span>
|
||||
<a name="l00152"></a>00152 StkFloat *samples = &frames[channel];
|
||||
<a name="l00153"></a>00153 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00155"></a>00155 *samples = <a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
157
doc/html/Envelope_8h_source.html
Normal file
157
doc/html/Envelope_8h_source.html
Normal file
@@ -0,0 +1,157 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Envelope.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ENVELOPE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ENVELOPE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Envelope.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1Envelope.html#a86ea29237a8d94c109388654703a0039" title="Default constructor.">Envelope</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1Envelope.html#a64365d24b6cdd3ea3bdcaa1abcbcb60a" title="Class destructor.">~Envelope</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a>& <a class="code" href="classstk_1_1Envelope.html#a42a1acf6a4606163056ad7d4122d2281" title="Assignment operator.">operator= </a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a>& e );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Envelope.html#a18cf8f21ef70227bd5cd17f53752bd0f">00035</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a18cf8f21ef70227bd5cd17f53752bd0f" title="Set target = 1.">keyOn</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( 1.0 ); };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Envelope.html#a9dbefb15f8d64aac3969f77d38791774">00038</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a9dbefb15f8d64aac3969f77d38791774" title="Set target = 0.">keyOff</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( 0.0 ); };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#ade99b5c7cb974f71f1d2919868d774a0" title="Set the rate.">setRate</a>( StkFloat rate );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#adeeb1676f9111980a0c1a48a6780c8f7" title="Set the rate based on a time duration.">setTime</a>( StkFloat time );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#ab8164a90c57616dc8bd55a6e5ba02fb6" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a><a class="code" href="classstk_1_1Envelope.html#addb2084add959a65733805bc2c1c39a9">00053</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Envelope.html#addb2084add959a65733805bc2c1c39a9" title="Return the current envelope state (0 = at target, 1 otherwise).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Envelope.html#a31044eab6eaf668ba7e74ea17bed109d">00056</a> StkFloat <a class="code" href="classstk_1_1Envelope.html#a31044eab6eaf668ba7e74ea17bed109d" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 StkFloat <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <span class="keyword">protected</span>:
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 StkFloat value_;
|
||||
<a name="l00076"></a>00076 StkFloat target_;
|
||||
<a name="l00077"></a>00077 StkFloat rate_;
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00079"></a>00079 };
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1Envelope.html#ade99b5c7cb974f71f1d2919868d774a0">00081</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#ade99b5c7cb974f71f1d2919868d774a0" title="Set the rate.">Envelope :: setRate</a>( StkFloat rate )
|
||||
<a name="l00082"></a>00082 {
|
||||
<a name="l00083"></a>00083 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00084"></a>00084 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( rate < 0.0 ) {
|
||||
<a name="l00085"></a>00085 errorString_ << <span class="stringliteral">"Envelope::setRate: negative rates not allowed ... correcting!"</span>;
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00087"></a>00087 rate_ = -rate;
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089 <span class="keywordflow">else</span>
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#endif</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span> rate_ = rate;
|
||||
<a name="l00092"></a>00092 }
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a><a class="code" href="classstk_1_1Envelope.html#adeeb1676f9111980a0c1a48a6780c8f7">00094</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#adeeb1676f9111980a0c1a48a6780c8f7" title="Set the rate based on a time duration.">Envelope :: setTime</a>( StkFloat time )
|
||||
<a name="l00095"></a>00095 {
|
||||
<a name="l00096"></a>00096 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00097"></a>00097 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( time < 0.0 ) {
|
||||
<a name="l00098"></a>00098 errorString_ << <span class="stringliteral">"Envelope::setTime: negative times not allowed ... correcting!"</span>;
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00100"></a>00100 rate_ = 1.0 / ( -time * <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00101"></a>00101 }
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">else</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor">#endif</span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor"></span> rate_ = 1.0 / ( time * <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a><a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e">00107</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">Envelope :: setTarget</a>( StkFloat target )
|
||||
<a name="l00108"></a>00108 {
|
||||
<a name="l00109"></a>00109 target_ = target;
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( value_ != target_ ) state_ = 1;
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a><a class="code" href="classstk_1_1Envelope.html#ab8164a90c57616dc8bd55a6e5ba02fb6">00113</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#ab8164a90c57616dc8bd55a6e5ba02fb6" title="Set current and target values to value.">Envelope :: setValue</a>( StkFloat value )
|
||||
<a name="l00114"></a>00114 {
|
||||
<a name="l00115"></a>00115 state_ = 0;
|
||||
<a name="l00116"></a>00116 target_ = value;
|
||||
<a name="l00117"></a>00117 value_ = value;
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a><a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601">00120</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">Envelope :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00121"></a>00121 {
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00124"></a>00124 value_ += rate_;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00126"></a>00126 value_ = target_;
|
||||
<a name="l00127"></a>00127 state_ = 0;
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">else</span> {
|
||||
<a name="l00131"></a>00131 value_ -= rate_;
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">if</span> ( value_ <= target_ ) {
|
||||
<a name="l00133"></a>00133 value_ = target_;
|
||||
<a name="l00134"></a>00134 state_ = 0;
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 lastFrame_[0] = value_;
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a><a class="code" href="classstk_1_1Envelope.html#a9341c9dea4fd54c360a4a23254319cf7">00143</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">Envelope :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00144"></a>00144 {
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00147"></a>00147 errorString_ << <span class="stringliteral">"Envelope::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00148"></a>00148 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150 <span class="preprocessor">#endif</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span>
|
||||
<a name="l00152"></a>00152 StkFloat *samples = &frames[channel];
|
||||
<a name="l00153"></a>00153 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00155"></a>00155 *samples = <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
85
doc/html/FMVoices_8h-source.html
Normal file
85
doc/html/FMVoices_8h-source.html
Normal file
@@ -0,0 +1,85 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FMVoices.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FMVOICES_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FMVOICES_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1FMVoices.html">00040</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FMVoices.html" title="STK singing FM synthesis instrument.">FMVoices</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
||||
<a name="l00041"></a>00041 {
|
||||
<a name="l00042"></a>00042 <span class="keyword">public</span>:
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1FMVoices.html#27d5570c83cad660a53f04d86d01c888" title="Class constructor.">FMVoices</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1FMVoices.html#8ff218d379ec020a38e1bc7203409e37" title="Class destructor.">~FMVoices</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#f47a92f6892f3a5bef5226d4772fc8cb" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#f2fd5dd9af61db94ff1cb556e8e5cf4c" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#24e17888ff4e01edff96d81461d670a8" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 StkFloat <a class="code" href="classstk_1_1FMVoices.html#31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 <span class="keyword">protected</span>:
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">int</span> currentVowel_;
|
||||
<a name="l00067"></a>00067 StkFloat tilt_[3];
|
||||
<a name="l00068"></a>00068 StkFloat mods_[3];
|
||||
<a name="l00069"></a>00069 };
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1FMVoices.html#31111029e36d00230586250df7b4d887">00071</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FMVoices.html#31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">FMVoices :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00072"></a>00072 {
|
||||
<a name="l00073"></a>00073 <span class="keyword">register</span> StkFloat temp, temp2;
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00076"></a>00076 temp2 = vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.1;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[0]);
|
||||
<a name="l00079"></a>00079 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[1]);
|
||||
<a name="l00080"></a>00080 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[2]);
|
||||
<a name="l00081"></a>00081 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[3]);
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 waves_[0]->addPhaseOffset(temp * mods_[0]);
|
||||
<a name="l00084"></a>00084 waves_[1]->addPhaseOffset(temp * mods_[1]);
|
||||
<a name="l00085"></a>00085 waves_[2]->addPhaseOffset(temp * mods_[2]);
|
||||
<a name="l00086"></a>00086 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#e9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00087"></a>00087 twozero_.<a class="code" href="classstk_1_1TwoZero.html#cf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00088"></a>00088 temp = gains_[0] * tilt_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00089"></a>00089 temp += gains_[1] * tilt_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00090"></a>00090 temp += gains_[2] * tilt_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 lastFrame_[0] = temp * 0.33;
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
85
doc/html/FMVoices_8h_source.html
Normal file
85
doc/html/FMVoices_8h_source.html
Normal file
@@ -0,0 +1,85 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FMVoices.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FMVOICES_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FMVOICES_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1FMVoices.html">00040</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FMVoices.html" title="STK singing FM synthesis instrument.">FMVoices</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
||||
<a name="l00041"></a>00041 {
|
||||
<a name="l00042"></a>00042 <span class="keyword">public</span>:
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1FMVoices.html#a27d5570c83cad660a53f04d86d01c888" title="Class constructor.">FMVoices</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1FMVoices.html#a8ff218d379ec020a38e1bc7203409e37" title="Class destructor.">~FMVoices</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#af47a92f6892f3a5bef5226d4772fc8cb" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#af2fd5dd9af61db94ff1cb556e8e5cf4c" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#a24e17888ff4e01edff96d81461d670a8" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 StkFloat <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 <span class="keyword">protected</span>:
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">int</span> currentVowel_;
|
||||
<a name="l00067"></a>00067 StkFloat tilt_[3];
|
||||
<a name="l00068"></a>00068 StkFloat mods_[3];
|
||||
<a name="l00069"></a>00069 };
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887">00071</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">FMVoices :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00072"></a>00072 {
|
||||
<a name="l00073"></a>00073 <span class="keyword">register</span> StkFloat temp, temp2;
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00076"></a>00076 temp2 = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.1;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[0]);
|
||||
<a name="l00079"></a>00079 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[1]);
|
||||
<a name="l00080"></a>00080 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[2]);
|
||||
<a name="l00081"></a>00081 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[3]);
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 waves_[0]->addPhaseOffset(temp * mods_[0]);
|
||||
<a name="l00084"></a>00084 waves_[1]->addPhaseOffset(temp * mods_[1]);
|
||||
<a name="l00085"></a>00085 waves_[2]->addPhaseOffset(temp * mods_[2]);
|
||||
<a name="l00086"></a>00086 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00087"></a>00087 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00088"></a>00088 temp = gains_[0] * tilt_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00089"></a>00089 temp += gains_[1] * tilt_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00090"></a>00090 temp += gains_[2] * tilt_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 lastFrame_[0] = temp * 0.33;
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
96
doc/html/FM_8h-source.html
Normal file
96
doc/html/FM_8h-source.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FM.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FM_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FM_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "FileLoop.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "TwoZero.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1FM.html">00037</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00038"></a>00038 {
|
||||
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FM.html#f4732c22ce00743e1f751880fa07aa15" title="Class constructor, taking the number of wave/envelope operators to control.">FM</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> operators = 4 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FM.html#aba7e8bff02d105e146f8b62b20a27b9" title="Class destructor.">~FM</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#c5697f9929afd43379e8720f2f271b2d" title="Reset and clear all wave and envelope states.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#0a32c8327e842bb71ce945024d583941" title="Load the rawwave filenames in waves.">loadWaves</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> **filenames );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#8182c605d51ec623f90f4e07c2b90891" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#58f0898b677750a259036f628ec1a91b" title="Set the frequency ratio for the specified wave.">setRatio</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat ratio );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#65a8c54556f0c288871876ffad4d9eef" title="Set the gain for the specified wave.">setGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat gain );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a><a class="code" href="classstk_1_1FM.html#33e5d60131014a12a435c0ef20d104b6">00065</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#33e5d60131014a12a435c0ef20d104b6" title="Set the modulation speed in Hz.">setModulationSpeed</a>( StkFloat mSpeed ) { vibrato_.<a class="code" href="classstk_1_1SineWave.html#1047a43714bc2e40c7e31e8f7e34adbc" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( mSpeed ); };
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a><a class="code" href="classstk_1_1FM.html#11584256f23153551bc13b59518b415a">00068</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#11584256f23153551bc13b59518b415a" title="Set the modulation depth.">setModulationDepth</a>( StkFloat mDepth ) { modDepth_ = mDepth; };
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1FM.html#0425269a8fc0cc6bb7471d65b54b8a1a">00071</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#0425269a8fc0cc6bb7471d65b54b8a1a" title="Set the value of control1.">setControl1</a>( StkFloat cVal ) { control1_ = cVal * 2.0; };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1FM.html#d7e7d7067c8893040ef3bdf8a1fbe9ca">00074</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#d7e7d7067c8893040ef3bdf8a1fbe9ca" title="Set the value of control1.">setControl2</a>( StkFloat cVal ) { control2_ = cVal * 2.0; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#fc46280177d770404919f20ccf88e4ff" title="Start envelopes toward &quot;on&quot; targets.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#7235e94a153df135330a591511269f7c" title="Start envelopes toward &quot;off&quot; targets.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#56cc61b1923dba2ff80859df4904d4f9" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#1db9d177363fb7d8dedb20fa0c9104f1" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FM.html#81f351fd8732fd6e686735b7b45a4241" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ) = 0;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 std::vector<ADSR *> adsr_;
|
||||
<a name="l00094"></a>00094 std::vector<FileLoop *> waves_;
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1TwoZero.html" title="STK two-zero filter class.">TwoZero</a> twozero_;
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nOperators_;
|
||||
<a name="l00098"></a>00098 StkFloat baseFrequency_;
|
||||
<a name="l00099"></a>00099 std::vector<StkFloat> ratios_;
|
||||
<a name="l00100"></a>00100 std::vector<StkFloat> gains_;
|
||||
<a name="l00101"></a>00101 StkFloat modDepth_;
|
||||
<a name="l00102"></a>00102 StkFloat control1_;
|
||||
<a name="l00103"></a>00103 StkFloat control2_;
|
||||
<a name="l00104"></a>00104 StkFloat fmGains_[100];
|
||||
<a name="l00105"></a>00105 StkFloat fmSusLevels_[16];
|
||||
<a name="l00106"></a>00106 StkFloat fmAttTimes_[32];
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 };
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
96
doc/html/FM_8h_source.html
Normal file
96
doc/html/FM_8h_source.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FM.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FM_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FM_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "FileLoop.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "TwoZero.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1FM.html">00037</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00038"></a>00038 {
|
||||
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FM.html#af4732c22ce00743e1f751880fa07aa15" title="Class constructor, taking the number of wave/envelope operators to control.">FM</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> operators = 4 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FM.html#aaba7e8bff02d105e146f8b62b20a27b9" title="Class destructor.">~FM</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#ac5697f9929afd43379e8720f2f271b2d" title="Reset and clear all wave and envelope states.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a0a32c8327e842bb71ce945024d583941" title="Load the rawwave filenames in waves.">loadWaves</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> **filenames );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a8182c605d51ec623f90f4e07c2b90891" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a58f0898b677750a259036f628ec1a91b" title="Set the frequency ratio for the specified wave.">setRatio</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat ratio );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a65a8c54556f0c288871876ffad4d9eef" title="Set the gain for the specified wave.">setGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat gain );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a><a class="code" href="classstk_1_1FM.html#a33e5d60131014a12a435c0ef20d104b6">00065</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a33e5d60131014a12a435c0ef20d104b6" title="Set the modulation speed in Hz.">setModulationSpeed</a>( StkFloat mSpeed ) { vibrato_.<a class="code" href="classstk_1_1SineWave.html#a1047a43714bc2e40c7e31e8f7e34adbc" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( mSpeed ); };
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a><a class="code" href="classstk_1_1FM.html#a11584256f23153551bc13b59518b415a">00068</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a11584256f23153551bc13b59518b415a" title="Set the modulation depth.">setModulationDepth</a>( StkFloat mDepth ) { modDepth_ = mDepth; };
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1FM.html#a0425269a8fc0cc6bb7471d65b54b8a1a">00071</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a0425269a8fc0cc6bb7471d65b54b8a1a" title="Set the value of control1.">setControl1</a>( StkFloat cVal ) { control1_ = cVal * 2.0; };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1FM.html#ad7e7d7067c8893040ef3bdf8a1fbe9ca">00074</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#ad7e7d7067c8893040ef3bdf8a1fbe9ca" title="Set the value of control1.">setControl2</a>( StkFloat cVal ) { control2_ = cVal * 2.0; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#afc46280177d770404919f20ccf88e4ff" title="Start envelopes toward &quot;on&quot; targets.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a7235e94a153df135330a591511269f7c" title="Start envelopes toward &quot;off&quot; targets.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a56cc61b1923dba2ff80859df4904d4f9" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a1db9d177363fb7d8dedb20fa0c9104f1" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FM.html#a81f351fd8732fd6e686735b7b45a4241" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ) = 0;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 std::vector<ADSR *> adsr_;
|
||||
<a name="l00094"></a>00094 std::vector<FileLoop *> waves_;
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1TwoZero.html" title="STK two-zero filter class.">TwoZero</a> twozero_;
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nOperators_;
|
||||
<a name="l00098"></a>00098 StkFloat baseFrequency_;
|
||||
<a name="l00099"></a>00099 std::vector<StkFloat> ratios_;
|
||||
<a name="l00100"></a>00100 std::vector<StkFloat> gains_;
|
||||
<a name="l00101"></a>00101 StkFloat modDepth_;
|
||||
<a name="l00102"></a>00102 StkFloat control1_;
|
||||
<a name="l00103"></a>00103 StkFloat control2_;
|
||||
<a name="l00104"></a>00104 StkFloat fmGains_[100];
|
||||
<a name="l00105"></a>00105 StkFloat fmSusLevels_[16];
|
||||
<a name="l00106"></a>00106 StkFloat fmAttTimes_[32];
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 };
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
95
doc/html/FileLoop_8h-source.html
Normal file
95
doc/html/FileLoop_8h-source.html
Normal file
@@ -0,0 +1,95 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileLoop.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILELOOP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILELOOP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00024"></a>00024 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1FileLoop.html">00026</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileLoop.html" title="STK file looping / oscillator class.">FileLoop</a> : <span class="keyword">protected</span> <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a>
|
||||
<a name="l00027"></a>00027 {
|
||||
<a name="l00028"></a>00028 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030 <a class="code" href="classstk_1_1FileLoop.html#0d977aae11d75d0327057add00fa7f84" title="Default constructor.">FileLoop</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033 <a class="code" href="classstk_1_1FileLoop.html#0d977aae11d75d0327057add00fa7f84" title="Default constructor.">FileLoop</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span>,
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1FileLoop.html#b6f0e0f9a5cc9c99627d0e12db007905" title="Class destructor.">~FileLoop</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#5905940c0dd046a95ca9c2a1d72983de" title="Open the specified file and load its data.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a><a class="code" href="classstk_1_1FileLoop.html#51688a9e84b2f9e5a9c4e62588b65c52">00052</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">FileWvIn::closeFile</a>(); };
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1FileLoop.html#2c539902d697d0b87334ca7dc4f3ce69">00055</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">reset</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">FileWvIn::reset</a>(); };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b">00062</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( 1.0 ); };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00069"></a><a class="code" href="classstk_1_1FileLoop.html#a1ac0c8d19f412f66f5fdb89854e2833">00069</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a1ac0c8d19f412f66f5fdb89854e2833" title="Normalize data to a maximum of +-peak.">normalize</a>( StkFloat peak ) { <a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( peak ); };
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1FileLoop.html#d86d4f64c44a6f2488779fef24fc1ee7">00072</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileLoop.html#d86d4f64c44a6f2488779fef24fc1ee7" title="Return the file size in sample frames.">getSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1FileLoop.html#a18006c800c7dac1ddd277c987fe0003">00080</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#a18006c800c7dac1ddd277c987fe0003" title="Return the input file sample rate in Hz (not the data read rate).">getFileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00095"></a><a class="code" href="classstk_1_1FileLoop.html#ec8f94d8514b266acd83106ed0f24ead">00095</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#ec8f94d8514b266acd83106ed0f24ead" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( StkFloat frequency ) { this-><a class="code" href="classstk_1_1FileLoop.html#13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( file_.<a class="code" href="classstk_1_1FileRead.html#6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>() * frequency / <a class="code" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ); };
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#1986db79fd04b93f4d10b8cdf75bca34" title="Increment the read pointer by time samples, modulo file size.">addTime</a>( StkFloat time );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#8e24d6f9292a9443fbc21e4e8797f482" title="Increment current read pointer by angle, relative to a looping frequency.">addPhase</a>( StkFloat angle );
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#fe462794ba202dd879d29c39e76ae111" title="Add a phase offset to the current read pointer.">addPhaseOffset</a>( StkFloat angle );
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00126"></a><a class="code" href="classstk_1_1FileLoop.html#826b6dd0968c5abd1020a9fe629a4ffd">00126</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) { <span class="keywordflow">return</span> <a class="code" href="classstk_1_1FileLoop.html#826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">FileWvIn::lastOut</a>( channel ); };
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00138"></a>00138 StkFloat <a class="code" href="classstk_1_1FileLoop.html#037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00150"></a>00150 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FileLoop.html#037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keyword">protected</span>:
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> firstFrame_;
|
||||
<a name="l00155"></a>00155 StkFloat phaseOffset_;
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 };
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
95
doc/html/FileLoop_8h_source.html
Normal file
95
doc/html/FileLoop_8h_source.html
Normal file
@@ -0,0 +1,95 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileLoop.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILELOOP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILELOOP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00024"></a>00024 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1FileLoop.html">00026</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileLoop.html" title="STK file looping / oscillator class.">FileLoop</a> : <span class="keyword">protected</span> <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a>
|
||||
<a name="l00027"></a>00027 {
|
||||
<a name="l00028"></a>00028 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030 <a class="code" href="classstk_1_1FileLoop.html#a0d977aae11d75d0327057add00fa7f84" title="Default constructor.">FileLoop</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033 <a class="code" href="classstk_1_1FileLoop.html#a0d977aae11d75d0327057add00fa7f84" title="Default constructor.">FileLoop</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span>,
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1FileLoop.html#ab6f0e0f9a5cc9c99627d0e12db007905" title="Class destructor.">~FileLoop</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a5905940c0dd046a95ca9c2a1d72983de" title="Open the specified file and load its data.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a><a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52">00052</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">FileWvIn::closeFile</a>(); };
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1FileLoop.html#a2c539902d697d0b87334ca7dc4f3ce69">00055</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">reset</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">FileWvIn::reset</a>(); };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b">00062</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( 1.0 ); };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00069"></a><a class="code" href="classstk_1_1FileLoop.html#aa1ac0c8d19f412f66f5fdb89854e2833">00069</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#aa1ac0c8d19f412f66f5fdb89854e2833" title="Normalize data to a maximum of +-peak.">normalize</a>( StkFloat peak ) { <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( peak ); };
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1FileLoop.html#ad86d4f64c44a6f2488779fef24fc1ee7">00072</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileLoop.html#ad86d4f64c44a6f2488779fef24fc1ee7" title="Return the file size in sample frames.">getSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1FileLoop.html#aa18006c800c7dac1ddd277c987fe0003">00080</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#aa18006c800c7dac1ddd277c987fe0003" title="Return the input file sample rate in Hz (not the data read rate).">getFileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#a4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00095"></a><a class="code" href="classstk_1_1FileLoop.html#aec8f94d8514b266acd83106ed0f24ead">00095</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#aec8f94d8514b266acd83106ed0f24ead" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( StkFloat frequency ) { this-><a class="code" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( file_.<a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>() * frequency / <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ); };
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a1986db79fd04b93f4d10b8cdf75bca34" title="Increment the read pointer by time samples, modulo file size.">addTime</a>( StkFloat time );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a8e24d6f9292a9443fbc21e4e8797f482" title="Increment current read pointer by angle, relative to a looping frequency.">addPhase</a>( StkFloat angle );
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#afe462794ba202dd879d29c39e76ae111" title="Add a phase offset to the current read pointer.">addPhaseOffset</a>( StkFloat angle );
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00126"></a><a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd">00126</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) { <span class="keywordflow">return</span> <a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">FileWvIn::lastOut</a>( channel ); };
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00138"></a>00138 StkFloat <a class="code" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00150"></a>00150 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keyword">protected</span>:
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> firstFrame_;
|
||||
<a name="l00155"></a>00155 StkFloat phaseOffset_;
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 };
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
94
doc/html/FileRead_8h-source.html
Normal file
94
doc/html/FileRead_8h-source.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileRead.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEREAD_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEREAD_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1FileRead.html">00039</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00040"></a>00040 {
|
||||
<a name="l00041"></a>00041 <span class="keyword">public</span>:
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1FileRead.html#9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1FileRead.html#9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00053"></a>00053 StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <a class="code" href="classstk_1_1FileRead.html#24802c0e1846ea9f420f40293af4cde4" title="Class destructor.">~FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#cc11b53871e05af1b0342e2cc1fc3157" title="Open the specified file and determine its formatting.">open</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00066"></a>00066 StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#56d09169c0cca8623823579c7f80808a" title="If a file is open, close it.">close</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileRead.html#3f30ed2a9f45493f0369aa2edbf38f70" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1FileRead.html#6a83d925dd5bd18c4299ea42cc0ea488">00075</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileRead.html#6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileSize_; };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1FileRead.html#4c0c35f1817a4984b325967f1e7bcd81">00078</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileRead.html#4c0c35f1817a4984b325967f1e7bcd81" title="Return the number of audio channels in the file.">channels</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channels_; };
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00086"></a><a class="code" href="classstk_1_1FileRead.html#7d6ba525b2f8ae693d953cb7f4b7c199">00086</a> StkFloat <a class="code" href="classstk_1_1FileRead.html#7d6ba525b2f8ae693d953cb7f4b7c199" title="Return the file sample rate in Hz.">fileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileRate_; };
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#8eefe5d1479789c02ac2dfa76ba143f8" title="Read sample frames from the file into an StkFrames object.">read</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startFrame = 0, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keyword">protected</span>:
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="comment">// Get STK RAW file information.</span>
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">bool</span> getRawInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels,
|
||||
<a name="l00107"></a>00107 StkFormat format, StkFloat rate );
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="comment">// Get WAV file header information.</span>
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">bool</span> getWavInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="comment">// Get SND (AU) file header information.</span>
|
||||
<a name="l00113"></a>00113 <span class="keywordtype">bool</span> getSndInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="comment">// Get AIFF file header information.</span>
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">bool</span> getAifInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Get MAT-file header information.</span>
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">bool</span> getMatInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 FILE *fd_;
|
||||
<a name="l00122"></a>00122 <span class="keywordtype">bool</span> byteswap_;
|
||||
<a name="l00123"></a>00123 <span class="keywordtype">bool</span> wavFile_;
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> fileSize_;
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> dataOffset_;
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
||||
<a name="l00127"></a>00127 StkFormat dataType_;
|
||||
<a name="l00128"></a>00128 StkFloat fileRate_;
|
||||
<a name="l00129"></a>00129 };
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
94
doc/html/FileRead_8h_source.html
Normal file
94
doc/html/FileRead_8h_source.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileRead.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEREAD_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEREAD_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1FileRead.html">00039</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00040"></a>00040 {
|
||||
<a name="l00041"></a>00041 <span class="keyword">public</span>:
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00053"></a>00053 StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <a class="code" href="classstk_1_1FileRead.html#a24802c0e1846ea9f420f40293af4cde4" title="Class destructor.">~FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#acc11b53871e05af1b0342e2cc1fc3157" title="Open the specified file and determine its formatting.">open</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00066"></a>00066 StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a56d09169c0cca8623823579c7f80808a" title="If a file is open, close it.">close</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488">00075</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileSize_; };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1FileRead.html#a4c0c35f1817a4984b325967f1e7bcd81">00078</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileRead.html#a4c0c35f1817a4984b325967f1e7bcd81" title="Return the number of audio channels in the file.">channels</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channels_; };
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00086"></a><a class="code" href="classstk_1_1FileRead.html#a7d6ba525b2f8ae693d953cb7f4b7c199">00086</a> StkFloat <a class="code" href="classstk_1_1FileRead.html#a7d6ba525b2f8ae693d953cb7f4b7c199" title="Return the file sample rate in Hz.">fileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileRate_; };
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a8eefe5d1479789c02ac2dfa76ba143f8" title="Read sample frames from the file into an StkFrames object.">read</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startFrame = 0, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keyword">protected</span>:
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="comment">// Get STK RAW file information.</span>
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">bool</span> getRawInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels,
|
||||
<a name="l00107"></a>00107 StkFormat format, StkFloat rate );
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="comment">// Get WAV file header information.</span>
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">bool</span> getWavInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="comment">// Get SND (AU) file header information.</span>
|
||||
<a name="l00113"></a>00113 <span class="keywordtype">bool</span> getSndInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="comment">// Get AIFF file header information.</span>
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">bool</span> getAifInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Get MAT-file header information.</span>
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">bool</span> getMatInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 FILE *fd_;
|
||||
<a name="l00122"></a>00122 <span class="keywordtype">bool</span> byteswap_;
|
||||
<a name="l00123"></a>00123 <span class="keywordtype">bool</span> wavFile_;
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> fileSize_;
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> dataOffset_;
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
||||
<a name="l00127"></a>00127 StkFormat dataType_;
|
||||
<a name="l00128"></a>00128 StkFloat fileRate_;
|
||||
<a name="l00129"></a>00129 };
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
105
doc/html/FileWrite_8h-source.html
Normal file
105
doc/html/FileWrite_8h-source.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWrite.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWRITE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWRITE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1FileWrite.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWrite.html" title="STK audio file output class.">FileWrite</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a>00035 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> FILE_TYPE;
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1FileWrite.html#c9e286cfc8037327eef493439e78f31e">00037</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#c9e286cfc8037327eef493439e78f31e">FILE_RAW</a>;
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">00038</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>;
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1FileWrite.html#1ae24c549fc9fa2c8ef4a6ff94ccc345">00039</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#1ae24c549fc9fa2c8ef4a6ff94ccc345">FILE_SND</a>;
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1FileWrite.html#678074f8bfa198627ed8ee9f52a42c0e">00040</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#678074f8bfa198627ed8ee9f52a42c0e">FILE_AIF</a>;
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1FileWrite.html#d06e073000f613c43c48707c724d104e">00041</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#d06e073000f613c43c48707c724d104e">FILE_MAT</a>;
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FileWrite.html#b362583b465c41ac0b411722621e9d3d" title="Default constructor.">FileWrite</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1FileWrite.html#b362583b465c41ac0b411722621e9d3d" title="Default constructor.">FileWrite</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWrite.html#c4da2511c8d0640ec5484f88bd704747" title="Class destructor.">~FileWrite</a>();
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#7575ddb275c902207b7b6518bb5a4ed9" title="Create a file of the specified type and name and output samples to it in the given...">open</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00060"></a>00060 FileWrite::FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#99a19988a4dd8d608b74421cfb6cbc69" title="If a file is open, write out samples in the queue and then close it.">close</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWrite.html#636436624aa39eb5ba3401a9279a173e" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00074"></a>00074 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#d33ca8e729c14296af6dce457445832e" title="Write sample frames from the StkFrames object to the file.">write</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& buffer );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <span class="keyword">protected</span>:
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="comment">// Write STK RAW file header.</span>
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">bool</span> setRawFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="comment">// Write WAV file header.</span>
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">bool</span> setWavFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="comment">// Close WAV file, updating the header.</span>
|
||||
<a name="l00085"></a>00085 <span class="keywordtype">void</span> closeWavFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="comment">// Write SND (AU) file header.</span>
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">bool</span> setSndFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="comment">// Close SND file, updating the header.</span>
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">void</span> closeSndFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="comment">// Write AIFF file header.</span>
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">bool</span> setAifFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="comment">// Close AIFF file, updating the header.</span>
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">void</span> closeAifFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="comment">// Write MAT-file header.</span>
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">bool</span> setMatFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// Close MAT-file, updating the header.</span>
|
||||
<a name="l00103"></a>00103 <span class="keywordtype">void</span> closeMatFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 FILE *fd_;
|
||||
<a name="l00106"></a>00106 FILE_TYPE fileType_;
|
||||
<a name="l00107"></a>00107 StkFormat dataType_;
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frameCounter_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">bool</span> byteswap_;
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
105
doc/html/FileWrite_8h_source.html
Normal file
105
doc/html/FileWrite_8h_source.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWrite.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWRITE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWRITE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1FileWrite.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWrite.html" title="STK audio file output class.">FileWrite</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a>00035 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> FILE_TYPE;
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e">00037</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e">FILE_RAW</a>;
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">00038</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>;
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">00039</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">FILE_SND</a>;
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">00040</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">FILE_AIF</a>;
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">00041</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">FILE_MAT</a>;
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d" title="Default constructor.">FileWrite</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d" title="Default constructor.">FileWrite</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWrite.html#ac4da2511c8d0640ec5484f88bd704747" title="Class destructor.">~FileWrite</a>();
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#a7575ddb275c902207b7b6518bb5a4ed9" title="Create a file of the specified type and name and output samples to it in the given...">open</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00060"></a>00060 FileWrite::FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#a99a19988a4dd8d608b74421cfb6cbc69" title="If a file is open, write out samples in the queue and then close it.">close</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWrite.html#a636436624aa39eb5ba3401a9279a173e" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00074"></a>00074 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#ad33ca8e729c14296af6dce457445832e" title="Write sample frames from the StkFrames object to the file.">write</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& buffer );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <span class="keyword">protected</span>:
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="comment">// Write STK RAW file header.</span>
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">bool</span> setRawFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="comment">// Write WAV file header.</span>
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">bool</span> setWavFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="comment">// Close WAV file, updating the header.</span>
|
||||
<a name="l00085"></a>00085 <span class="keywordtype">void</span> closeWavFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="comment">// Write SND (AU) file header.</span>
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">bool</span> setSndFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="comment">// Close SND file, updating the header.</span>
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">void</span> closeSndFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="comment">// Write AIFF file header.</span>
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">bool</span> setAifFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="comment">// Close AIFF file, updating the header.</span>
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">void</span> closeAifFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="comment">// Write MAT-file header.</span>
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">bool</span> setMatFile( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// Close MAT-file, updating the header.</span>
|
||||
<a name="l00103"></a>00103 <span class="keywordtype">void</span> closeMatFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 FILE *fd_;
|
||||
<a name="l00106"></a>00106 FILE_TYPE fileType_;
|
||||
<a name="l00107"></a>00107 StkFormat dataType_;
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frameCounter_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">bool</span> byteswap_;
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
117
doc/html/FileWvIn_8h-source.html
Normal file
117
doc/html/FileWvIn_8h-source.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWvIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWVIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWVIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileRead.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1FileWvIn.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1FileWvIn.html#0562e85c4cb0d1565d9697da966add94" title="Default constructor.">FileWvIn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1FileWvIn.html#0562e85c4cb0d1565d9697da966add94" title="Default constructor.">FileWvIn</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span>,
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <a class="code" href="classstk_1_1FileWvIn.html#d63f10df8795ce5cb6348b0bb1ad884e" title="Class destructor.">~FileWvIn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00069"></a>00069 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#7986664cd986cbacf4fb19e5c77deda1" title="Open the specified file and load its data.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#e586a93b45a979881d9bd6fc1cb364cb" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#c7dfd47e46a083d434e63c9d1b8c3d28" title="Clear outputs and reset time (file) pointer to zero.">reset</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00082"></a>00082 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aecd1950fca3a5513e0efe4e86754b11" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00089"></a>00089 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aecd1950fca3a5513e0efe4e86754b11" title="Normalize data to a maximum of +-1.0.">normalize</a>( StkFloat peak );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1FileWvIn.html#a8ef94c3ed01af0efc9e968f09207a26">00092</a> <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileWvIn.html#a8ef94c3ed01af0efc9e968f09207a26" title="Return the file size in sample frames.">getSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1FileWvIn.html#867b7b7fdb60e5194e25d7a85a26ec0b">00100</a> <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#867b7b7fdb60e5194e25d7a85a26ec0b" title="Return the input file sample rate in Hz (not the data read rate).">getFileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00103"></a><a class="code" href="classstk_1_1FileWvIn.html#ca9ad0c12af3323e7bbf877513b0d10b">00103</a> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWvIn.html#ca9ad0c12af3323e7bbf877513b0d10b" title="Query whether reading is complete.">isFinished</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> finished_; };
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00109"></a>00109 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#acd97ad5f30f9cdc8201b4244aa69901" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00115"></a>00115 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#b2ccf7cc65c36a1ecfbb3b7d5707ea48" title="Increment the read pointer by time samples.">addTime</a>( StkFloat time );
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1FileWvIn.html#129c1e0b51497e6b09ad6aa37ad4d969">00124</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#129c1e0b51497e6b09ad6aa37ad4d969" title="Turn linear interpolation on/off.">setInterpolate</a>( <span class="keywordtype">bool</span> doInterpolate ) { interpolate_ = doInterpolate; };
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00136"></a>00136 StkFloat <a class="code" href="classstk_1_1FileWvIn.html#d17c12e8d51f90f59f0d0c9f6d626608" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00148"></a>00148 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#da668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00159"></a>00159 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FileWvIn.html#da668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <span class="keyword">protected</span>:
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> file_;
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">bool</span> finished_;
|
||||
<a name="l00167"></a>00167 <span class="keywordtype">bool</span> interpolate_;
|
||||
<a name="l00168"></a>00168 <span class="keywordtype">bool</span> normalizing_;
|
||||
<a name="l00169"></a>00169 <span class="keywordtype">bool</span> chunking_;
|
||||
<a name="l00170"></a>00170 StkFloat time_;
|
||||
<a name="l00171"></a>00171 StkFloat rate_;
|
||||
<a name="l00172"></a>00172 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold_;
|
||||
<a name="l00173"></a>00173 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize_;
|
||||
<a name="l00174"></a>00174 <span class="keywordtype">long</span> chunkPointer_;
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00176"></a>00176 };
|
||||
<a name="l00177"></a>00177
|
||||
<a name="l00178"></a><a class="code" href="classstk_1_1FileWvIn.html#d17c12e8d51f90f59f0d0c9f6d626608">00178</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#d17c12e8d51f90f59f0d0c9f6d626608" title="Return the specified channel value of the last computed frame.">FileWvIn :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00179"></a>00179 {
|
||||
<a name="l00180"></a>00180 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00181"></a>00181 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00182"></a>00182 errorString_ << <span class="stringliteral">"FileWvIn::lastOut(): channel argument and soundfile data are incompatible!"</span>;
|
||||
<a name="l00183"></a>00183 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185 <span class="preprocessor">#endif</span>
|
||||
<a name="l00186"></a>00186 <span class="preprocessor"></span>
|
||||
<a name="l00187"></a>00187 <span class="keywordflow">if</span> ( finished_ ) <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00189"></a>00189 }
|
||||
<a name="l00190"></a>00190
|
||||
<a name="l00191"></a>00191 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00192"></a>00192
|
||||
<a name="l00193"></a>00193 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
117
doc/html/FileWvIn_8h_source.html
Normal file
117
doc/html/FileWvIn_8h_source.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWvIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWVIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWVIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileRead.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1FileWvIn.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1FileWvIn.html#a0562e85c4cb0d1565d9697da966add94" title="Default constructor.">FileWvIn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1FileWvIn.html#a0562e85c4cb0d1565d9697da966add94" title="Default constructor.">FileWvIn</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span>,
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <a class="code" href="classstk_1_1FileWvIn.html#ad63f10df8795ce5cb6348b0bb1ad884e" title="Class destructor.">~FileWvIn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00069"></a>00069 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#a7986664cd986cbacf4fb19e5c77deda1" title="Open the specified file and load its data.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#ae586a93b45a979881d9bd6fc1cb364cb" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#ac7dfd47e46a083d434e63c9d1b8c3d28" title="Clear outputs and reset time (file) pointer to zero.">reset</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00082"></a>00082 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aaecd1950fca3a5513e0efe4e86754b11" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00089"></a>00089 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aaecd1950fca3a5513e0efe4e86754b11" title="Normalize data to a maximum of +-1.0.">normalize</a>( StkFloat peak );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1FileWvIn.html#aa8ef94c3ed01af0efc9e968f09207a26">00092</a> <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileWvIn.html#aa8ef94c3ed01af0efc9e968f09207a26" title="Return the file size in sample frames.">getSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1FileWvIn.html#a867b7b7fdb60e5194e25d7a85a26ec0b">00100</a> <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#a867b7b7fdb60e5194e25d7a85a26ec0b" title="Return the input file sample rate in Hz (not the data read rate).">getFileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#a4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00103"></a><a class="code" href="classstk_1_1FileWvIn.html#aca9ad0c12af3323e7bbf877513b0d10b">00103</a> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWvIn.html#aca9ad0c12af3323e7bbf877513b0d10b" title="Query whether reading is complete.">isFinished</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> finished_; };
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00109"></a>00109 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aacd97ad5f30f9cdc8201b4244aa69901" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00115"></a>00115 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#ab2ccf7cc65c36a1ecfbb3b7d5707ea48" title="Increment the read pointer by time samples.">addTime</a>( StkFloat time );
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1FileWvIn.html#a129c1e0b51497e6b09ad6aa37ad4d969">00124</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#a129c1e0b51497e6b09ad6aa37ad4d969" title="Turn linear interpolation on/off.">setInterpolate</a>( <span class="keywordtype">bool</span> doInterpolate ) { interpolate_ = doInterpolate; };
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00136"></a>00136 StkFloat <a class="code" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00148"></a>00148 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00159"></a>00159 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <span class="keyword">protected</span>:
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> file_;
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">bool</span> finished_;
|
||||
<a name="l00167"></a>00167 <span class="keywordtype">bool</span> interpolate_;
|
||||
<a name="l00168"></a>00168 <span class="keywordtype">bool</span> normalizing_;
|
||||
<a name="l00169"></a>00169 <span class="keywordtype">bool</span> chunking_;
|
||||
<a name="l00170"></a>00170 StkFloat time_;
|
||||
<a name="l00171"></a>00171 StkFloat rate_;
|
||||
<a name="l00172"></a>00172 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold_;
|
||||
<a name="l00173"></a>00173 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize_;
|
||||
<a name="l00174"></a>00174 <span class="keywordtype">long</span> chunkPointer_;
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00176"></a>00176 };
|
||||
<a name="l00177"></a>00177
|
||||
<a name="l00178"></a><a class="code" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608">00178</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608" title="Return the specified channel value of the last computed frame.">FileWvIn :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00179"></a>00179 {
|
||||
<a name="l00180"></a>00180 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00181"></a>00181 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00182"></a>00182 errorString_ << <span class="stringliteral">"FileWvIn::lastOut(): channel argument and soundfile data are incompatible!"</span>;
|
||||
<a name="l00183"></a>00183 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185 <span class="preprocessor">#endif</span>
|
||||
<a name="l00186"></a>00186 <span class="preprocessor"></span>
|
||||
<a name="l00187"></a>00187 <span class="keywordflow">if</span> ( finished_ ) <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00189"></a>00189 }
|
||||
<a name="l00190"></a>00190
|
||||
<a name="l00191"></a>00191 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00192"></a>00192
|
||||
<a name="l00193"></a>00193 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
80
doc/html/FileWvOut_8h-source.html
Normal file
80
doc/html/FileWvOut_8h-source.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWVOUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWVOUT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvOut.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWrite.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1FileWvOut.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWvOut.html" title="STK audio file output class.">FileWvOut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1FileWvOut.html#6f0168fca20a3c9d6d5f2baedf03ec1b" title="Default constructor with optional output buffer size argument.">FileWvOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames = 1024 );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1FileWvOut.html#6f0168fca20a3c9d6d5f2baedf03ec1b" title="Default constructor with optional output buffer size argument.">FileWvOut</a>( std::string fileName,
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00049"></a>00049 FileWrite::FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#800875bbcac8f137ed94f5606d55f8c6">FileWrite::FILE_WAV</a>,
|
||||
<a name="l00050"></a>00050 Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames = 1024 );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWvOut.html#dd13d21d51f639961977b63cb481c36e" title="Class destructor.">~FileWvOut</a>();
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#31dde577d41a65018c3e03001de8d645" title="Open a new file with the specified parameters.">openFile</a>( std::string fileName,
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels,
|
||||
<a name="l00064"></a>00064 FileWrite::FILE_TYPE type,
|
||||
<a name="l00065"></a>00065 Stk::StkFormat format );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#54cbced5ce278b0d16fa800e8445103c" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#9d3505aea3cd3c4d6822f05a2679dc41" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#9d3505aea3cd3c4d6822f05a2679dc41" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="keyword">protected</span>:
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">void</span> incrementFrame( <span class="keywordtype">void</span> );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1FileWrite.html" title="STK audio file output class.">FileWrite</a> file_;
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames_;
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferIndex_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iData_;
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 };
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
80
doc/html/FileWvOut_8h_source.html
Normal file
80
doc/html/FileWvOut_8h_source.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWVOUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWVOUT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvOut.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWrite.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1FileWvOut.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWvOut.html" title="STK audio file output class.">FileWvOut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1FileWvOut.html#a6f0168fca20a3c9d6d5f2baedf03ec1b" title="Default constructor with optional output buffer size argument.">FileWvOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames = 1024 );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1FileWvOut.html#a6f0168fca20a3c9d6d5f2baedf03ec1b" title="Default constructor with optional output buffer size argument.">FileWvOut</a>( std::string fileName,
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00049"></a>00049 FileWrite::FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FileWrite::FILE_WAV</a>,
|
||||
<a name="l00050"></a>00050 Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames = 1024 );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWvOut.html#add13d21d51f639961977b63cb481c36e" title="Class destructor.">~FileWvOut</a>();
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#a31dde577d41a65018c3e03001de8d645" title="Open a new file with the specified parameters.">openFile</a>( std::string fileName,
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels,
|
||||
<a name="l00064"></a>00064 FileWrite::FILE_TYPE type,
|
||||
<a name="l00065"></a>00065 Stk::StkFormat format );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#a54cbced5ce278b0d16fa800e8445103c" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#a9d3505aea3cd3c4d6822f05a2679dc41" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#a9d3505aea3cd3c4d6822f05a2679dc41" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="keyword">protected</span>:
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">void</span> incrementFrame( <span class="keywordtype">void</span> );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1FileWrite.html" title="STK audio file output class.">FileWrite</a> file_;
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames_;
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferIndex_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iData_;
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 };
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
83
doc/html/Filter_8h-source.html
Normal file
83
doc/html/Filter_8h-source.html
Normal file
@@ -0,0 +1,83 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Filter.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILTER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILTER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Filter.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Filter.html#fc70117c0133d4a5d9a651ceb691d7c0">00025</a> <a class="code" href="classstk_1_1Filter.html#fc70117c0133d4a5d9a651ceb691d7c0" title="Class constructor.">Filter</a>( <span class="keywordtype">void</span> ) { gain_ = 1.0; channelsIn_ = 1; lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Filter.html#48f23ab6613be35e3be8aceaf5adfdd7">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#48f23ab6613be35e3be8aceaf5adfdd7" title="Return the number of input channels for the class.">channelsIn</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channelsIn_; };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Filter.html#4f1ed97c9ad8aef32e54b48da03f5275">00031</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#4f1ed97c9ad8aef32e54b48da03f5275" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1Filter.html#827b1bd3a99fa9af408cbd4eb559d212">00041</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#827b1bd3a99fa9af408cbd4eb559d212" title="Set the filter gain.">setGain</a>( StkFloat gain ) { gain_ = gain; };
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a><a class="code" href="classstk_1_1Filter.html#f21e11b72ea59af4585c59600a0980c2">00044</a> StkFloat <a class="code" href="classstk_1_1Filter.html#f21e11b72ea59af4585c59600a0980c2" title="Return the current filter gain.">getGain</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> gain_; };
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a><a class="code" href="classstk_1_1Filter.html#b2d944f649693511dced1df249f0abe6">00047</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Filter.html#b2d944f649693511dced1df249f0abe6" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00058"></a>00058 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Filter.html#3260a238824c4a748ac057b84b7d3f21" title="Take a channel of the StkFrames object as inputs to the filter and replace with corresponding...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a>00060 <span class="keyword">protected</span>:
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channelsIn_;
|
||||
<a name="l00063"></a>00063 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 StkFloat gain_;
|
||||
<a name="l00066"></a>00066 std::vector<StkFloat> b_;
|
||||
<a name="l00067"></a>00067 std::vector<StkFloat> a_;
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> outputs_;
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> inputs_;
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Filter.html#670b9cc23ac798d3239cb819e801363c">00073</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">Filter :: clear</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00074"></a>00074 {
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
|
||||
<a name="l00076"></a>00076 <span class="keywordflow">for</span> ( i=0; i<inputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00077"></a>00077 inputs_[i] = 0.0;
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">for</span> ( i=0; i<outputs_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00079"></a>00079 outputs_[i] = 0.0;
|
||||
<a name="l00080"></a>00080 <span class="keywordflow">for</span> ( i=0; i<lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00081"></a>00081 lastFrame_[i] = 0.0;
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
83
doc/html/Filter_8h_source.html
Normal file
83
doc/html/Filter_8h_source.html
Normal file
@@ -0,0 +1,83 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Filter.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILTER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILTER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Filter.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Filter.html#afc70117c0133d4a5d9a651ceb691d7c0">00025</a> <a class="code" href="classstk_1_1Filter.html#afc70117c0133d4a5d9a651ceb691d7c0" title="Class constructor.">Filter</a>( <span class="keywordtype">void</span> ) { gain_ = 1.0; channelsIn_ = 1; lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Filter.html#a48f23ab6613be35e3be8aceaf5adfdd7">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#a48f23ab6613be35e3be8aceaf5adfdd7" title="Return the number of input channels for the class.">channelsIn</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channelsIn_; };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Filter.html#a4f1ed97c9ad8aef32e54b48da03f5275">00031</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#a4f1ed97c9ad8aef32e54b48da03f5275" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#a670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1Filter.html#a827b1bd3a99fa9af408cbd4eb559d212">00041</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#a827b1bd3a99fa9af408cbd4eb559d212" title="Set the filter gain.">setGain</a>( StkFloat gain ) { gain_ = gain; };
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a><a class="code" href="classstk_1_1Filter.html#af21e11b72ea59af4585c59600a0980c2">00044</a> StkFloat <a class="code" href="classstk_1_1Filter.html#af21e11b72ea59af4585c59600a0980c2" title="Return the current filter gain.">getGain</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> gain_; };
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a><a class="code" href="classstk_1_1Filter.html#ab2d944f649693511dced1df249f0abe6">00047</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Filter.html#ab2d944f649693511dced1df249f0abe6" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00058"></a>00058 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Filter.html#a3260a238824c4a748ac057b84b7d3f21" title="Take a channel of the StkFrames object as inputs to the filter and replace with corresponding...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a>00060 <span class="keyword">protected</span>:
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channelsIn_;
|
||||
<a name="l00063"></a>00063 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 StkFloat gain_;
|
||||
<a name="l00066"></a>00066 std::vector<StkFloat> b_;
|
||||
<a name="l00067"></a>00067 std::vector<StkFloat> a_;
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> outputs_;
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> inputs_;
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Filter.html#a670b9cc23ac798d3239cb819e801363c">00073</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#a670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">Filter :: clear</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00074"></a>00074 {
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
|
||||
<a name="l00076"></a>00076 <span class="keywordflow">for</span> ( i=0; i<inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00077"></a>00077 inputs_[i] = 0.0;
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">for</span> ( i=0; i<outputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00079"></a>00079 outputs_[i] = 0.0;
|
||||
<a name="l00080"></a>00080 <span class="keywordflow">for</span> ( i=0; i<lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00081"></a>00081 lastFrame_[i] = 0.0;
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
131
doc/html/Fir_8h-source.html
Normal file
131
doc/html/Fir_8h-source.html
Normal file
@@ -0,0 +1,131 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Fir.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FIR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FIR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00028"></a>00028 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Fir.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Fir.html" title="STK general finite impulse response filter class.">Fir</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00031"></a>00031 {
|
||||
<a name="l00032"></a>00032 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1Fir.html#4ad986b7f644d3e22e75b0744b2f948a" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Fir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Fir.html#4ad986b7f644d3e22e75b0744b2f948a" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Fir</a>( std::vector<StkFloat> &coefficients );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1Fir.html#2a9db698672fcac97a77d95f3891b68f" title="Class destructor.">~Fir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Fir.html#a3f72042fb8b13e9dcc31acbff4e1672" title="Set filter coefficients.">setCoefficients</a>( std::vector<StkFloat> &coefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Fir.html#5182288d564977bf172439f6ecaf2377">00055</a> StkFloat <a class="code" href="classstk_1_1Fir.html#5182288d564977bf172439f6ecaf2377" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keyword">protected</span>:
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 };
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a><a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793">00086</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( StkFloat input )
|
||||
<a name="l00087"></a>00087 {
|
||||
<a name="l00088"></a>00088 lastFrame_[0] = 0.0;
|
||||
<a name="l00089"></a>00089 inputs_[0] = gain_ * input;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00092"></a>00092 lastFrame_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00093"></a>00093 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 lastFrame_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1Fir.html#602e5ce0cd93f5103796ffd50ed8c988">00100</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00101"></a>00101 {
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00104"></a>00104 errorString_ << <span class="stringliteral">"Fir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span>
|
||||
<a name="l00109"></a>00109 StkFloat *samples = &frames[channel];
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, samples += hop ) {
|
||||
<a name="l00112"></a>00112 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00113"></a>00113 *samples = 0.0;
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00116"></a>00116 *samples += b_[i] * inputs_[i];
|
||||
<a name="l00117"></a>00117 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 *samples += b_[0] * inputs_[0];
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00124"></a>00124 }
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a><a class="code" href="classstk_1_1Fir.html#53bcdfc2e9ad757d2ec549529b7a9738">00126</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#fc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00127"></a>00127 {
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00130"></a>00130 errorString_ << <span class="stringliteral">"Fir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00131"></a>00131 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
<a name="l00134"></a>00134 <span class="preprocessor"></span>
|
||||
<a name="l00135"></a>00135 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00136"></a>00136 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00139"></a>00139 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00140"></a>00140 *oSamples = 0.0;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00143"></a>00143 *oSamples += b_[i] * inputs_[i];
|
||||
<a name="l00144"></a>00144 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146 *oSamples += b_[0] * inputs_[0];
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
131
doc/html/Fir_8h_source.html
Normal file
131
doc/html/Fir_8h_source.html
Normal file
@@ -0,0 +1,131 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Fir.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FIR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FIR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00028"></a>00028 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Fir.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Fir.html" title="STK general finite impulse response filter class.">Fir</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00031"></a>00031 {
|
||||
<a name="l00032"></a>00032 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1Fir.html#a4ad986b7f644d3e22e75b0744b2f948a" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Fir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Fir.html#a4ad986b7f644d3e22e75b0744b2f948a" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Fir</a>( std::vector<StkFloat> &coefficients );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1Fir.html#a2a9db698672fcac97a77d95f3891b68f" title="Class destructor.">~Fir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Fir.html#aa3f72042fb8b13e9dcc31acbff4e1672" title="Set filter coefficients.">setCoefficients</a>( std::vector<StkFloat> &coefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Fir.html#a5182288d564977bf172439f6ecaf2377">00055</a> StkFloat <a class="code" href="classstk_1_1Fir.html#a5182288d564977bf172439f6ecaf2377" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keyword">protected</span>:
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 };
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a><a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793">00086</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( StkFloat input )
|
||||
<a name="l00087"></a>00087 {
|
||||
<a name="l00088"></a>00088 lastFrame_[0] = 0.0;
|
||||
<a name="l00089"></a>00089 inputs_[0] = gain_ * input;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00092"></a>00092 lastFrame_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00093"></a>00093 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 lastFrame_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1Fir.html#a602e5ce0cd93f5103796ffd50ed8c988">00100</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00101"></a>00101 {
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00104"></a>00104 errorString_ << <span class="stringliteral">"Fir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span>
|
||||
<a name="l00109"></a>00109 StkFloat *samples = &frames[channel];
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, samples += hop ) {
|
||||
<a name="l00112"></a>00112 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00113"></a>00113 *samples = 0.0;
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00116"></a>00116 *samples += b_[i] * inputs_[i];
|
||||
<a name="l00117"></a>00117 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 *samples += b_[0] * inputs_[0];
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00124"></a>00124 }
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a><a class="code" href="classstk_1_1Fir.html#a53bcdfc2e9ad757d2ec549529b7a9738">00126</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00127"></a>00127 {
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00130"></a>00130 errorString_ << <span class="stringliteral">"Fir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00131"></a>00131 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
<a name="l00134"></a>00134 <span class="preprocessor"></span>
|
||||
<a name="l00135"></a>00135 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00136"></a>00136 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00139"></a>00139 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00140"></a>00140 *oSamples = 0.0;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00143"></a>00143 *oSamples += b_[i] * inputs_[i];
|
||||
<a name="l00144"></a>00144 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146 *oSamples += b_[0] * inputs_[0];
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
117
doc/html/Flute_8h-source.html
Normal file
117
doc/html/Flute_8h-source.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Flute.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FLUTE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FLUTE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "JetTable.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Flute.html">00039</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Flute.html" title="STK flute physical model class.">Flute</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00040"></a>00040 {
|
||||
<a name="l00041"></a>00041 <span class="keyword">public</span>:
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1Flute.html#9769eef3340651acc31b4997e9985e57" title="Class constructor, taking the lowest desired playing frequency.">Flute</a>( StkFloat lowestFrequency );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1Flute.html#76120aedfc0bab94416917d173f8a74e" title="Class destructor.">~Flute</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#4554fc4feffd469b83d02dd4e5471ffa" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#ea66780681552de9d12af6bb91f297da" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#0732403c66b3667f5f6a8c80e90046e0" title="Set the reflection coefficient for the jet delay (-1.0 - 1.0).">setJetReflection</a>( StkFloat coefficient );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#7c0ef95a3170dafde08b65ee47102969" title="Set the reflection coefficient for the air column delay (-1.0 - 1.0).">setEndReflection</a>( StkFloat coefficient );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#d37a862df945987f91e3164813ce911b" title="Set the length of the jet delay in terms of a ratio of jet delay to air column delay...">setJetDelay</a>( StkFloat aRatio );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#33b58e80c6ebbd5bd45f90a7a1c6a025" title="Apply breath velocity to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#65b8e74b1a99bc8bada4e80ebd512058" title="Decrease breath velocity with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#f76a46645fd6ed5d3c15dc4bcde3d928" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#e371e0d2366ef9fae8d12898204e7b31" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#968b3799338e39df35dcf94fe7ee90a2" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 StkFloat <a class="code" href="classstk_1_1Flute.html#b8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> jetDelay_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> boreDelay_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filter_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00095"></a>00095 StkFloat lastFrequency_;
|
||||
<a name="l00096"></a>00096 StkFloat maxPressure_;
|
||||
<a name="l00097"></a>00097 StkFloat jetReflection_;
|
||||
<a name="l00098"></a>00098 StkFloat endReflection_;
|
||||
<a name="l00099"></a>00099 StkFloat noiseGain_;
|
||||
<a name="l00100"></a>00100 StkFloat vibratoGain_;
|
||||
<a name="l00101"></a>00101 StkFloat outputGain_;
|
||||
<a name="l00102"></a>00102 StkFloat jetRatio_;
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 };
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a><a class="code" href="classstk_1_1Flute.html#b8f307f9a26ef2756ec4c0ea05f3acbe">00106</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Flute.html#b8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">Flute :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00107"></a>00107 {
|
||||
<a name="l00108"></a>00108 StkFloat pressureDiff;
|
||||
<a name="l00109"></a>00109 StkFloat breathPressure;
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00112"></a>00112 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#f2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00113"></a>00113 breathPressure += breathPressure * ( noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>() + vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 StkFloat temp = filter_.<a class="code" href="classstk_1_1OnePole.html#3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( boreDelay_.<a class="code" href="classstk_1_1DelayL.html#16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00116"></a>00116 temp = dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( temp ); <span class="comment">// Block DC on reflection.</span>
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 pressureDiff = breathPressure - (jetReflection_ * temp);
|
||||
<a name="l00119"></a>00119 pressureDiff = jetDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00120"></a>00120 pressureDiff = jetTable_.<a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) + (endReflection_ * temp);
|
||||
<a name="l00121"></a>00121 lastFrame_[0] = (StkFloat) 0.3 * boreDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
117
doc/html/Flute_8h_source.html
Normal file
117
doc/html/Flute_8h_source.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Flute.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FLUTE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FLUTE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "JetTable.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Flute.html">00039</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Flute.html" title="STK flute physical model class.">Flute</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00040"></a>00040 {
|
||||
<a name="l00041"></a>00041 <span class="keyword">public</span>:
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1Flute.html#a9769eef3340651acc31b4997e9985e57" title="Class constructor, taking the lowest desired playing frequency.">Flute</a>( StkFloat lowestFrequency );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1Flute.html#a76120aedfc0bab94416917d173f8a74e" title="Class destructor.">~Flute</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a4554fc4feffd469b83d02dd4e5471ffa" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#aea66780681552de9d12af6bb91f297da" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a0732403c66b3667f5f6a8c80e90046e0" title="Set the reflection coefficient for the jet delay (-1.0 - 1.0).">setJetReflection</a>( StkFloat coefficient );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a7c0ef95a3170dafde08b65ee47102969" title="Set the reflection coefficient for the air column delay (-1.0 - 1.0).">setEndReflection</a>( StkFloat coefficient );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#ad37a862df945987f91e3164813ce911b" title="Set the length of the jet delay in terms of a ratio of jet delay to air column delay...">setJetDelay</a>( StkFloat aRatio );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a33b58e80c6ebbd5bd45f90a7a1c6a025" title="Apply breath velocity to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a65b8e74b1a99bc8bada4e80ebd512058" title="Decrease breath velocity with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#af76a46645fd6ed5d3c15dc4bcde3d928" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#ae371e0d2366ef9fae8d12898204e7b31" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a968b3799338e39df35dcf94fe7ee90a2" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 StkFloat <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> jetDelay_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> boreDelay_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filter_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00095"></a>00095 StkFloat lastFrequency_;
|
||||
<a name="l00096"></a>00096 StkFloat maxPressure_;
|
||||
<a name="l00097"></a>00097 StkFloat jetReflection_;
|
||||
<a name="l00098"></a>00098 StkFloat endReflection_;
|
||||
<a name="l00099"></a>00099 StkFloat noiseGain_;
|
||||
<a name="l00100"></a>00100 StkFloat vibratoGain_;
|
||||
<a name="l00101"></a>00101 StkFloat outputGain_;
|
||||
<a name="l00102"></a>00102 StkFloat jetRatio_;
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 };
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a><a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe">00106</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">Flute :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00107"></a>00107 {
|
||||
<a name="l00108"></a>00108 StkFloat pressureDiff;
|
||||
<a name="l00109"></a>00109 StkFloat breathPressure;
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00112"></a>00112 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00113"></a>00113 breathPressure += breathPressure * ( noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>() + vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 StkFloat temp = filter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( boreDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00116"></a>00116 temp = dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( temp ); <span class="comment">// Block DC on reflection.</span>
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 pressureDiff = breathPressure - (jetReflection_ * temp);
|
||||
<a name="l00119"></a>00119 pressureDiff = jetDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00120"></a>00120 pressureDiff = jetTable_.<a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) + (endReflection_ * temp);
|
||||
<a name="l00121"></a>00121 lastFrame_[0] = (StkFloat) 0.3 * boreDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/FormSwep_8h-source.html
Normal file
156
doc/html/FormSwep_8h-source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FormSwep.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FORMSWEP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FORMSWEP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1FormSwep.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FormSwep.html" title="STK sweepable formant filter class.">FormSwep</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1FormSwep.html#eb0093d5962acf4b5d582730e8c8bab9" title="Default constructor creates a second-order pass-through filter.">FormSwep</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1FormSwep.html#c02cd2882f67e8ed9c315dfbf10b05a9" title="Class destructor.">~FormSwep</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1FormSwep.html#91096ebd684df25fc36a759f642b2200">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#91096ebd684df25fc36a759f642b2200" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#3aede7b088dbe2ca98b3398a5f953ae7" title="Set both the current and target resonance parameters.">setStates</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#2f00d2edf80fbf8f74a284c68caf07d6" title="Set target resonance parameters.">setTargets</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#27ba31acdbe8334da1830e14872fd226" title="Set the sweep rate (between 0.0 - 1.0).">setSweepRate</a>( StkFloat rate );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#242edcbe2a6f88393357b5a5ccec43e8" title="Set the sweep rate in terms of a time value in seconds.">setSweepTime</a>( StkFloat time );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1FormSwep.html#3d8405c24e8539b389daf86fccfe5d70">00073</a> StkFloat <a class="code" href="classstk_1_1FormSwep.html#3d8405c24e8539b389daf86fccfe5d70" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( StkFloat input );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">bool</span> dirty_;
|
||||
<a name="l00105"></a>00105 StkFloat frequency_;
|
||||
<a name="l00106"></a>00106 StkFloat radius_;
|
||||
<a name="l00107"></a>00107 StkFloat startFrequency_;
|
||||
<a name="l00108"></a>00108 StkFloat startRadius_;
|
||||
<a name="l00109"></a>00109 StkFloat startGain_;
|
||||
<a name="l00110"></a>00110 StkFloat targetFrequency_;
|
||||
<a name="l00111"></a>00111 StkFloat targetRadius_;
|
||||
<a name="l00112"></a>00112 StkFloat targetGain_;
|
||||
<a name="l00113"></a>00113 StkFloat deltaFrequency_;
|
||||
<a name="l00114"></a>00114 StkFloat deltaRadius_;
|
||||
<a name="l00115"></a>00115 StkFloat deltaGain_;
|
||||
<a name="l00116"></a>00116 StkFloat sweepState_;
|
||||
<a name="l00117"></a>00117 StkFloat sweepRate_;
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 };
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774">00121</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( StkFloat input )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">if</span> ( dirty_ ) {
|
||||
<a name="l00124"></a>00124 sweepState_ += sweepRate_;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">if</span> ( sweepState_ >= 1.0 ) {
|
||||
<a name="l00126"></a>00126 sweepState_ = 1.0;
|
||||
<a name="l00127"></a>00127 dirty_ = <span class="keyword">false</span>;
|
||||
<a name="l00128"></a>00128 radius_ = targetRadius_;
|
||||
<a name="l00129"></a>00129 frequency_ = targetFrequency_;
|
||||
<a name="l00130"></a>00130 gain_ = targetGain_;
|
||||
<a name="l00131"></a>00131 }
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">else</span> {
|
||||
<a name="l00133"></a>00133 radius_ = startRadius_ + (deltaRadius_ * sweepState_);
|
||||
<a name="l00134"></a>00134 frequency_ = startFrequency_ + (deltaFrequency_ * sweepState_);
|
||||
<a name="l00135"></a>00135 gain_ = startGain_ + (deltaGain_ * sweepState_);
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 this-><a class="code" href="classstk_1_1FormSwep.html#a6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( frequency_, radius_ );
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 inputs_[0] = gain_ * input;
|
||||
<a name="l00141"></a>00141 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00142"></a>00142 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00143"></a>00143 inputs_[2] = inputs_[1];
|
||||
<a name="l00144"></a>00144 inputs_[1] = inputs_[0];
|
||||
<a name="l00145"></a>00145 outputs_[2] = outputs_[1];
|
||||
<a name="l00146"></a>00146 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a><a class="code" href="classstk_1_1FormSwep.html#27f68dc2bb3fa41322ae49cf59cc9884">00151</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00152"></a>00152 {
|
||||
<a name="l00153"></a>00153 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00154"></a>00154 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00155"></a>00155 errorString_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#endif</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span>
|
||||
<a name="l00160"></a>00160 StkFloat *samples = &frames[channel];
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00163"></a>00163 *samples = <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *samples );
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a><a class="code" href="classstk_1_1FormSwep.html#8a16af2b4e169946cedb8fec2bb1417a">00168</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00169"></a>00169 {
|
||||
<a name="l00170"></a>00170 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00171"></a>00171 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00172"></a>00172 errorString_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00173"></a>00173 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00174"></a>00174 }
|
||||
<a name="l00175"></a>00175 <span class="preprocessor">#endif</span>
|
||||
<a name="l00176"></a>00176 <span class="preprocessor"></span>
|
||||
<a name="l00177"></a>00177 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00178"></a>00178 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00179"></a>00179 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00180"></a>00180 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop )
|
||||
<a name="l00181"></a>00181 *oSamples = <a class="code" href="classstk_1_1FormSwep.html#ba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *iSamples );
|
||||
<a name="l00182"></a>00182
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00186"></a>00186 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/FormSwep_8h_source.html
Normal file
156
doc/html/FormSwep_8h_source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FormSwep.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FORMSWEP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FORMSWEP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1FormSwep.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FormSwep.html" title="STK sweepable formant filter class.">FormSwep</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1FormSwep.html#aeb0093d5962acf4b5d582730e8c8bab9" title="Default constructor creates a second-order pass-through filter.">FormSwep</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1FormSwep.html#ac02cd2882f67e8ed9c315dfbf10b05a9" title="Class destructor.">~FormSwep</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1FormSwep.html#a91096ebd684df25fc36a759f642b2200">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a91096ebd684df25fc36a759f642b2200" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#aa6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a3aede7b088dbe2ca98b3398a5f953ae7" title="Set both the current and target resonance parameters.">setStates</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a2f00d2edf80fbf8f74a284c68caf07d6" title="Set target resonance parameters.">setTargets</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a27ba31acdbe8334da1830e14872fd226" title="Set the sweep rate (between 0.0 - 1.0).">setSweepRate</a>( StkFloat rate );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a242edcbe2a6f88393357b5a5ccec43e8" title="Set the sweep rate in terms of a time value in seconds.">setSweepTime</a>( StkFloat time );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1FormSwep.html#a3d8405c24e8539b389daf86fccfe5d70">00073</a> StkFloat <a class="code" href="classstk_1_1FormSwep.html#a3d8405c24e8539b389daf86fccfe5d70" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( StkFloat input );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">bool</span> dirty_;
|
||||
<a name="l00105"></a>00105 StkFloat frequency_;
|
||||
<a name="l00106"></a>00106 StkFloat radius_;
|
||||
<a name="l00107"></a>00107 StkFloat startFrequency_;
|
||||
<a name="l00108"></a>00108 StkFloat startRadius_;
|
||||
<a name="l00109"></a>00109 StkFloat startGain_;
|
||||
<a name="l00110"></a>00110 StkFloat targetFrequency_;
|
||||
<a name="l00111"></a>00111 StkFloat targetRadius_;
|
||||
<a name="l00112"></a>00112 StkFloat targetGain_;
|
||||
<a name="l00113"></a>00113 StkFloat deltaFrequency_;
|
||||
<a name="l00114"></a>00114 StkFloat deltaRadius_;
|
||||
<a name="l00115"></a>00115 StkFloat deltaGain_;
|
||||
<a name="l00116"></a>00116 StkFloat sweepState_;
|
||||
<a name="l00117"></a>00117 StkFloat sweepRate_;
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 };
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774">00121</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( StkFloat input )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">if</span> ( dirty_ ) {
|
||||
<a name="l00124"></a>00124 sweepState_ += sweepRate_;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">if</span> ( sweepState_ >= 1.0 ) {
|
||||
<a name="l00126"></a>00126 sweepState_ = 1.0;
|
||||
<a name="l00127"></a>00127 dirty_ = <span class="keyword">false</span>;
|
||||
<a name="l00128"></a>00128 radius_ = targetRadius_;
|
||||
<a name="l00129"></a>00129 frequency_ = targetFrequency_;
|
||||
<a name="l00130"></a>00130 gain_ = targetGain_;
|
||||
<a name="l00131"></a>00131 }
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">else</span> {
|
||||
<a name="l00133"></a>00133 radius_ = startRadius_ + (deltaRadius_ * sweepState_);
|
||||
<a name="l00134"></a>00134 frequency_ = startFrequency_ + (deltaFrequency_ * sweepState_);
|
||||
<a name="l00135"></a>00135 gain_ = startGain_ + (deltaGain_ * sweepState_);
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 this-><a class="code" href="classstk_1_1FormSwep.html#aa6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( frequency_, radius_ );
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 inputs_[0] = gain_ * input;
|
||||
<a name="l00141"></a>00141 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00142"></a>00142 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00143"></a>00143 inputs_[2] = inputs_[1];
|
||||
<a name="l00144"></a>00144 inputs_[1] = inputs_[0];
|
||||
<a name="l00145"></a>00145 outputs_[2] = outputs_[1];
|
||||
<a name="l00146"></a>00146 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a><a class="code" href="classstk_1_1FormSwep.html#a27f68dc2bb3fa41322ae49cf59cc9884">00151</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00152"></a>00152 {
|
||||
<a name="l00153"></a>00153 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00154"></a>00154 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00155"></a>00155 errorString_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#endif</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span>
|
||||
<a name="l00160"></a>00160 StkFloat *samples = &frames[channel];
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00163"></a>00163 *samples = <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *samples );
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a><a class="code" href="classstk_1_1FormSwep.html#a8a16af2b4e169946cedb8fec2bb1417a">00168</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00169"></a>00169 {
|
||||
<a name="l00170"></a>00170 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00171"></a>00171 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00172"></a>00172 errorString_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00173"></a>00173 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00174"></a>00174 }
|
||||
<a name="l00175"></a>00175 <span class="preprocessor">#endif</span>
|
||||
<a name="l00176"></a>00176 <span class="preprocessor"></span>
|
||||
<a name="l00177"></a>00177 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00178"></a>00178 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00179"></a>00179 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00180"></a>00180 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop )
|
||||
<a name="l00181"></a>00181 *oSamples = <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *iSamples );
|
||||
<a name="l00182"></a>00182
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00186"></a>00186 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
53
doc/html/Function_8h-source.html
Normal file
53
doc/html/Function_8h-source.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Function.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FUNCTION_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FUNCTION_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Function.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Function.html#21648ab236a66f3f0155bdb911f9f3c3">00024</a> <a class="code" href="classstk_1_1Function.html#21648ab236a66f3f0155bdb911f9f3c3" title="Class constructor.">Function</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1Function.html#e79bd6d0c9f53693b4ca28948d94fc25">00027</a> StkFloat <a class="code" href="classstk_1_1Function.html#e79bd6d0c9f53693b4ca28948d94fc25" title="Return the last computed output sample.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00030"></a>00030 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1Function.html#2545fede83a8afcbe11b3bcf3e4d9f42" title="Take one sample input and compute one sample of output.">tick</a>( StkFloat input ) = 0;
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a>00032 <span class="keyword">protected</span>:
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00036"></a>00036 };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a>00038 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a>00040 <span class="preprocessor">#endif</span>
|
||||
<a name="l00041"></a>00041 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
53
doc/html/Function_8h_source.html
Normal file
53
doc/html/Function_8h_source.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Function.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FUNCTION_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FUNCTION_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Function.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Function.html#a21648ab236a66f3f0155bdb911f9f3c3">00024</a> <a class="code" href="classstk_1_1Function.html#a21648ab236a66f3f0155bdb911f9f3c3" title="Class constructor.">Function</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1Function.html#ae79bd6d0c9f53693b4ca28948d94fc25">00027</a> StkFloat <a class="code" href="classstk_1_1Function.html#ae79bd6d0c9f53693b4ca28948d94fc25" title="Return the last computed output sample.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00030"></a>00030 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1Function.html#a2545fede83a8afcbe11b3bcf3e4d9f42" title="Take one sample input and compute one sample of output.">tick</a>( StkFloat input ) = 0;
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a>00032 <span class="keyword">protected</span>:
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00036"></a>00036 };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a>00038 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a>00040 <span class="preprocessor">#endif</span>
|
||||
<a name="l00041"></a>00041 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
55
doc/html/Generator_8h-source.html
Normal file
55
doc/html/Generator_8h-source.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Generator.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_GENERATOR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_GENERATOR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Generator.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Generator.html#c7f11d287fb903b04985c2f81dbf9a5d">00025</a> <a class="code" href="classstk_1_1Generator.html#c7f11d287fb903b04985c2f81dbf9a5d" title="Class constructor.">Generator</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Generator.html#9f9de4c495217ef8490a9d2d1fdabe11">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Generator.html#9f9de4c495217ef8490a9d2d1fdabe11" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Generator.html#499ad65aa6d939983863ffb922008654">00031</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Generator.html#499ad65aa6d939983863ffb922008654" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00041"></a>00041 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Generator.html#86bb0421223cf27e25704d5f27b97425" title="Fill the StkFrames object with computed sample frames, starting at the specified...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a>00043 <span class="keyword">protected</span>:
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00046"></a>00046 };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00048"></a>00048 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00050"></a>00050 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
55
doc/html/Generator_8h_source.html
Normal file
55
doc/html/Generator_8h_source.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Generator.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_GENERATOR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_GENERATOR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Generator.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Generator.html#ac7f11d287fb903b04985c2f81dbf9a5d">00025</a> <a class="code" href="classstk_1_1Generator.html#ac7f11d287fb903b04985c2f81dbf9a5d" title="Class constructor.">Generator</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Generator.html#a9f9de4c495217ef8490a9d2d1fdabe11">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Generator.html#a9f9de4c495217ef8490a9d2d1fdabe11" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Generator.html#a499ad65aa6d939983863ffb922008654">00031</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Generator.html#a499ad65aa6d939983863ffb922008654" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00041"></a>00041 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Generator.html#a86bb0421223cf27e25704d5f27b97425" title="Fill the StkFrames object with computed sample frames, starting at the specified...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a>00043 <span class="keyword">protected</span>:
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00046"></a>00046 };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00048"></a>00048 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00050"></a>00050 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/Granulate_8h-source.html
Normal file
156
doc/html/Granulate_8h-source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Granulate.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_GRANULATE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_GRANULATE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00010"></a>00010
|
||||
<a name="l00011"></a>00011 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Granulate.html">00028</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Granulate.html" title="STK granular synthesis class.">Granulate</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00029"></a>00029 {
|
||||
<a name="l00030"></a>00030 <span class="keyword">public</span>:
|
||||
<a name="l00032"></a>00032 <a class="code" href="classstk_1_1Granulate.html#78af615a331de9b643dfabb8e106883f" title="Default constructor.">Granulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1Granulate.html#78af615a331de9b643dfabb8e106883f" title="Default constructor.">Granulate</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nVoices, std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Granulate.html#42eb1f39bd88eb8d4ca55972e7711313" title="Class destructor.">~Granulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#6227f127a77b4fc581028033cd7658d8" title="Load a monophonic soundfile to be &quot;granulated&quot;.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#9b7b17ae856f3a9ece6ec462285f456c" title="Reset the file pointer and all existing grains to the file start.">reset</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#735f3ebe8fa2cacfba2c4722a56fd417" title="Set the number of simultaneous grain &quot;voices&quot; to use.">setVoices</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nVoices = 1 );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#abd711f2b71bbcd28412d5cb73c085d6" title="Set the stretch factor used for grain playback (1 - 1000).">setStretch</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stretchFactor = 1 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#9b7c15080256f920646d36bfa0ed3734" title="Set global grain parameters used to determine individual grain settings.">setGrainParameters</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> duration = 30, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rampPercent = 50,
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">int</span> offset = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> delay = 0 );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#02b7b85f21999d4b350beff6a925bd25" title="This factor is used when setting individual grain parameters (0.0 - 1.0).">setRandomFactor</a>( StkFloat randomness = 0.1 );
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00110"></a>00110 StkFloat <a class="code" href="classstk_1_1Granulate.html#60db060a365fc32fe789cb9bcd042dd3" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00113"></a>00113 StkFloat <a class="code" href="classstk_1_1Granulate.html#0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00123"></a>00123 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Granulate.html#0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <span class="keyword">enum</span> GrainState {
|
||||
<a name="l00126"></a>00126 GRAIN_STOPPED,
|
||||
<a name="l00127"></a>00127 GRAIN_FADEIN,
|
||||
<a name="l00128"></a>00128 GRAIN_SUSTAIN,
|
||||
<a name="l00129"></a>00129 GRAIN_FADEOUT
|
||||
<a name="l00130"></a>00130 };
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="keyword">protected</span>:
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="keyword">struct </span>Grain {
|
||||
<a name="l00135"></a>00135 StkFloat eScaler;
|
||||
<a name="l00136"></a>00136 StkFloat eRate;
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> attackCount;
|
||||
<a name="l00138"></a>00138 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> sustainCount;
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> decayCount;
|
||||
<a name="l00140"></a>00140 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delayCount;
|
||||
<a name="l00141"></a>00141 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> counter;
|
||||
<a name="l00142"></a>00142 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> pointer;
|
||||
<a name="l00143"></a>00143 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startPointer;
|
||||
<a name="l00144"></a>00144 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> repeats;
|
||||
<a name="l00145"></a>00145 GrainState state;
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00148"></a>00148 Grain()
|
||||
<a name="l00149"></a>00149 :eScaler(0.0), eRate(0.0), attackCount(0), sustainCount(0), decayCount(0),
|
||||
<a name="l00150"></a>00150 delayCount(0), counter(0), pointer(0), startPointer(0), repeats(0), state(GRAIN_STOPPED) {}
|
||||
<a name="l00151"></a>00151 };
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <span class="keywordtype">void</span> calculateGrain( Granulate::Grain& grain );
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data_;
|
||||
<a name="l00156"></a>00156 std::vector<Grain> grains_;
|
||||
<a name="l00157"></a>00157 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise;
|
||||
<a name="l00158"></a>00158 <span class="keywordtype">long</span> gPointer_;
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 <span class="comment">// Global grain parameters.</span>
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDuration_;
|
||||
<a name="l00162"></a>00162 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gRampPercent_;
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDelay_;
|
||||
<a name="l00164"></a>00164 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gStretch_;
|
||||
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stretchCounter_;
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">int</span> gOffset_;
|
||||
<a name="l00167"></a>00167 StkFloat gRandomFactor_;
|
||||
<a name="l00168"></a>00168 StkFloat gain_;
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a>00170 };
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a><a class="code" href="classstk_1_1Granulate.html#60db060a365fc32fe789cb9bcd042dd3">00172</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Granulate.html#60db060a365fc32fe789cb9bcd042dd3" title="Return the specified channel value of the last computed frame.">Granulate :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00173"></a>00173 {
|
||||
<a name="l00174"></a>00174 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00175"></a>00175 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00176"></a>00176 errorString_ << <span class="stringliteral">"Granulate::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00177"></a>00177 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179 <span class="preprocessor">#endif</span>
|
||||
<a name="l00180"></a>00180 <span class="preprocessor"></span>
|
||||
<a name="l00181"></a>00181 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00182"></a>00182 }
|
||||
<a name="l00183"></a>00183
|
||||
<a name="l00184"></a><a class="code" href="classstk_1_1Granulate.html#a9cc119b1515c5596a95d72f4b65b0c0">00184</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Granulate.html#0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">Granulate :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00185"></a>00185 {
|
||||
<a name="l00186"></a>00186 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00187"></a>00187 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00188"></a>00188 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00189"></a>00189 errorString_ << <span class="stringliteral">"Granulate::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00190"></a>00190 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00191"></a>00191 }
|
||||
<a name="l00192"></a>00192 <span class="preprocessor">#endif</span>
|
||||
<a name="l00193"></a>00193 <span class="preprocessor"></span>
|
||||
<a name="l00194"></a>00194 StkFloat *samples = &frames[channel];
|
||||
<a name="l00195"></a>00195 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00196"></a>00196 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00197"></a>00197 *samples++ = <a class="code" href="classstk_1_1Granulate.html#0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00198"></a>00198 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00199"></a>00199 *samples++ = lastFrame_[j];
|
||||
<a name="l00200"></a>00200 }
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00203"></a>00203 }
|
||||
<a name="l00204"></a>00204
|
||||
<a name="l00205"></a>00205 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00206"></a>00206
|
||||
<a name="l00207"></a>00207 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
158
doc/html/Granulate_8h_source.html
Normal file
158
doc/html/Granulate_8h_source.html
Normal file
@@ -0,0 +1,158 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Granulate.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_GRANULATE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_GRANULATE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00010"></a>00010
|
||||
<a name="l00011"></a>00011 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Granulate.html">00028</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Granulate.html" title="STK granular synthesis class.">Granulate</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00029"></a>00029 {
|
||||
<a name="l00030"></a>00030 <span class="keyword">public</span>:
|
||||
<a name="l00032"></a>00032 <a class="code" href="classstk_1_1Granulate.html#a78af615a331de9b643dfabb8e106883f" title="Default constructor.">Granulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1Granulate.html#a78af615a331de9b643dfabb8e106883f" title="Default constructor.">Granulate</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nVoices, std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Granulate.html#a42eb1f39bd88eb8d4ca55972e7711313" title="Class destructor.">~Granulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a6227f127a77b4fc581028033cd7658d8" title="Load a monophonic soundfile to be &quot;granulated&quot;.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a9b7b17ae856f3a9ece6ec462285f456c" title="Reset the file pointer and all existing grains to the file start.">reset</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a735f3ebe8fa2cacfba2c4722a56fd417" title="Set the number of simultaneous grain &quot;voices&quot; to use.">setVoices</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nVoices = 1 );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#aabd711f2b71bbcd28412d5cb73c085d6" title="Set the stretch factor used for grain playback (1 - 1000).">setStretch</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stretchFactor = 1 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a9b7c15080256f920646d36bfa0ed3734" title="Set global grain parameters used to determine individual grain settings.">setGrainParameters</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> duration = 30, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rampPercent = 50,
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">int</span> offset = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> delay = 0 );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a02b7b85f21999d4b350beff6a925bd25" title="This factor is used when setting individual grain parameters (0.0 - 1.0).">setRandomFactor</a>( StkFloat randomness = 0.1 );
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00110"></a>00110 StkFloat <a class="code" href="classstk_1_1Granulate.html#a60db060a365fc32fe789cb9bcd042dd3" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00113"></a>00113 StkFloat <a class="code" href="classstk_1_1Granulate.html#a0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00123"></a>00123 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Granulate.html#a0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <span class="keyword">enum</span> GrainState {
|
||||
<a name="l00126"></a>00126 GRAIN_STOPPED,
|
||||
<a name="l00127"></a>00127 GRAIN_FADEIN,
|
||||
<a name="l00128"></a>00128 GRAIN_SUSTAIN,
|
||||
<a name="l00129"></a>00129 GRAIN_FADEOUT
|
||||
<a name="l00130"></a>00130 };
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="keyword">protected</span>:
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="keyword">struct </span>Grain {
|
||||
<a name="l00135"></a>00135 StkFloat eScaler;
|
||||
<a name="l00136"></a>00136 StkFloat eRate;
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> attackCount;
|
||||
<a name="l00138"></a>00138 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> sustainCount;
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> decayCount;
|
||||
<a name="l00140"></a>00140 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delayCount;
|
||||
<a name="l00141"></a>00141 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> counter;
|
||||
<a name="l00142"></a>00142 <span class="comment">//unsigned long pointer;</span>
|
||||
<a name="l00143"></a>00143 StkFloat pointer;
|
||||
<a name="l00144"></a>00144 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startPointer;
|
||||
<a name="l00145"></a>00145 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> repeats;
|
||||
<a name="l00146"></a>00146 GrainState state;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00149"></a>00149 Grain()
|
||||
<a name="l00150"></a>00150 :eScaler(0.0), eRate(0.0), attackCount(0), sustainCount(0), decayCount(0),
|
||||
<a name="l00151"></a>00151 delayCount(0), counter(0), pointer(0), startPointer(0), repeats(0), state(GRAIN_STOPPED) {}
|
||||
<a name="l00152"></a>00152 };
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <span class="keywordtype">void</span> calculateGrain( Granulate::Grain& grain );
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data_;
|
||||
<a name="l00157"></a>00157 std::vector<Grain> grains_;
|
||||
<a name="l00158"></a>00158 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise;
|
||||
<a name="l00159"></a>00159 <span class="comment">//long gPointer_;</span>
|
||||
<a name="l00160"></a>00160 StkFloat gPointer_;
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="comment">// Global grain parameters.</span>
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDuration_;
|
||||
<a name="l00164"></a>00164 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gRampPercent_;
|
||||
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDelay_;
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gStretch_;
|
||||
<a name="l00167"></a>00167 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stretchCounter_;
|
||||
<a name="l00168"></a>00168 <span class="keywordtype">int</span> gOffset_;
|
||||
<a name="l00169"></a>00169 StkFloat gRandomFactor_;
|
||||
<a name="l00170"></a>00170 StkFloat gain_;
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a>00172 };
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a><a class="code" href="classstk_1_1Granulate.html#a60db060a365fc32fe789cb9bcd042dd3">00174</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Granulate.html#a60db060a365fc32fe789cb9bcd042dd3" title="Return the specified channel value of the last computed frame.">Granulate :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00175"></a>00175 {
|
||||
<a name="l00176"></a>00176 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00177"></a>00177 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00178"></a>00178 errorString_ << <span class="stringliteral">"Granulate::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00179"></a>00179 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00180"></a>00180 }
|
||||
<a name="l00181"></a>00181 <span class="preprocessor">#endif</span>
|
||||
<a name="l00182"></a>00182 <span class="preprocessor"></span>
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00186"></a><a class="code" href="classstk_1_1Granulate.html#aa9cc119b1515c5596a95d72f4b65b0c0">00186</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Granulate.html#a0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">Granulate :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00187"></a>00187 {
|
||||
<a name="l00188"></a>00188 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00189"></a>00189 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00190"></a>00190 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00191"></a>00191 errorString_ << <span class="stringliteral">"Granulate::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00192"></a>00192 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00193"></a>00193 }
|
||||
<a name="l00194"></a>00194 <span class="preprocessor">#endif</span>
|
||||
<a name="l00195"></a>00195 <span class="preprocessor"></span>
|
||||
<a name="l00196"></a>00196 StkFloat *samples = &frames[channel];
|
||||
<a name="l00197"></a>00197 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00198"></a>00198 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00199"></a>00199 *samples++ = <a class="code" href="classstk_1_1Granulate.html#a0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00200"></a>00200 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00201"></a>00201 *samples++ = lastFrame_[j];
|
||||
<a name="l00202"></a>00202 }
|
||||
<a name="l00203"></a>00203
|
||||
<a name="l00204"></a>00204 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00205"></a>00205 }
|
||||
<a name="l00206"></a>00206
|
||||
<a name="l00207"></a>00207 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00208"></a>00208
|
||||
<a name="l00209"></a>00209 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
80
doc/html/HevyMetl_8h-source.html
Normal file
80
doc/html/HevyMetl_8h-source.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>HevyMetl.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_HEVYMETL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_HEVYMETL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1HevyMetl.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1HevyMetl.html" title="STK heavy metal FM synthesis instrument.">HevyMetl</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1HevyMetl.html#61e000b4c2a8ba021e43e8074be44390" title="Class constructor.">HevyMetl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1HevyMetl.html#03b76a27541928bf9e7d156f9709a8f0" title="Class destructor.">~HevyMetl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1HevyMetl.html#a7401a5cb44a69edaad304aac41b6eda" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 StkFloat <a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00056"></a>00056 <span class="keyword">protected</span>:
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00058"></a>00058 };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a><a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7">00060</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">HevyMetl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00061"></a>00061 {
|
||||
<a name="l00062"></a>00062 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 temp = vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.2;
|
||||
<a name="l00065"></a>00065 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
||||
<a name="l00066"></a>00066 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
||||
<a name="l00067"></a>00067 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
||||
<a name="l00068"></a>00068 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 temp = gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00071"></a>00071 waves_[1]->addPhaseOffset( temp );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#e9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00074"></a>00074 temp = (1.0 - (control2_ * 0.5)) * gains_[3] * adsr_[3]-><a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>() * waves_[3]->tick();
|
||||
<a name="l00075"></a>00075 twozero_.<a class="code" href="classstk_1_1TwoZero.html#cf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00078"></a>00078 temp = temp * control1_;
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 waves_[0]->addPhaseOffset( temp );
|
||||
<a name="l00081"></a>00081 temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00084"></a>00084 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
80
doc/html/HevyMetl_8h_source.html
Normal file
80
doc/html/HevyMetl_8h_source.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>HevyMetl.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_HEVYMETL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_HEVYMETL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1HevyMetl.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1HevyMetl.html" title="STK heavy metal FM synthesis instrument.">HevyMetl</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1HevyMetl.html#a61e000b4c2a8ba021e43e8074be44390" title="Class constructor.">HevyMetl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1HevyMetl.html#a03b76a27541928bf9e7d156f9709a8f0" title="Class destructor.">~HevyMetl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1HevyMetl.html#aa7401a5cb44a69edaad304aac41b6eda" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 StkFloat <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00056"></a>00056 <span class="keyword">protected</span>:
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00058"></a>00058 };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a><a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7">00060</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">HevyMetl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00061"></a>00061 {
|
||||
<a name="l00062"></a>00062 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 temp = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.2;
|
||||
<a name="l00065"></a>00065 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
||||
<a name="l00066"></a>00066 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
||||
<a name="l00067"></a>00067 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
||||
<a name="l00068"></a>00068 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 temp = gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00071"></a>00071 waves_[1]->addPhaseOffset( temp );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00074"></a>00074 temp = (1.0 - (control2_ * 0.5)) * gains_[3] * adsr_[3]-><a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>() * waves_[3]->tick();
|
||||
<a name="l00075"></a>00075 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00078"></a>00078 temp = temp * control1_;
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 waves_[0]->addPhaseOffset( temp );
|
||||
<a name="l00081"></a>00081 temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00084"></a>00084 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/Iir_8h-source.html
Normal file
156
doc/html/Iir_8h-source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Iir.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_IIR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_IIR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Iir.html">00034</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Iir.html" title="STK general infinite impulse response filter class.">Iir</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00035"></a>00035 {
|
||||
<a name="l00036"></a>00036 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Iir.html#1d63797b4caf775de8d351ec0c15a4c0" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Iir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Iir.html#1d63797b4caf775de8d351ec0c15a4c0" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Iir</a>( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Iir.html#c15361cbfa19e6e4f73a155abc1459a8" title="Class destructor.">~Iir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#a0249b92dcec86ae83688debedb8d95b" title="Set filter coefficients.">setCoefficients</a>( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#7a1473446857a14cdbb33cb5afde076c" title="Set numerator coefficients.">setNumerator</a>( std::vector<StkFloat> &bCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#e67cc04a452edfbd80f1a27097ea0187" title="Set denominator coefficients.">setDenominator</a>( std::vector<StkFloat> &aCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1Iir.html#5dcae9330f2c52d2bfa1647e6b250a14">00083</a> StkFloat <a class="code" href="classstk_1_1Iir.html#5dcae9330f2c52d2bfa1647e6b250a14" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086 StkFloat <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00108"></a>00108 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="keyword">protected</span>:
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( StkFloat input )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 outputs_[0] = 0.0;
|
||||
<a name="l00119"></a>00119 inputs_[0] = gain_ * input;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00121"></a>00121 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00122"></a>00122 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00127"></a>00127 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00128"></a>00128 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 lastFrame_[0] = outputs_[0];
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a><a class="code" href="classstk_1_1Iir.html#d03f40e022b2adfe942d30908ec34793">00135</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00136"></a>00136 {
|
||||
<a name="l00137"></a>00137 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00138"></a>00138 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00139"></a>00139 errorString_ << <span class="stringliteral">"Iir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00140"></a>00140 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#endif</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span>
|
||||
<a name="l00144"></a>00144 StkFloat *samples = &frames[channel];
|
||||
<a name="l00145"></a>00145 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, samples += hop ) {
|
||||
<a name="l00147"></a>00147 outputs_[0] = 0.0;
|
||||
<a name="l00148"></a>00148 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00150"></a>00150 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00151"></a>00151 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00156"></a>00156 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00157"></a>00157 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 *samples = outputs_[0];
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00165"></a>00165 }
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a><a class="code" href="classstk_1_1Iir.html#60919d8e000bf83613bdd5e002d750f1">00167</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00168"></a>00168 {
|
||||
<a name="l00169"></a>00169 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00170"></a>00170 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00171"></a>00171 errorString_ << <span class="stringliteral">"Iir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00172"></a>00172 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00173"></a>00173 }
|
||||
<a name="l00174"></a>00174 <span class="preprocessor">#endif</span>
|
||||
<a name="l00175"></a>00175 <span class="preprocessor"></span>
|
||||
<a name="l00176"></a>00176 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00177"></a>00177 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00178"></a>00178 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00179"></a>00179 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00180"></a>00180 outputs_[0] = 0.0;
|
||||
<a name="l00181"></a>00181 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00182"></a>00182 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00183"></a>00183 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00184"></a>00184 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00185"></a>00185 }
|
||||
<a name="l00186"></a>00186 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00189"></a>00189 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00190"></a>00190 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00191"></a>00191 }
|
||||
<a name="l00192"></a>00192
|
||||
<a name="l00193"></a>00193 *oSamples = outputs_[0];
|
||||
<a name="l00194"></a>00194 }
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a>00196 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00197"></a>00197 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00198"></a>00198 }
|
||||
<a name="l00199"></a>00199
|
||||
<a name="l00200"></a>00200 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/Iir_8h_source.html
Normal file
156
doc/html/Iir_8h_source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Iir.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_IIR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_IIR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Iir.html">00034</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Iir.html" title="STK general infinite impulse response filter class.">Iir</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00035"></a>00035 {
|
||||
<a name="l00036"></a>00036 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Iir.html#a1d63797b4caf775de8d351ec0c15a4c0" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Iir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Iir.html#a1d63797b4caf775de8d351ec0c15a4c0" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Iir</a>( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Iir.html#ac15361cbfa19e6e4f73a155abc1459a8" title="Class destructor.">~Iir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#aa0249b92dcec86ae83688debedb8d95b" title="Set filter coefficients.">setCoefficients</a>( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#a7a1473446857a14cdbb33cb5afde076c" title="Set numerator coefficients.">setNumerator</a>( std::vector<StkFloat> &bCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#ae67cc04a452edfbd80f1a27097ea0187" title="Set denominator coefficients.">setDenominator</a>( std::vector<StkFloat> &aCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1Iir.html#a5dcae9330f2c52d2bfa1647e6b250a14">00083</a> StkFloat <a class="code" href="classstk_1_1Iir.html#a5dcae9330f2c52d2bfa1647e6b250a14" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086 StkFloat <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00108"></a>00108 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="keyword">protected</span>:
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( StkFloat input )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 outputs_[0] = 0.0;
|
||||
<a name="l00119"></a>00119 inputs_[0] = gain_ * input;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00121"></a>00121 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00122"></a>00122 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00127"></a>00127 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00128"></a>00128 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 lastFrame_[0] = outputs_[0];
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a><a class="code" href="classstk_1_1Iir.html#ad03f40e022b2adfe942d30908ec34793">00135</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00136"></a>00136 {
|
||||
<a name="l00137"></a>00137 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00138"></a>00138 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00139"></a>00139 errorString_ << <span class="stringliteral">"Iir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00140"></a>00140 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#endif</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span>
|
||||
<a name="l00144"></a>00144 StkFloat *samples = &frames[channel];
|
||||
<a name="l00145"></a>00145 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, samples += hop ) {
|
||||
<a name="l00147"></a>00147 outputs_[0] = 0.0;
|
||||
<a name="l00148"></a>00148 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00150"></a>00150 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00151"></a>00151 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00156"></a>00156 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00157"></a>00157 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 *samples = outputs_[0];
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00165"></a>00165 }
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a><a class="code" href="classstk_1_1Iir.html#a60919d8e000bf83613bdd5e002d750f1">00167</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00168"></a>00168 {
|
||||
<a name="l00169"></a>00169 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00170"></a>00170 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00171"></a>00171 errorString_ << <span class="stringliteral">"Iir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00172"></a>00172 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00173"></a>00173 }
|
||||
<a name="l00174"></a>00174 <span class="preprocessor">#endif</span>
|
||||
<a name="l00175"></a>00175 <span class="preprocessor"></span>
|
||||
<a name="l00176"></a>00176 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00177"></a>00177 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00178"></a>00178 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00179"></a>00179 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00180"></a>00180 outputs_[0] = 0.0;
|
||||
<a name="l00181"></a>00181 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00182"></a>00182 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00183"></a>00183 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00184"></a>00184 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00185"></a>00185 }
|
||||
<a name="l00186"></a>00186 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00189"></a>00189 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00190"></a>00190 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00191"></a>00191 }
|
||||
<a name="l00192"></a>00192
|
||||
<a name="l00193"></a>00193 *oSamples = outputs_[0];
|
||||
<a name="l00194"></a>00194 }
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a>00196 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00197"></a>00197 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00198"></a>00198 }
|
||||
<a name="l00199"></a>00199
|
||||
<a name="l00200"></a>00200 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
115
doc/html/InetWvIn_8h-source.html
Normal file
115
doc/html/InetWvIn_8h-source.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>InetWvIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INETWVIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INETWVIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "TcpServer.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "UdpSocket.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Thread.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Mutex.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a>00038 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
|
||||
<a name="l00039"></a>00039 <span class="keywordtype">bool</span> finished;
|
||||
<a name="l00040"></a>00040 <span class="keywordtype">void</span> *object;
|
||||
<a name="l00041"></a>00041 } ThreadInfo;
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1InetWvIn.html">00043</a> <span class="keyword">class </span><a class="code" href="classstk_1_1InetWvIn.html" title="STK internet streaming input class.">InetWvIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>
|
||||
<a name="l00044"></a>00044 {
|
||||
<a name="l00045"></a>00045 <span class="keyword">public</span>:
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1InetWvIn.html#d97edafdfb9db2aee77b11d3086113a4" title="Default constructor.">InetWvIn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames = 1024, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nBuffers = 8 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1InetWvIn.html#760628dfbbca0a11142d28ff5cabd8b5" title="Class destructor.">~InetWvIn</a>();
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvIn.html#f36ff382737f0fb84bc38046c01b4ce8" title="Wait for a (new) socket connection with specified protocol, port, data channels and...">listen</a>( <span class="keywordtype">int</span> port = 2006, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00064"></a>00064 Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00065"></a>00065 Socket::ProtocolType protocol = Socket::PROTO_TCP );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1InetWvIn.html#8b54226eabcd0c58d93fcc0792fa7e02" title="Returns true is an input connection exists or input data remains in the queue.">isConnected</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00084"></a>00084 StkFloat <a class="code" href="classstk_1_1InetWvIn.html#cfd578027b2bbcbe4ceefa11e49e8cd2" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00097"></a>00097 StkFloat <a class="code" href="classstk_1_1InetWvIn.html#2109090620c80013ef3ae68cb975fb17" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1InetWvIn.html#2109090620c80013ef3ae68cb975fb17" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// Called by the thread routine to receive data via the socket connection</span>
|
||||
<a name="l00112"></a>00112 <span class="comment">// and fill the socket buffer. This is not intended for general use but</span>
|
||||
<a name="l00113"></a>00113 <span class="comment">// must be public for access from the thread.</span>
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">void</span> receive( <span class="keywordtype">void</span> );
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="keyword">protected</span>:
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Read buffered socket data into the data buffer ... will block if none available.</span>
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">int</span> readData( <span class="keywordtype">void</span> );
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> *soket_;
|
||||
<a name="l00122"></a>00122 <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> thread_;
|
||||
<a name="l00123"></a>00123 <a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> mutex_;
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">char</span> *buffer_;
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames_;
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferBytes_;
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bytesFilled_;
|
||||
<a name="l00128"></a>00128 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nBuffers_;
|
||||
<a name="l00129"></a>00129 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> writePoint_;
|
||||
<a name="l00130"></a>00130 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> readPoint_;
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">long</span> bufferCounter_;
|
||||
<a name="l00132"></a>00132 <span class="keywordtype">int</span> dataBytes_;
|
||||
<a name="l00133"></a>00133 <span class="keywordtype">bool</span> connected_;
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">int</span> fd_;
|
||||
<a name="l00135"></a>00135 ThreadInfo threadInfo_;
|
||||
<a name="l00136"></a>00136 Stk::StkFormat dataType_;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 };
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a><a class="code" href="classstk_1_1InetWvIn.html#cfd578027b2bbcbe4ceefa11e49e8cd2">00140</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1InetWvIn.html#cfd578027b2bbcbe4ceefa11e49e8cd2" title="Return the specified channel value of the last computed frame.">InetWvIn :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00141"></a>00141 {
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00144"></a>00144 errorString_ << <span class="stringliteral">"InetWvIn::lastOut(): channel argument and data stream are incompatible!"</span>;
|
||||
<a name="l00145"></a>00145 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147 <span class="preprocessor">#endif</span>
|
||||
<a name="l00148"></a>00148 <span class="preprocessor"></span>
|
||||
<a name="l00149"></a>00149 <span class="comment">// If no connection and we've output all samples in the queue, return.</span>
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">if</span> ( !connected_ && bytesFilled_ == 0 && bufferCounter_ == 0 ) <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
115
doc/html/InetWvIn_8h_source.html
Normal file
115
doc/html/InetWvIn_8h_source.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>InetWvIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INETWVIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INETWVIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "TcpServer.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "UdpSocket.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Thread.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Mutex.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a>00038 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
|
||||
<a name="l00039"></a>00039 <span class="keywordtype">bool</span> finished;
|
||||
<a name="l00040"></a>00040 <span class="keywordtype">void</span> *object;
|
||||
<a name="l00041"></a>00041 } ThreadInfo;
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1InetWvIn.html">00043</a> <span class="keyword">class </span><a class="code" href="classstk_1_1InetWvIn.html" title="STK internet streaming input class.">InetWvIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>
|
||||
<a name="l00044"></a>00044 {
|
||||
<a name="l00045"></a>00045 <span class="keyword">public</span>:
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1InetWvIn.html#ad97edafdfb9db2aee77b11d3086113a4" title="Default constructor.">InetWvIn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames = 1024, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nBuffers = 8 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1InetWvIn.html#a760628dfbbca0a11142d28ff5cabd8b5" title="Class destructor.">~InetWvIn</a>();
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvIn.html#af36ff382737f0fb84bc38046c01b4ce8" title="Wait for a (new) socket connection with specified protocol, port, data channels and...">listen</a>( <span class="keywordtype">int</span> port = 2006, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00064"></a>00064 Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00065"></a>00065 Socket::ProtocolType protocol = Socket::PROTO_TCP );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1InetWvIn.html#a8b54226eabcd0c58d93fcc0792fa7e02" title="Returns true is an input connection exists or input data remains in the queue.">isConnected</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00084"></a>00084 StkFloat <a class="code" href="classstk_1_1InetWvIn.html#acfd578027b2bbcbe4ceefa11e49e8cd2" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00097"></a>00097 StkFloat <a class="code" href="classstk_1_1InetWvIn.html#a2109090620c80013ef3ae68cb975fb17" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1InetWvIn.html#a2109090620c80013ef3ae68cb975fb17" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// Called by the thread routine to receive data via the socket connection</span>
|
||||
<a name="l00112"></a>00112 <span class="comment">// and fill the socket buffer. This is not intended for general use but</span>
|
||||
<a name="l00113"></a>00113 <span class="comment">// must be public for access from the thread.</span>
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">void</span> receive( <span class="keywordtype">void</span> );
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="keyword">protected</span>:
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Read buffered socket data into the data buffer ... will block if none available.</span>
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">int</span> readData( <span class="keywordtype">void</span> );
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> *soket_;
|
||||
<a name="l00122"></a>00122 <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> thread_;
|
||||
<a name="l00123"></a>00123 <a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> mutex_;
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">char</span> *buffer_;
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames_;
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferBytes_;
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bytesFilled_;
|
||||
<a name="l00128"></a>00128 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nBuffers_;
|
||||
<a name="l00129"></a>00129 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> writePoint_;
|
||||
<a name="l00130"></a>00130 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> readPoint_;
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">long</span> bufferCounter_;
|
||||
<a name="l00132"></a>00132 <span class="keywordtype">int</span> dataBytes_;
|
||||
<a name="l00133"></a>00133 <span class="keywordtype">bool</span> connected_;
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">int</span> fd_;
|
||||
<a name="l00135"></a>00135 ThreadInfo threadInfo_;
|
||||
<a name="l00136"></a>00136 Stk::StkFormat dataType_;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 };
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a><a class="code" href="classstk_1_1InetWvIn.html#acfd578027b2bbcbe4ceefa11e49e8cd2">00140</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1InetWvIn.html#acfd578027b2bbcbe4ceefa11e49e8cd2" title="Return the specified channel value of the last computed frame.">InetWvIn :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00141"></a>00141 {
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00144"></a>00144 errorString_ << <span class="stringliteral">"InetWvIn::lastOut(): channel argument and data stream are incompatible!"</span>;
|
||||
<a name="l00145"></a>00145 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147 <span class="preprocessor">#endif</span>
|
||||
<a name="l00148"></a>00148 <span class="preprocessor"></span>
|
||||
<a name="l00149"></a>00149 <span class="comment">// If no connection and we've output all samples in the queue, return.</span>
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">if</span> ( !connected_ && bytesFilled_ == 0 && bufferCounter_ == 0 ) <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
79
doc/html/InetWvOut_8h-source.html
Normal file
79
doc/html/InetWvOut_8h-source.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>InetWvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INETWVOUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INETWVOUT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvOut.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Socket.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1InetWvOut.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1InetWvOut.html" title="STK internet streaming output class.">InetWvOut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036 <a class="code" href="classstk_1_1InetWvOut.html#cc7c0b00c68cb76d1b15e7187d67a966" title="Default constructor ... the socket is not instantiated.">InetWvOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> packetFrames = 1024 );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1InetWvOut.html#cc7c0b00c68cb76d1b15e7187d67a966" title="Default constructor ... the socket is not instantiated.">InetWvOut</a>( <span class="keywordtype">int</span> port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||
<a name="l00043"></a>00043 std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> packetFrames = 1024 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1InetWvOut.html#e58f286de491788df700479f88b3c625" title="Class destructor.">~InetWvOut</a>();
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#4c8b6fb25c6d751b7929bec9a2d04a53" title="Connect to the specified host and port and prepare to stream nChannels of data in...">connect</a>( <span class="keywordtype">int</span> port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||
<a name="l00054"></a>00054 std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#2314d2e2d005c5b08aa24d21075af638" title="If a connection is open, write out remaining samples in the queue and then disconnect...">disconnect</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#800f77228d851a2d276fae6a24bcdc9a" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#800f77228d851a2d276fae6a24bcdc9a" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keyword">protected</span>:
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> incrementFrame( <span class="keywordtype">void</span> );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <span class="comment">// Write a buffer of length frames via the socket connection.</span>
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> writeData( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frames );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">char</span> *buffer_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> *soket_;
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames_;
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferBytes_;
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferIndex_;
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> iData_;
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dataBytes_;
|
||||
<a name="l00093"></a>00093 Stk::StkFormat dataType_;
|
||||
<a name="l00094"></a>00094 };
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
79
doc/html/InetWvOut_8h_source.html
Normal file
79
doc/html/InetWvOut_8h_source.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>InetWvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INETWVOUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INETWVOUT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvOut.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Socket.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1InetWvOut.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1InetWvOut.html" title="STK internet streaming output class.">InetWvOut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036 <a class="code" href="classstk_1_1InetWvOut.html#acc7c0b00c68cb76d1b15e7187d67a966" title="Default constructor ... the socket is not instantiated.">InetWvOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> packetFrames = 1024 );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1InetWvOut.html#acc7c0b00c68cb76d1b15e7187d67a966" title="Default constructor ... the socket is not instantiated.">InetWvOut</a>( <span class="keywordtype">int</span> port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||
<a name="l00043"></a>00043 std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> packetFrames = 1024 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1InetWvOut.html#ae58f286de491788df700479f88b3c625" title="Class destructor.">~InetWvOut</a>();
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#a4c8b6fb25c6d751b7929bec9a2d04a53" title="Connect to the specified host and port and prepare to stream nChannels of data in...">connect</a>( <span class="keywordtype">int</span> port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||
<a name="l00054"></a>00054 std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#a2314d2e2d005c5b08aa24d21075af638" title="If a connection is open, write out remaining samples in the queue and then disconnect...">disconnect</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#a800f77228d851a2d276fae6a24bcdc9a" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#a800f77228d851a2d276fae6a24bcdc9a" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keyword">protected</span>:
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> incrementFrame( <span class="keywordtype">void</span> );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <span class="comment">// Write a buffer of length frames via the socket connection.</span>
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> writeData( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frames );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">char</span> *buffer_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> *soket_;
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames_;
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferBytes_;
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferIndex_;
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> iData_;
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dataBytes_;
|
||||
<a name="l00093"></a>00093 Stk::StkFormat dataType_;
|
||||
<a name="l00094"></a>00094 };
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
120
doc/html/Instrmnt_8h-source.html
Normal file
120
doc/html/Instrmnt_8h-source.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Instrmnt.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INSTRMNT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INSTRMNT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00017"></a>00017 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classstk_1_1Instrmnt.html">00019</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1Instrmnt.html#6f3c4dc01e0484f0ca4a3b14f1b7caf0">00023</a> <a class="code" href="classstk_1_1Instrmnt.html#6f3c4dc01e0484f0ca4a3b14f1b7caf0" title="Class constructor.">Instrmnt</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#0736ccd253b446660938d51909a32f44" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude ) = 0;
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#582c77e71cd2c5cb46ba6f78fa0ac6a2" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude ) = 0;
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#597efc508ad367a308fa11b8cbdc96a7" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#5aecf9f4d4dcecdbef8271c7fe62b2cf" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>(<span class="keywordtype">int</span> number, StkFloat value);
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Instrmnt.html#32564b611598653fce5e708821b3fcb4">00038</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Instrmnt.html#32564b611598653fce5e708821b3fcb4" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1Instrmnt.html#277ac5149ec22c33d794dfd462a82d2b">00041</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#277ac5149ec22c33d794dfd462a82d2b" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 StkFloat <a class="code" href="classstk_1_1Instrmnt.html#aa6bd5e4a5be7f9b0be967daf012872e" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a>00058 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <span class="keyword">protected</span>:
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Instrmnt.html#597efc508ad367a308fa11b8cbdc96a7">00076</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#597efc508ad367a308fa11b8cbdc96a7" title="Set instrument parameters for a particular frequency.">Instrmnt :: setFrequency</a>(StkFloat frequency)
|
||||
<a name="l00077"></a>00077 {
|
||||
<a name="l00078"></a>00078 errorString_ << <span class="stringliteral">"Instrmnt::setFrequency: virtual setFrequency function call!"</span>;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00080"></a>00080 }
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a><a class="code" href="classstk_1_1Instrmnt.html#aa6bd5e4a5be7f9b0be967daf012872e">00082</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Instrmnt.html#aa6bd5e4a5be7f9b0be967daf012872e" title="Return the specified channel value of the last computed frame.">Instrmnt :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00083"></a>00083 {
|
||||
<a name="l00084"></a>00084 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00085"></a>00085 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00086"></a>00086 errorString_ << <span class="stringliteral">"Instrmnt::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089 <span class="preprocessor">#endif</span>
|
||||
<a name="l00090"></a>00090 <span class="preprocessor"></span>
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00092"></a>00092 }
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a><a class="code" href="classstk_1_1Instrmnt.html#4abfe94b5fc8d87b47729fe317222eb9">00094</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">Instrmnt :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00095"></a>00095 {
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00097"></a>00097 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00098"></a>00098 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00099"></a>00099 errorString_ << <span class="stringliteral">"Instrmnt::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00101"></a>00101 }
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#endif</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span>
|
||||
<a name="l00104"></a>00104 StkFloat *samples = &frames[channel];
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00108"></a>00108 *samples++ = <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">else</span> {
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00112"></a>00112 *samples++ = <a class="code" href="classstk_1_1Instrmnt.html#d5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00114"></a>00114 *samples++ = lastFrame_[j];
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1Instrmnt.html#5aecf9f4d4dcecdbef8271c7fe62b2cf">00121</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#5aecf9f4d4dcecdbef8271c7fe62b2cf" title="Perform the control change specified by number and value (0.0 - 128.0).">Instrmnt :: controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 errorString_ << <span class="stringliteral">"Instrmnt::controlChange: virtual function call!"</span>;
|
||||
<a name="l00124"></a>00124 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
120
doc/html/Instrmnt_8h_source.html
Normal file
120
doc/html/Instrmnt_8h_source.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Instrmnt.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INSTRMNT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INSTRMNT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00017"></a>00017 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classstk_1_1Instrmnt.html">00019</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1Instrmnt.html#a6f3c4dc01e0484f0ca4a3b14f1b7caf0">00023</a> <a class="code" href="classstk_1_1Instrmnt.html#a6f3c4dc01e0484f0ca4a3b14f1b7caf0" title="Class constructor.">Instrmnt</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a0736ccd253b446660938d51909a32f44" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude ) = 0;
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a582c77e71cd2c5cb46ba6f78fa0ac6a2" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude ) = 0;
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a597efc508ad367a308fa11b8cbdc96a7" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a5aecf9f4d4dcecdbef8271c7fe62b2cf" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>(<span class="keywordtype">int</span> number, StkFloat value);
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Instrmnt.html#a32564b611598653fce5e708821b3fcb4">00038</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Instrmnt.html#a32564b611598653fce5e708821b3fcb4" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1Instrmnt.html#a277ac5149ec22c33d794dfd462a82d2b">00041</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#a277ac5149ec22c33d794dfd462a82d2b" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 StkFloat <a class="code" href="classstk_1_1Instrmnt.html#aaa6bd5e4a5be7f9b0be967daf012872e" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a>00058 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1Instrmnt.html#ad5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#ad5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <span class="keyword">protected</span>:
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Instrmnt.html#a597efc508ad367a308fa11b8cbdc96a7">00076</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a597efc508ad367a308fa11b8cbdc96a7" title="Set instrument parameters for a particular frequency.">Instrmnt :: setFrequency</a>(StkFloat frequency)
|
||||
<a name="l00077"></a>00077 {
|
||||
<a name="l00078"></a>00078 errorString_ << <span class="stringliteral">"Instrmnt::setFrequency: virtual setFrequency function call!"</span>;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00080"></a>00080 }
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a><a class="code" href="classstk_1_1Instrmnt.html#aaa6bd5e4a5be7f9b0be967daf012872e">00082</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Instrmnt.html#aaa6bd5e4a5be7f9b0be967daf012872e" title="Return the specified channel value of the last computed frame.">Instrmnt :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00083"></a>00083 {
|
||||
<a name="l00084"></a>00084 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00085"></a>00085 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00086"></a>00086 errorString_ << <span class="stringliteral">"Instrmnt::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089 <span class="preprocessor">#endif</span>
|
||||
<a name="l00090"></a>00090 <span class="preprocessor"></span>
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00092"></a>00092 }
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a><a class="code" href="classstk_1_1Instrmnt.html#a4abfe94b5fc8d87b47729fe317222eb9">00094</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#ad5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">Instrmnt :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00095"></a>00095 {
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00097"></a>00097 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00098"></a>00098 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00099"></a>00099 errorString_ << <span class="stringliteral">"Instrmnt::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00101"></a>00101 }
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#endif</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span>
|
||||
<a name="l00104"></a>00104 StkFloat *samples = &frames[channel];
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00108"></a>00108 *samples++ = <a class="code" href="classstk_1_1Instrmnt.html#ad5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">else</span> {
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00112"></a>00112 *samples++ = <a class="code" href="classstk_1_1Instrmnt.html#ad5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00114"></a>00114 *samples++ = lastFrame_[j];
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1Instrmnt.html#a5aecf9f4d4dcecdbef8271c7fe62b2cf">00121</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a5aecf9f4d4dcecdbef8271c7fe62b2cf" title="Perform the control change specified by number and value (0.0 - 128.0).">Instrmnt :: controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 errorString_ << <span class="stringliteral">"Instrmnt::controlChange: virtual function call!"</span>;
|
||||
<a name="l00124"></a>00124 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/JCRev_8h-source.html
Normal file
134
doc/html/JCRev_8h-source.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>JCRev.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_JCREV_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_JCREV_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1JCRev.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1JCRev.html" title="John Chowning&#39;s reverberator class.">JCRev</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1JCRev.html#5b9f0e2b7acc1fcb94a663353f1253dd" title="Class constructor taking a T60 decay time argument (one second default value).">JCRev</a>( StkFloat T60 = 1.0 );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1JCRev.html#bf92e9783e4a738b6d3a3350bfae986e" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1JCRev.html#8f4caa6de1e662c76b853ebab814a2eb" title="Set the reverberation T60 decay time.">setT60</a>( StkFloat T60 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00045"></a>00045 StkFloat <a class="code" href="classstk_1_1JCRev.html#599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keyword">protected</span>:
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allpassDelays_[3];
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelays_[4];
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outLeftDelay_;
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outRightDelay_;
|
||||
<a name="l00087"></a>00087 StkFloat allpassCoefficient_;
|
||||
<a name="l00088"></a>00088 StkFloat combCoefficient_[4];
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 };
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1JCRev.html#599e46bcfbc2b4b9a30a30d67580412b">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">JCRev :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00095"></a>00095 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00096"></a>00096 errorString_ << <span class="stringliteral">"JCRev::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#endif</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span>
|
||||
<a name="l00101"></a>00101 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00102"></a>00102 }
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a><a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#d667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">JCRev :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00105"></a>00105 {
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00108"></a>00108 errorString_ << <span class="stringliteral">"JCRev::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00110"></a>00110 }
|
||||
<a name="l00111"></a>00111 <span class="preprocessor">#endif</span>
|
||||
<a name="l00112"></a>00112 <span class="preprocessor"></span>
|
||||
<a name="l00113"></a>00113 StkFloat temp, temp0, temp1, temp2, temp3, temp4, temp5, temp6;
|
||||
<a name="l00114"></a>00114 StkFloat filtout;
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 temp = allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00117"></a>00117 temp0 = allpassCoefficient_ * temp;
|
||||
<a name="l00118"></a>00118 temp0 += input;
|
||||
<a name="l00119"></a>00119 allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp0);
|
||||
<a name="l00120"></a>00120 temp0 = -(allpassCoefficient_ * temp0) + temp;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 temp = allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00123"></a>00123 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00124"></a>00124 temp1 += temp0;
|
||||
<a name="l00125"></a>00125 allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp1);
|
||||
<a name="l00126"></a>00126 temp1 = -(allpassCoefficient_ * temp1) + temp;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 temp = allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00129"></a>00129 temp2 = allpassCoefficient_ * temp;
|
||||
<a name="l00130"></a>00130 temp2 += temp1;
|
||||
<a name="l00131"></a>00131 allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp2);
|
||||
<a name="l00132"></a>00132 temp2 = -(allpassCoefficient_ * temp2) + temp;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 temp3 = temp2 + (combCoefficient_[0] * combDelays_[0].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00135"></a>00135 temp4 = temp2 + (combCoefficient_[1] * combDelays_[1].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00136"></a>00136 temp5 = temp2 + (combCoefficient_[2] * combDelays_[2].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00137"></a>00137 temp6 = temp2 + (combCoefficient_[3] * combDelays_[3].<a class="code" href="classstk_1_1Delay.html#7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 combDelays_[0].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp3);
|
||||
<a name="l00140"></a>00140 combDelays_[1].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp4);
|
||||
<a name="l00141"></a>00141 combDelays_[2].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp5);
|
||||
<a name="l00142"></a>00142 combDelays_[3].<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp6);
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 filtout = temp3 + temp4 + temp5 + temp6;
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 lastFrame_[0] = effectMix_ * (outLeftDelay_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00147"></a>00147 lastFrame_[1] = effectMix_ * (outRightDelay_.<a class="code" href="classstk_1_1Delay.html#a1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00148"></a>00148 temp = (1.0 - effectMix_) * input;
|
||||
<a name="l00149"></a>00149 lastFrame_[0] += temp;
|
||||
<a name="l00150"></a>00150 lastFrame_[1] += temp;
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
<a name="l00158"></a>00158 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/JCRev_8h_source.html
Normal file
134
doc/html/JCRev_8h_source.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>JCRev.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_JCREV_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_JCREV_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1JCRev.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1JCRev.html" title="John Chowning&#39;s reverberator class.">JCRev</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1JCRev.html#a5b9f0e2b7acc1fcb94a663353f1253dd" title="Class constructor taking a T60 decay time argument (one second default value).">JCRev</a>( StkFloat T60 = 1.0 );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1JCRev.html#abf92e9783e4a738b6d3a3350bfae986e" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1JCRev.html#a8f4caa6de1e662c76b853ebab814a2eb" title="Set the reverberation T60 decay time.">setT60</a>( StkFloat T60 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00045"></a>00045 StkFloat <a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keyword">protected</span>:
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allpassDelays_[3];
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelays_[4];
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outLeftDelay_;
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outRightDelay_;
|
||||
<a name="l00087"></a>00087 StkFloat allpassCoefficient_;
|
||||
<a name="l00088"></a>00088 StkFloat combCoefficient_[4];
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 };
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">JCRev :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00095"></a>00095 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00096"></a>00096 errorString_ << <span class="stringliteral">"JCRev::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#endif</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span>
|
||||
<a name="l00101"></a>00101 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00102"></a>00102 }
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a><a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">JCRev :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00105"></a>00105 {
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00108"></a>00108 errorString_ << <span class="stringliteral">"JCRev::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00110"></a>00110 }
|
||||
<a name="l00111"></a>00111 <span class="preprocessor">#endif</span>
|
||||
<a name="l00112"></a>00112 <span class="preprocessor"></span>
|
||||
<a name="l00113"></a>00113 StkFloat temp, temp0, temp1, temp2, temp3, temp4, temp5, temp6;
|
||||
<a name="l00114"></a>00114 StkFloat filtout;
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 temp = allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00117"></a>00117 temp0 = allpassCoefficient_ * temp;
|
||||
<a name="l00118"></a>00118 temp0 += input;
|
||||
<a name="l00119"></a>00119 allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp0);
|
||||
<a name="l00120"></a>00120 temp0 = -(allpassCoefficient_ * temp0) + temp;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 temp = allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00123"></a>00123 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00124"></a>00124 temp1 += temp0;
|
||||
<a name="l00125"></a>00125 allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp1);
|
||||
<a name="l00126"></a>00126 temp1 = -(allpassCoefficient_ * temp1) + temp;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 temp = allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00129"></a>00129 temp2 = allpassCoefficient_ * temp;
|
||||
<a name="l00130"></a>00130 temp2 += temp1;
|
||||
<a name="l00131"></a>00131 allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp2);
|
||||
<a name="l00132"></a>00132 temp2 = -(allpassCoefficient_ * temp2) + temp;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 temp3 = temp2 + (combCoefficient_[0] * combDelays_[0].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00135"></a>00135 temp4 = temp2 + (combCoefficient_[1] * combDelays_[1].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00136"></a>00136 temp5 = temp2 + (combCoefficient_[2] * combDelays_[2].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00137"></a>00137 temp6 = temp2 + (combCoefficient_[3] * combDelays_[3].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 combDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp3);
|
||||
<a name="l00140"></a>00140 combDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp4);
|
||||
<a name="l00141"></a>00141 combDelays_[2].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp5);
|
||||
<a name="l00142"></a>00142 combDelays_[3].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp6);
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 filtout = temp3 + temp4 + temp5 + temp6;
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 lastFrame_[0] = effectMix_ * (outLeftDelay_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00147"></a>00147 lastFrame_[1] = effectMix_ * (outRightDelay_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00148"></a>00148 temp = (1.0 - effectMix_) * input;
|
||||
<a name="l00149"></a>00149 lastFrame_[0] += temp;
|
||||
<a name="l00150"></a>00150 lastFrame_[1] += temp;
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
<a name="l00158"></a>00158 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/JetTable_8h-source.html
Normal file
107
doc/html/JetTable_8h-source.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>JetTable.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_JETTABL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_JETTABL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1JetTable.html">00023</a> <span class="keyword">class </span><a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00024"></a>00024 {
|
||||
<a name="l00025"></a>00025 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 StkFloat <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00052"></a>00052 };
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00054"></a><a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6">00054</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( StkFloat input )
|
||||
<a name="l00055"></a>00055 {
|
||||
<a name="l00056"></a>00056 <span class="comment">// Perform "table lookup" using a polynomial</span>
|
||||
<a name="l00057"></a>00057 <span class="comment">// calculation (x^3 - x), which approximates</span>
|
||||
<a name="l00058"></a>00058 <span class="comment">// the jet sigmoid behavior.</span>
|
||||
<a name="l00059"></a>00059 lastFrame_[0] = input * (input * input - 1.0);
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00061"></a>00061 <span class="comment">// Saturate at +/- 1.0.</span>
|
||||
<a name="l00062"></a>00062 <span class="keywordflow">if</span> ( lastFrame_[0] > 1.0 ) lastFrame_[0] = 1.0;
|
||||
<a name="l00063"></a>00063 <span class="keywordflow">if</span> ( lastFrame_[0] < -1.0 ) lastFrame_[0] = -1.0;
|
||||
<a name="l00064"></a>00064 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00065"></a>00065 }
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a><a class="code" href="classstk_1_1JetTable.html#e17ee82b1ed7b185713b4ae0b7c2b0cd">00067</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00068"></a>00068 {
|
||||
<a name="l00069"></a>00069 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00070"></a>00070 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00071"></a>00071 errorString_ << <span class="stringliteral">"JetTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00073"></a>00073 }
|
||||
<a name="l00074"></a>00074 <span class="preprocessor">#endif</span>
|
||||
<a name="l00075"></a>00075 <span class="preprocessor"></span>
|
||||
<a name="l00076"></a>00076 StkFloat *samples = &frames[channel];
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00079"></a>00079 *samples = *samples * (*samples * *samples - 1.0);
|
||||
<a name="l00080"></a>00080 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00081"></a>00081 <span class="keywordflow">if</span> ( *samples < -1.0) *samples = -1.0;
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00086"></a>00086 }
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a><a class="code" href="classstk_1_1JetTable.html#7b261fd07b2325348ef14e3f0ebf8429">00088</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00089"></a>00089 {
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00092"></a>00092 errorString_ << <span class="stringliteral">"JetTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Stk.html#48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#endif</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span>
|
||||
<a name="l00097"></a>00097 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00098"></a>00098 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#ec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00101"></a>00101 *oSamples = *oSamples * (*oSamples * *oSamples - 1.0);
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">if</span> ( *oSamples < -1.0) *oSamples = -1.0;
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/JetTable_8h_source.html
Normal file
107
doc/html/JetTable_8h_source.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>JetTable.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_JETTABL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_JETTABL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1JetTable.html">00023</a> <span class="keyword">class </span><a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00024"></a>00024 {
|
||||
<a name="l00025"></a>00025 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 StkFloat <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00052"></a>00052 };
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00054"></a><a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6">00054</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( StkFloat input )
|
||||
<a name="l00055"></a>00055 {
|
||||
<a name="l00056"></a>00056 <span class="comment">// Perform "table lookup" using a polynomial</span>
|
||||
<a name="l00057"></a>00057 <span class="comment">// calculation (x^3 - x), which approximates</span>
|
||||
<a name="l00058"></a>00058 <span class="comment">// the jet sigmoid behavior.</span>
|
||||
<a name="l00059"></a>00059 lastFrame_[0] = input * (input * input - 1.0);
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00061"></a>00061 <span class="comment">// Saturate at +/- 1.0.</span>
|
||||
<a name="l00062"></a>00062 <span class="keywordflow">if</span> ( lastFrame_[0] > 1.0 ) lastFrame_[0] = 1.0;
|
||||
<a name="l00063"></a>00063 <span class="keywordflow">if</span> ( lastFrame_[0] < -1.0 ) lastFrame_[0] = -1.0;
|
||||
<a name="l00064"></a>00064 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00065"></a>00065 }
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a><a class="code" href="classstk_1_1JetTable.html#ae17ee82b1ed7b185713b4ae0b7c2b0cd">00067</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00068"></a>00068 {
|
||||
<a name="l00069"></a>00069 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00070"></a>00070 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00071"></a>00071 errorString_ << <span class="stringliteral">"JetTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00073"></a>00073 }
|
||||
<a name="l00074"></a>00074 <span class="preprocessor">#endif</span>
|
||||
<a name="l00075"></a>00075 <span class="preprocessor"></span>
|
||||
<a name="l00076"></a>00076 StkFloat *samples = &frames[channel];
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00079"></a>00079 *samples = *samples * (*samples * *samples - 1.0);
|
||||
<a name="l00080"></a>00080 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00081"></a>00081 <span class="keywordflow">if</span> ( *samples < -1.0) *samples = -1.0;
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00086"></a>00086 }
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a><a class="code" href="classstk_1_1JetTable.html#a7b261fd07b2325348ef14e3f0ebf8429">00088</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00089"></a>00089 {
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00092"></a>00092 errorString_ << <span class="stringliteral">"JetTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#endif</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span>
|
||||
<a name="l00097"></a>00097 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00098"></a>00098 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00101"></a>00101 *oSamples = *oSamples * (*oSamples * *oSamples - 1.0);
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">if</span> ( *oSamples < -1.0) *oSamples = -1.0;
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
259
doc/html/LentPitShift_8h_source.html
Normal file
259
doc/html/LentPitShift_8h_source.html
Normal file
@@ -0,0 +1,259 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>LentPitShift.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_LENLentPitShift_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_LENLentPitShift_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1LentPitShift.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1LentPitShift.html" title="Pitch shifter effect class based on the Lent algorithm.">LentPitShift</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024 <a class="code" href="classstk_1_1LentPitShift.html#a0eb0c1ba3d8fdb6eaabb1c96c58ed536" title="Class constructor.">LentPitShift</a>( StkFloat periodRatio = 1.0, <span class="keywordtype">int</span> tMax = RT_BUFFER_SIZE );
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a>00026 ~<a class="code" href="classstk_1_1LentPitShift.html" title="Pitch shifter effect class based on the Lent algorithm.">LentPitShift</a>( <span class="keywordtype">void</span> ) {
|
||||
<a name="l00027"></a>00027 <span class="keyword">delete</span> window;
|
||||
<a name="l00028"></a>00028 window = NULL;
|
||||
<a name="l00029"></a>00029 <span class="keyword">delete</span> dt;
|
||||
<a name="l00030"></a>00030 dt = NULL;
|
||||
<a name="l00031"></a>00031 <span class="keyword">delete</span> dpt;
|
||||
<a name="l00032"></a>00032 dpt = NULL;
|
||||
<a name="l00033"></a>00033 <span class="keyword">delete</span> cumDt;
|
||||
<a name="l00034"></a>00034 cumDt = NULL;
|
||||
<a name="l00035"></a>00035 }
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5661bf4cd0a4b5b2bf9e4e81603c74be" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5dfe0a19b2ac3db599c808f4d676c076" title="Set the pitch shift factor (1.0 produces no shift).">setShift</a>( StkFloat shift );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 StkFloat <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00055"></a>00055 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00066"></a>00066 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <span class="keyword">protected</span>:
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445" title="Apply the effect on the input samples and store it.">process</a>( );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 <span class="comment">// Frame storage vectors for process function</span>
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> inputFrames;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> outputFrames;
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">int</span> ptrFrames; <span class="comment">// writing pointer</span>
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="comment">// Input delay line</span>
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> inputLine_;
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">int</span> inputPtr;
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="comment">// Output delay line</span>
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outputLine_;
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">double</span> outputPtr;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="comment">// Pitch tracker variables</span>
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tMax_; <span class="comment">// Maximal period measurable by the pitch tracker.</span>
|
||||
<a name="l00092"></a>00092 <span class="comment">// It is also the size of the window used by the pitch tracker and</span>
|
||||
<a name="l00093"></a>00093 <span class="comment">// the size of the frames that can be computed by the tick function</span>
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 StkFloat threshold_; <span class="comment">// Threshold of detection for the pitch tracker</span>
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> lastPeriod_; <span class="comment">// Result of the last pitch tracking loop</span>
|
||||
<a name="l00097"></a>00097 StkFloat* dt; <span class="comment">// Array containing the euclidian distance coefficients</span>
|
||||
<a name="l00098"></a>00098 StkFloat* cumDt; <span class="comment">// Array containing the cumulative sum of the coefficients in dt</span>
|
||||
<a name="l00099"></a>00099 StkFloat* dpt; <span class="comment">// Array containing the pitch tracking function coefficients</span>
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="comment">// Pitch shifter variables</span>
|
||||
<a name="l00102"></a>00102 StkFloat env[2]; <span class="comment">// Coefficients for the linear interpolation when modifying the output samples</span>
|
||||
<a name="l00103"></a>00103 StkFloat* window; <span class="comment">// Hamming window used for the input portion extraction</span>
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">double</span> periodRatio_; <span class="comment">// Ratio of modification of the signal period</span>
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> zeroFrame; <span class="comment">// Frame of tMax_ zero samples</span>
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Coefficient delay line that could be used for a dynamic calculation of the pitch</span>
|
||||
<a name="l00109"></a>00109 <span class="comment">//Delay* coeffLine_;</span>
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 };
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a><a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445">00113</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445" title="Apply the effect on the input samples and store it.">LentPitShift::process</a>()
|
||||
<a name="l00114"></a>00114 {
|
||||
<a name="l00115"></a>00115 StkFloat x_t; <span class="comment">// input coefficient</span>
|
||||
<a name="l00116"></a>00116 StkFloat x_t_T; <span class="comment">// previous input coefficient at T samples</span>
|
||||
<a name="l00117"></a>00117 StkFloat coeff; <span class="comment">// new coefficient for the difference function</span>
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">int</span> alternativePitch = tMax_; <span class="comment">// Global minimum storage</span>
|
||||
<a name="l00120"></a>00120 lastPeriod_ = tMax_+1; <span class="comment">// Storage of the lowest local minimum under the threshold</span>
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="comment">// Loop variables</span>
|
||||
<a name="l00123"></a>00123 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay_;
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n;
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">// Initialization of the dt coefficients. Since the</span>
|
||||
<a name="l00127"></a>00127 <span class="comment">// frames are of tMax_ length, there is no overlapping</span>
|
||||
<a name="l00128"></a>00128 <span class="comment">// between the successive windows where pitch tracking</span>
|
||||
<a name="l00129"></a>00129 <span class="comment">// is performed.</span>
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">for</span> ( delay_=1; delay_<=tMax_; delay_++ )
|
||||
<a name="l00131"></a>00131 dt[delay_] = 0.;
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 <span class="comment">// Calculation of the dt coefficients and update of the input delay line.</span>
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">for</span> ( n=0; n<inputFrames.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); n++ ) {
|
||||
<a name="l00135"></a>00135 x_t = inputLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( inputFrames[ n ] );
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">for</span> ( delay_=1; delay_<= tMax_; delay_++ ) {
|
||||
<a name="l00137"></a>00137 x_t_T = inputLine_.<a class="code" href="classstk_1_1Delay.html#a7d4c9c21e752f860ba683e9849d14665" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>( delay_ );
|
||||
<a name="l00138"></a>00138 coeff = x_t - x_t_T;
|
||||
<a name="l00139"></a>00139 dt[delay_] += coeff * coeff;
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="comment">// Calculation of the pitch tracking function and test for the minima.</span>
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">for</span> ( delay_=1; delay_<=tMax_; delay_++ ) {
|
||||
<a name="l00145"></a>00145 cumDt[delay_] = dt[delay_] + cumDt[delay_-1];
|
||||
<a name="l00146"></a>00146 dpt[delay_] = dt[delay_] * delay_ / cumDt[delay_];
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="comment">// Look for a minimum</span>
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">if</span> ( dpt[delay_-1]-dpt[delay_-2] < 0 && dpt[delay_]-dpt[delay_-1] > 0 ) {
|
||||
<a name="l00150"></a>00150 <span class="comment">// Check if the minimum is under the threshold</span>
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">if</span> ( dpt[delay_-1] < threshold_ ){
|
||||
<a name="l00152"></a>00152 lastPeriod_ = delay_-1;
|
||||
<a name="l00153"></a>00153 <span class="comment">// If a minimum is found, we can stop the loop</span>
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">break</span>;
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( dpt[alternativePitch] > dpt[delay_-1] )
|
||||
<a name="l00157"></a>00157 <span class="comment">// Otherwise we store it if it is the current global minimum</span>
|
||||
<a name="l00158"></a>00158 alternativePitch = delay_-1;
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160 }
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="comment">// Test for the last period length.</span>
|
||||
<a name="l00163"></a>00163 <span class="keywordflow">if</span> ( dpt[delay_]-dpt[delay_-1] < 0 ) {
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">if</span> ( dpt[delay_] < threshold_ )
|
||||
<a name="l00165"></a>00165 lastPeriod_ = delay_;
|
||||
<a name="l00166"></a>00166 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( dpt[alternativePitch] > dpt[delay_] )
|
||||
<a name="l00167"></a>00167 alternativePitch = delay_;
|
||||
<a name="l00168"></a>00168 }
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a>00170 <span class="keywordflow">if</span> ( lastPeriod_ == tMax_+1 )
|
||||
<a name="l00171"></a>00171 <span class="comment">// No period has been under the threshold so we used the global minimum</span>
|
||||
<a name="l00172"></a>00172 lastPeriod_ = alternativePitch;
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a>00174 <span class="comment">// We put the new zero output coefficients in the output delay line and </span>
|
||||
<a name="l00175"></a>00175 <span class="comment">// we get the previous calculated coefficients</span>
|
||||
<a name="l00176"></a>00176 outputLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( zeroFrame, outputFrames );
|
||||
<a name="l00177"></a>00177
|
||||
<a name="l00178"></a>00178 <span class="comment">// Initialization of the Hamming window used in the algorithm</span>
|
||||
<a name="l00179"></a>00179 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> n=-(<span class="keywordtype">int</span>)lastPeriod_; n<(int)lastPeriod_; n++ )
|
||||
<a name="l00180"></a>00180 window[n+lastPeriod_] = (1 + cos(PI*n/lastPeriod_)) / 2 ;
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 <span class="keywordtype">int</span> M; <span class="comment">// Index of reading in the input delay line</span>
|
||||
<a name="l00183"></a>00183 <span class="keywordtype">int</span> N; <span class="comment">// Index of writing in the output delay line</span>
|
||||
<a name="l00184"></a>00184 <span class="keywordtype">double</span> sample; <span class="comment">// Temporary storage for the new coefficient</span>
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00186"></a>00186 <span class="comment">// We loop for all the frames of length lastPeriod_ presents between inputPtr and tMax_</span>
|
||||
<a name="l00187"></a>00187 <span class="keywordflow">for</span> ( ; inputPtr<(int)(tMax_-lastPeriod_); inputPtr+=lastPeriod_ ) {
|
||||
<a name="l00188"></a>00188 <span class="comment">// Test for the decision of compression/expansion</span>
|
||||
<a name="l00189"></a>00189 <span class="keywordflow">while</span> ( outputPtr < inputPtr ) {
|
||||
<a name="l00190"></a>00190 <span class="comment">// Coefficients for the linear interpolation</span>
|
||||
<a name="l00191"></a>00191 env[1] = fmod( outputPtr + tMax_, 1.0 );
|
||||
<a name="l00192"></a>00192 env[0] = 1.0 - env[1];
|
||||
<a name="l00193"></a>00193 M = tMax_ - inputPtr + lastPeriod_ - 1; <span class="comment">// New reading pointer</span>
|
||||
<a name="l00194"></a>00194 N = 2*tMax_ - (<span class="keywordtype">unsigned</span> long)floor(outputPtr + tMax_) + lastPeriod_ - 1; <span class="comment">// New writing pointer</span>
|
||||
<a name="l00195"></a>00195 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<2*lastPeriod_; j++,M--,N-- ) {
|
||||
<a name="l00196"></a>00196 sample = inputLine_.<a class="code" href="classstk_1_1Delay.html#a7d4c9c21e752f860ba683e9849d14665" title="Return the value at tapDelay samples from the delay-line input.">contentsAt</a>(M) * window[j] / 2.;
|
||||
<a name="l00197"></a>00197 <span class="comment">// Linear interpolation</span>
|
||||
<a name="l00198"></a>00198 outputLine_.<a class="code" href="classstk_1_1Delay.html#aea5580dd84ea6982d1f7b92b53314118" title="Sum the provided value into the delay line at tapDelay samples from the input.">addTo</a>(N, env[0] * sample);
|
||||
<a name="l00199"></a>00199 outputLine_.<a class="code" href="classstk_1_1Delay.html#aea5580dd84ea6982d1f7b92b53314118" title="Sum the provided value into the delay line at tapDelay samples from the input.">addTo</a>(N-1, env[1] * sample);
|
||||
<a name="l00200"></a>00200 }
|
||||
<a name="l00201"></a>00201 outputPtr = outputPtr + lastPeriod_ * periodRatio_; <span class="comment">// new output pointer</span>
|
||||
<a name="l00202"></a>00202 }
|
||||
<a name="l00203"></a>00203 }
|
||||
<a name="l00204"></a>00204 <span class="comment">// Shifting of the pointers waiting for the new frame of length tMax_.</span>
|
||||
<a name="l00205"></a>00205 outputPtr -= tMax_;
|
||||
<a name="l00206"></a>00206 inputPtr -= tMax_;
|
||||
<a name="l00207"></a>00207 }
|
||||
<a name="l00208"></a>00208
|
||||
<a name="l00209"></a>00209
|
||||
<a name="l00210"></a><a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d">00210</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">LentPitShift :: tick</a>( StkFloat input )
|
||||
<a name="l00211"></a>00211 {
|
||||
<a name="l00212"></a>00212 StkFloat sample;
|
||||
<a name="l00213"></a>00213
|
||||
<a name="l00214"></a>00214 inputFrames[ptrFrames] = input;
|
||||
<a name="l00215"></a>00215
|
||||
<a name="l00216"></a>00216 sample = outputFrames[ptrFrames++];
|
||||
<a name="l00217"></a>00217
|
||||
<a name="l00218"></a>00218 <span class="comment">// Check for end condition</span>
|
||||
<a name="l00219"></a>00219 <span class="keywordflow">if</span> ( ptrFrames == (<span class="keywordtype">int</span>) inputFrames.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ){
|
||||
<a name="l00220"></a>00220 ptrFrames = 0;
|
||||
<a name="l00221"></a>00221 <a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445" title="Apply the effect on the input samples and store it.">process</a>( );
|
||||
<a name="l00222"></a>00222 }
|
||||
<a name="l00223"></a>00223
|
||||
<a name="l00224"></a>00224 <span class="keywordflow">return</span> sample;
|
||||
<a name="l00225"></a>00225 }
|
||||
<a name="l00226"></a>00226
|
||||
<a name="l00227"></a><a class="code" href="classstk_1_1LentPitShift.html#a158cb313f45bbae6ee327cbc539abdd1">00227</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">LentPitShift :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00228"></a>00228 {
|
||||
<a name="l00229"></a>00229 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00230"></a>00230 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00231"></a>00231 errorString_ << <span class="stringliteral">"LentPitShift::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00232"></a>00232 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00233"></a>00233 }
|
||||
<a name="l00234"></a>00234 <span class="preprocessor">#endif</span>
|
||||
<a name="l00235"></a>00235 <span class="preprocessor"></span>
|
||||
<a name="l00236"></a>00236 StkFloat *samples = &frames[channel];
|
||||
<a name="l00237"></a>00237 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00238"></a>00238 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00239"></a>00239 *samples = <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( *samples );
|
||||
<a name="l00240"></a>00240 }
|
||||
<a name="l00241"></a>00241
|
||||
<a name="l00242"></a>00242 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00243"></a>00243 }
|
||||
<a name="l00244"></a>00244
|
||||
<a name="l00245"></a><a class="code" href="classstk_1_1LentPitShift.html#af93de733eedca65de40597bd4a1f7b2a">00245</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">LentPitShift :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00246"></a>00246 {
|
||||
<a name="l00247"></a>00247 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00248"></a>00248 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00249"></a>00249 errorString_ << <span class="stringliteral">"LentPitShift::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00250"></a>00250 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00251"></a>00251 }
|
||||
<a name="l00252"></a>00252 <span class="preprocessor">#endif</span>
|
||||
<a name="l00253"></a>00253 <span class="preprocessor"></span>
|
||||
<a name="l00254"></a>00254 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00255"></a>00255 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00256"></a>00256 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00257"></a>00257 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00258"></a>00258 *oSamples = <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( *iSamples );
|
||||
<a name="l00259"></a>00259 }
|
||||
<a name="l00260"></a>00260
|
||||
<a name="l00261"></a>00261 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00262"></a>00262 }
|
||||
<a name="l00263"></a>00263
|
||||
<a name="l00264"></a>00264 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00265"></a>00265
|
||||
<a name="l00266"></a>00266 <span class="preprocessor">#endif</span>
|
||||
<a name="l00267"></a>00267 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
95
doc/html/Mandolin_8h-source.html
Normal file
95
doc/html/Mandolin_8h-source.html
Normal file
@@ -0,0 +1,95 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.5.8 -->
|
||||
<div class="navpath"><a class="el" href="dir_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Mandolin.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MANDOLIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MANDOLIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "PluckTwo.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Mandolin.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Mandolin.html" title="STK mandolin instrument model class.">Mandolin</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1PluckTwo.html" title="STK enhanced plucked string model class.">PluckTwo</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Mandolin.html#5b2aaaf5697cbe57df62b568982f6300" title="Class constructor, taking the lowest desired playing frequency.">Mandolin</a>( StkFloat lowestFrequency );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Mandolin.html#92d50a0f0c1c974683bf4685cfc6ff86" title="Class destructor.">~Mandolin</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude,StkFloat position );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#8b60733652e54f1d6c93d63c915c9ca7" title="Start a note with the given frequency and amplitude (0.0 - 1.0).">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#21a5b0669b013cfd9c7142174530f629" title="Set the body size (a value of 1.0 produces the &quot;default&quot; size).">setBodySize</a>( StkFloat size );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#bf341aa5e7d751012178ff7b853b73a1" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 StkFloat <a class="code" href="classstk_1_1Mandolin.html#99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> *soundfile_[12];
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">int</span> mic_;
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">long</span> dampTime_;
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">bool</span> waveDone_;
|
||||
<a name="l00071"></a>00071 };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Mandolin.html#99f5b51e76c97299dd8c58f27a6d0e62">00073</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Mandolin.html#99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">Mandolin :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00074"></a>00074 {
|
||||
<a name="l00075"></a>00075 StkFloat temp = 0.0;
|
||||
<a name="l00076"></a>00076 <span class="keywordflow">if</span> ( !waveDone_ ) {
|
||||
<a name="l00077"></a>00077 <span class="comment">// Scale the pluck excitation with comb</span>
|
||||
<a name="l00078"></a>00078 <span class="comment">// filtering for the duration of the file.</span>
|
||||
<a name="l00079"></a>00079 temp = soundfile_[mic_]-><a class="code" href="classstk_1_1FileWvIn.html#da668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>() * pluckAmplitude_;
|
||||
<a name="l00080"></a>00080 temp = temp - combDelay_.<a class="code" href="classstk_1_1DelayL.html#1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00081"></a>00081 waveDone_ = soundfile_[mic_]-><a class="code" href="classstk_1_1FileWvIn.html#ca9ad0c12af3323e7bbf877513b0d10b" title="Query whether reading is complete.">isFinished</a>();
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="comment">// Damping hack to help avoid overflow on re-plucking.</span>
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">if</span> ( dampTime_ >=0 ) {
|
||||
<a name="l00086"></a>00086 dampTime_ -= 1;
|
||||
<a name="l00087"></a>00087 <span class="comment">// Calculate 1st delay filtered reflection plus pluck excitation.</span>
|
||||
<a name="l00088"></a>00088 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * 0.7) ) );
|
||||
<a name="l00089"></a>00089 <span class="comment">// Calculate 2nd delay just like the 1st.</span>
|
||||
<a name="l00090"></a>00090 lastFrame_[0] += delayLine2_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter2_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine2_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * 0.7) ) );
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092 <span class="keywordflow">else</span> { <span class="comment">// No damping hack after 1 period.</span>
|
||||
<a name="l00093"></a>00093 <span class="comment">// Calculate 1st delay filtered reflection plus pluck excitation.</span>
|
||||
<a name="l00094"></a>00094 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_) ) );
|
||||
<a name="l00095"></a>00095 <span class="comment">// Calculate 2nd delay just like the 1st.</span>
|
||||
<a name="l00096"></a>00096 lastFrame_[0] += delayLine2_.<a class="code" href="classstk_1_1DelayA.html#e602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter2_.<a class="code" href="classstk_1_1OneZero.html#9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine2_.<a class="code" href="classstk_1_1DelayA.html#4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_) ) );
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 lastFrame_[0] *= 0.3;
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00101"></a>00101 }
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
95
doc/html/Mandolin_8h_source.html
Normal file
95
doc/html/Mandolin_8h_source.html
Normal file
@@ -0,0 +1,95 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<CENTER>
|
||||
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
||||
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Mandolin.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MANDOLIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MANDOLIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "PluckTwo.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Mandolin.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Mandolin.html" title="STK mandolin instrument model class.">Mandolin</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1PluckTwo.html" title="STK enhanced plucked string model class.">PluckTwo</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Mandolin.html#a5b2aaaf5697cbe57df62b568982f6300" title="Class constructor, taking the lowest desired playing frequency.">Mandolin</a>( StkFloat lowestFrequency );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Mandolin.html#a92d50a0f0c1c974683bf4685cfc6ff86" title="Class destructor.">~Mandolin</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude,StkFloat position );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a8b60733652e54f1d6c93d63c915c9ca7" title="Start a note with the given frequency and amplitude (0.0 - 1.0).">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a21a5b0669b013cfd9c7142174530f629" title="Set the body size (a value of 1.0 produces the &quot;default&quot; size).">setBodySize</a>( StkFloat size );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#abf341aa5e7d751012178ff7b853b73a1" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 StkFloat <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> *soundfile_[12];
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">int</span> mic_;
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">long</span> dampTime_;
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">bool</span> waveDone_;
|
||||
<a name="l00071"></a>00071 };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62">00073</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">Mandolin :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00074"></a>00074 {
|
||||
<a name="l00075"></a>00075 StkFloat temp = 0.0;
|
||||
<a name="l00076"></a>00076 <span class="keywordflow">if</span> ( !waveDone_ ) {
|
||||
<a name="l00077"></a>00077 <span class="comment">// Scale the pluck excitation with comb</span>
|
||||
<a name="l00078"></a>00078 <span class="comment">// filtering for the duration of the file.</span>
|
||||
<a name="l00079"></a>00079 temp = soundfile_[mic_]-><a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>() * pluckAmplitude_;
|
||||
<a name="l00080"></a>00080 temp = temp - combDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00081"></a>00081 waveDone_ = soundfile_[mic_]-><a class="code" href="classstk_1_1FileWvIn.html#aca9ad0c12af3323e7bbf877513b0d10b" title="Query whether reading is complete.">isFinished</a>();
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="comment">// Damping hack to help avoid overflow on re-plucking.</span>
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">if</span> ( dampTime_ >=0 ) {
|
||||
<a name="l00086"></a>00086 dampTime_ -= 1;
|
||||
<a name="l00087"></a>00087 <span class="comment">// Calculate 1st delay filtered reflection plus pluck excitation.</span>
|
||||
<a name="l00088"></a>00088 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * 0.7) ) );
|
||||
<a name="l00089"></a>00089 <span class="comment">// Calculate 2nd delay just like the 1st.</span>
|
||||
<a name="l00090"></a>00090 lastFrame_[0] += delayLine2_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter2_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine2_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * 0.7) ) );
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092 <span class="keywordflow">else</span> { <span class="comment">// No damping hack after 1 period.</span>
|
||||
<a name="l00093"></a>00093 <span class="comment">// Calculate 1st delay filtered reflection plus pluck excitation.</span>
|
||||
<a name="l00094"></a>00094 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_) ) );
|
||||
<a name="l00095"></a>00095 <span class="comment">// Calculate 2nd delay just like the 1st.</span>
|
||||
<a name="l00096"></a>00096 lastFrame_[0] += delayLine2_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( filter2_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( temp + (delayLine2_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_) ) );
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 lastFrame_[0] *= 0.3;
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00101"></a>00101 }
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<HR>
|
||||
|
||||
<table>
|
||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user