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
);
75 t_CKUINT
system_tick_v( t_CKTIME now
, t_CKUINT numFrames
);
76 t_CKBOOL
alloc_v( t_CKUINT size
);
79 t_CKVOID
add_by( Chuck_UGen
* dest
, t_CKBOOL isUpChuck
);
80 t_CKVOID
remove_by( Chuck_UGen
* dest
);
87 // channels (if more than one is required)
88 Chuck_UGen
** m_multi_chan
;
89 // size of m_multi_chan;
90 t_CKUINT m_multi_chan_size
;
95 // alloc multi channels
96 void alloc_multi_chan( t_CKUINT num_ins
, t_CKUINT num_outs
);
99 Chuck_UGen
** m_src_list
;
102 Chuck_UGen
** m_dest_list
;
105 Chuck_UGen
** m_src_uana_list
;
106 t_CKUINT m_src_uana_cap
;
107 t_CKUINT m_num_uana_src
;
108 Chuck_UGen
** m_dest_uana_list
;
109 t_CKUINT m_dest_uana_cap
;
110 t_CKUINT m_num_uana_dest
;
125 SAMPLE
* m_current_v
;
127 // the shred on which the ugen is created
128 Chuck_VM_Shred
* shred
;
139 //-----------------------------------------------------------------------------
140 // name: struct Chuck_UAna
142 //-----------------------------------------------------------------------------
143 struct Chuck_UAna
: public Chuck_UGen
147 virtual ~Chuck_UAna( );
150 t_CKBOOL
system_tock( t_CKTIME now
);
151 t_CKBOOL
is_up_connected_from( Chuck_UAna
* src
);
153 public: // blob retrieval
154 t_CKINT
numIncomingUAnae() const;
155 Chuck_UAna
* getIncomingUAna( t_CKUINT index
) const;
156 Chuck_UAnaBlobProxy
* getIncomingBlob( t_CKUINT index
) const;
157 Chuck_UAnaBlobProxy
* blobProxy() const;
164 t_CKTIME m_uana_time
;
165 // Chuck_UAnaBlobProxy * m_blob_proxy;