File: TaoAccessPoint.h

package info (click to toggle)
taopm 1.0-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 6,972 kB
  • sloc: sh: 9,809; cpp: 5,161; yacc: 2,298; lex: 464; makefile: 434; ansic: 57
file content (103 lines) | stat: -rwxr-xr-x 2,911 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* Tao - A software package for sound synthesis with physical models
 * Copyright (C) 1993-1999 Mark Pearson
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef ACCESSPOINT_H
#define ACCESSPOINT_H

#ifdef WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif

class TaoCell;
class TaoInstrument;
class TaoGraphicsEngine;
class TaoDevice;
class TaoBow;
class TaoOutput;

#ifndef NULL
#define NULL 0
#endif

#define TAOCELLA 8
#define TAOCELLB 4
#define TAOCELLC 2
#define TAOCELLD 1

#define TAO____  0
#define TAO___D  1
#define TAO__C_  2
#define TAO__CD  3
#define TAO_B__  4
#define TAO_B_D  5
#define TAO_BC_  6
#define TAO_BCD  7
#define TAOA___  8
#define TAOA__D  9
#define TAOA_C_  10
#define TAOA_CD  11
#define TAOAB__  12
#define TAOAB_D  13
#define TAOABC_  14
#define TAOABCD  15

class DLLEXPORT TaoAccessPoint
    {
    friend class TaoInstrument;
    friend class TaoGraphicsEngine;
    friend class TaoDevice;
    friend class TaoBow;
    friend class TaoHammer;
    friend class TaoMicrophone;
    friend class TaoConnector;
    friend class TaoStop;
    friend int main(int argc, char *argv[]);
    
public:
    TaoAccessPoint();
    float getForce();
    void setForce(float f);
    float getVelocity();
    float getPosition();
    float getMass();
    TaoInstrument &getInstrument();
    void applyForce(float f);
    void clear();
    operator float();
    static void connect(TaoAccessPoint &p1, TaoAccessPoint &p2, float connectionStrength);
    static void collide(TaoAccessPoint &p1, TaoAccessPoint &p2, float connectionStrength);
    static void ground(TaoAccessPoint &p, float connectionStrength);
       
private:
    TaoInstrument *instrument;			// target instrument
    float x, y;					// normalised instrument coordinates
    float cellx, celly;				// real x and y coords in terms of
						// cell positions (i.e. 0..xmax and
						// 0..ymax).
    float X, X_, Y, Y_;				// fractional parts of cellx and celly
						// X_ = cellx - (int)cellx
						// Y_ = celly - (int)celly
						// X = 1-X_     Y=1-Y_
    TaoCell *cella, *cellb, *cellc, *celld;	// four cells nearest (*this).at(x,y)
						// a=bottom left, b=bottom right
						// c=top left, d=top right
    };

#endif