• Main Page
  • Modules
  • Classes
  • Files
  • File List
  • File Members

/Users/garethloy/Musimathics/Musimat1.2/MusimatLib/Row.cpp

Go to the documentation of this file.
00001 /* $Revision: 1.3 $ $Date: 2006/09/05 08:02:54 $ $Author: dgl $ $Name:  $ $Id: Row.cpp,v 1.3 2006/09/05 08:02:54 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 }

Generated on Fri Nov 26 2010 16:18:25 for MusimatLib by  doxygen 1.7.2