1 /*----------------------------------------------------------------------------
2 ChucK Concurrent, On-the-fly Audio Programming Language
3 Compiler and Virtual Machine
5 Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved.
6 http://chuck.cs.princeton.edu/
7 http://soundlab.cs.princeton.edu/
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 -----------------------------------------------------------------------------*/
25 //-----------------------------------------------------------------------------
27 // desc: chuck unit generator interface
29 // authors: Ge Wang (gewang@cs.princeton.edu)
30 // Perry R. Cook (prc@cs.princeton.edu)
31 // Rebecca Fiebrink (fiebrink@cs.princeton.edu)
32 // date: spring 2004 - 1.1
35 //-----------------------------------------------------------------------------
36 #ifndef __CHUCK_UGEN_H__
37 #define __CHUCK_UGEN_H__
39 #include "chuck_def.h"
45 struct Chuck_VM_Shred
;
46 struct Chuck_UAnaBlobProxy
;
50 #define UGEN_OP_PASS -1
51 #define UGEN_OP_STOP 0
52 #define UGEN_OP_TICK 1
54 //-----------------------------------------------------------------------------
55 // name: struct Chuck_UGen
57 //-----------------------------------------------------------------------------
58 struct Chuck_UGen
: public Chuck_Object
62 virtual ~Chuck_UGen( );
67 t_CKBOOL
add( Chuck_UGen
* src
, t_CKBOOL isUpChuck
);
68 t_CKBOOL
remove( Chuck_UGen
* src
);
69 t_CKVOID
remove_all( );
70 t_CKBOOL
set_max_src( t_CKUINT num
);
71 t_CKUINT
get_num_src( );
72 t_CKBOOL
is_connected_from( Chuck_UGen
* src
);
73 t_CKUINT
disconnect( t_CKBOOL recursive
);
74 t_CKUINT
system_tick( t_CKTIME now
);
77 t_CKVOID
add_by( Chuck_UGen
* dest
, t_CKBOOL isUpChuck
);
78 t_CKVOID
remove_by( Chuck_UGen
* dest
);
85 // channels (if more than one is required)
86 Chuck_UGen
** m_multi_chan
;
87 // size of m_multi_chan;
88 t_CKUINT m_multi_chan_size
;
93 // alloc multi channels
94 void alloc_multi_chan( t_CKUINT num_ins
, t_CKUINT num_outs
);
97 Chuck_UGen
** m_src_list
;
100 Chuck_UGen
** m_dest_list
;
103 Chuck_UGen
** m_src_uana_list
;
104 t_CKUINT m_src_uana_cap
;
105 t_CKUINT m_num_uana_src
;
106 Chuck_UGen
** m_dest_uana_list
;
107 t_CKUINT m_dest_uana_cap
;
108 t_CKUINT m_num_uana_dest
;
121 // the shred on which the ugen is created
122 Chuck_VM_Shred
* shred
;
133 //-----------------------------------------------------------------------------
134 // name: struct Chuck_UAna
136 //-----------------------------------------------------------------------------
137 struct Chuck_UAna
: public Chuck_UGen
141 virtual ~Chuck_UAna( );
144 t_CKBOOL
system_tock( t_CKTIME now
);
145 t_CKBOOL
is_up_connected_from( Chuck_UAna
* src
);
147 public: // blob retrieval
148 t_CKINT
numIncomingUAnae() const;
149 Chuck_UAna
* getIncomingUAna( t_CKUINT index
) const;
150 Chuck_UAnaBlobProxy
* getIncomingBlob( t_CKUINT index
) const;
151 Chuck_UAnaBlobProxy
* blobProxy() const;
158 t_CKTIME m_uana_time
;
159 // Chuck_UAnaBlobProxy * m_blob_proxy;