- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/Musimathics_local/Musimat/MusimatLib/Row.cpp

Go to the documentation of this file.

    00001 /* $Revision: 1.2 $ $Date: 2006/09/09 06:22:55 $ $Author: dgl $ $Name:  $ $Id: _row_8cpp-source.html,v 1.2 2006/09/09 06:22:55 dgl Exp $ */
    00002 // The Musimat Tutorial © 2006 Gareth Loy
    00003 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy
    00004 // and published exclusively by The MIT Press.
    00005 // This program is released WITHOUT ANY WARRANTY; without even the implied
    00006 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007 // For information on usage and redistribution, and for a DISCLAIMER OF ALL
    00008 // WARRANTIES, see the file, "LICENSE.txt," in this distribution.
    00009 // "Musimathics" is available here:     http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916
    00010 // Gareth Loy's Musimathics website:    http://www.musimathics.com/
    00011 // The Musimat website:                 http://www.musimat.com/
    00012 // This program is released under the terms of the GNU General Public License
    00013 // available here:                      http://www.gnu.org/licenses/gpl.txt
    00014
    00018
    00019 #include "Musimat.h"
    00020
    00021 Integer InterpTendency( Real f, IntegerList L1, Integer Reference pos1, IntegerList L2, Integer Reference pos2, Integer inc ) {
    00022         Integer x = cycle<Integer,IntegerList>(L1, pos1, inc);
    00023         Integer y = cycle<Integer,IntegerList>(L2, pos2, inc);
    00024         Return( Integer( Round( unitInterp( f, x, y ) ) ) );
    00025 }
    00026
    00027 Pitch LinearInterpolate( Pitch x, Pitch xMin, Pitch xMax, Pitch yMin, Pitch yMax ) {
    00028         Real xr = x.degree();
    00029         Real xm = xMin.degree();
    00030         Real xM = xMax.degree();
    00031         Real ym = yMin.degree();
    00032         Real yM = yMax.degree();
    00033         Real a = ( xr - xm) / (xM - xm );
    00034         Real b = yM - ym;
    00035         Return( Integer(a * b + ym) );
    00036 }