Functions | |
| void | B0100 () |
| void | B0101 () |
| void | B0102 () |
| void | B0103 () |
| void | B0104 () |
| void | B0105 () |
| void | B0106 () |
| void | B0107 () |
| void | B0108 () |
| void | B0109 () |
| void | B0110 () |
| void | B0111 () |
| void | B0112 () |
| void | B0113 () |
| void | B0114 () |
| void | B0115 () |
| void | B0116 () |
| void | B0117 () |
| void | B0118 () |
| void | B0119 () |
| void | B0120 () |
| void | B0121 () |
| void | B0122 () |
| void | B0123 () |
| void | B0124 () |
| void | B0125 () |
| void | B0126 () |
| void | B0127 () |
| void | B0128 () |
| void | B0129 () |
| void | B0200 () |
| void | B0201 () |
| void | B0201a () |
| void | B0201b () |
| void | B0201c () |
| void | B0201d () |
| void | B0202 () |
| void | B0203 () |
| void | B0204 () |
| void | B0300 () |
| void | B0400 () |
| void | testEuclid () |
| Real | pitchToHz (Pitch, Real, RealList) |
| void MusimatTutorial::B0100 | ( | ) |
| void MusimatTutorial::B0101 | ( | ) |
| void MusimatTutorial::B0102 | ( | ) |
| void MusimatTutorial::B0103 | ( | ) |
| void MusimatTutorial::B0104 | ( | ) |
| void MusimatTutorial::B0105 | ( | ) |
| void MusimatTutorial::B0106 | ( | ) |
| void MusimatTutorial::B0107 | ( | ) |
| void MusimatTutorial::B0108 | ( | ) |
| void MusimatTutorial::B0109 | ( | ) |
| void MusimatTutorial::B0110 | ( | ) |
| void MusimatTutorial::B0111 | ( | ) |
| void MusimatTutorial::B0112 | ( | ) |
| void MusimatTutorial::B0113 | ( | ) |
| void MusimatTutorial::B0114 | ( | ) |
| void MusimatTutorial::B0115 | ( | ) |
| void MusimatTutorial::B0116 | ( | ) |
| void MusimatTutorial::B0117 | ( | ) |
| void MusimatTutorial::B0118 | ( | ) |
| void MusimatTutorial::B0119 | ( | ) |
| void MusimatTutorial::B0120 | ( | ) |
| void MusimatTutorial::B0121 | ( | ) |
| void MusimatTutorial::B0122 | ( | ) |
| void MusimatTutorial::B0123 | ( | ) |
| void MusimatTutorial::B0124 | ( | ) |
| void MusimatTutorial::B0125 | ( | ) |
| void MusimatTutorial::B0126 | ( | ) |
| void MusimatTutorial::B0127 | ( | ) |
| void MusimatTutorial::B0128 | ( | ) |
| void MusimatTutorial::B0129 | ( | ) |
| void MusimatTutorial::B0200 | ( | ) |
| void MusimatTutorial::B0201 | ( | ) |
| void MusimatTutorial::B0201a | ( | ) |
| void MusimatTutorial::B0201b | ( | ) |
| void MusimatTutorial::B0201c | ( | ) |
| void MusimatTutorial::B0201d | ( | ) |
| void MusimatTutorial::B0202 | ( | ) |
| void MusimatTutorial::B0203 | ( | ) |
| void MusimatTutorial::B0204 | ( | ) |
| void MusimatTutorial::B0300 | ( | ) |
| void MusimatTutorial::B0400 | ( | ) |
| Real MusimatTutorial::pitchToHz | ( | Pitch | , |
| Real | , | ||
| RealList | |||
| ) |
Definition at line 37 of file B0201b.cpp.
References key().
{
Integer key = PitchClass(p) + Accidental(p); // get key from pitch
Real oct = Octave(p); // get octave from pitch
Return(refC * scale[key] * Pow(2.0, (oct - 4)));// compute frequency
}
| void MusimatTutorial::testEuclid | ( | ) |
Definition at line 28 of file B0119.cpp.
{
/*****************************************************************************
The function euclid() is declared to be of type Integer because it will return an Integer result.
Note that Return(n) has been substituted for the Halt(n) function shown previously. Instead
of halting execution altogether, the Return(n) statement only exits the current function, carrying
with it the value of its argument back to the context that invoked it. The program can then continue
executing from there, if there are statements following its invocation. Here’s an example of invok-
ing the euclid() function:
*****************************************************************************/
Integer x = euclid(91, 416);
Print(x);
/*****************************************************************************
which will print 13. If we had used Halt() in euclid(), we’d never reach the Print statement
because the program would stop.
Here’s another way to compute the same thing:
*****************************************************************************/
Print(euclid(91, 416));
/*****************************************************************************
This way we can eliminate the “middleman” variable x, which only existed to carry the value from
the euclid() function to the Print() function. In this example, the call to the euclid() func-
tion is nested within the Print() function. Musimat invokes the nested function first, and the
value that euclid() returns is supplied automatically as an argument to the enclosing function,
Print(). Functions can be nested to an arbitrary extent. The most deeply nested function is
always called first.
*****************************************************************************/
}}
1.7.2