| 1 | /*---------------------------------------------------------------------------- |
| 2 | ChucK Strongly-timed Audio Programming Language |
| 3 | Compiler, Virtual Machine, and Synthesis Engine |
| 4 | |
| 5 | Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved. |
| 6 | http://chuck.stanford.edu/ |
| 7 | http://chuck.cs.princeton.edu/ |
| 8 | |
| 9 | This program is free software; you can redistribute it and/or modify |
| 10 | it under the dual-license terms of EITHER the MIT License OR the GNU |
| 11 | General Public License (the latter as published by the Free Software |
| 12 | Foundation; either version 2 of the License or, at your option, any |
| 13 | later version). |
| 14 | |
| 15 | This program is distributed in the hope that it will be useful and/or |
| 16 | interesting, but WITHOUT ANY WARRANTY; without even the implied warranty |
| 17 | of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | MIT Licence and/or the GNU General Public License for details. |
| 19 | |
| 20 | You should have received a copy of the MIT License and the GNU General |
| 21 | Public License (GPL) along with this program; a copy of the GPL can also |
| 22 | be obtained by writing to the Free Software Foundation, Inc., 59 Temple |
| 23 | Place, Suite 330, Boston, MA 02111-1307 U.S.A. |
| 24 | -----------------------------------------------------------------------------*/ |
| 25 | |
| 26 | //----------------------------------------------------------------------------- |
| 27 | // file: chuck_carrier.h |
| 28 | // desc: carrier of things associated with each ChucK instance |
| 29 | // REFACTOR-2017 |
| 30 | // |
| 31 | // author: Ge Wang (http://www.gewang.com/) |
| 32 | // Jack Atherton ([email protected]) |
| 33 | // Spencer Salazar ([email protected]) |
| 34 | // date: fall 2017 |
| 35 | //----------------------------------------------------------------------------- |
| 36 | #ifndef __CHUCK_CARRIER_H__ |
| 37 | #define __CHUCK_CARRIER_H__ |
| 38 | |
| 39 | #include "chuck_def.h" |
| 40 | #ifndef __DISABLE_OTF_SERVER__ |
| 41 | #include "util_thread.h" |
| 42 | #endif |
| 43 | |
| 44 | #include <map> |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | // forward references (C++) |
| 50 | class ChucK; |
| 51 | struct Chuck_Compiler; |
| 52 | struct Chuck_VM; |
| 53 | struct Chuck_Env; |
| 54 | struct Chuck_IO_Chout; |
| 55 | struct Chuck_IO_Cherr; |
| 56 | |
| 57 | // forward references ("C") |
| 58 | struct ck_socket_; |
| 59 | typedef struct ck_socket_ * ck_socket; |
| 60 | |
| 61 | // forward references (STK-specific) |
| 62 | class WvOut; |
| 63 | class XWriteThread; |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | //----------------------------------------------------------------------------- |
| 69 | // name: struct Chuck_Carrier |
| 70 | // desc: carrier of per-ChucK-instance things; each |
| 71 | //----------------------------------------------------------------------------- |
| 72 | struct Chuck_Carrier |
| 73 | { |
| 74 | ChucK * chuck; |
| 75 | Chuck_Compiler * compiler; |
| 76 | Chuck_Env * env; |
| 77 | Chuck_VM * vm; |
| 78 | Chuck_IO_Chout * chout; |
| 79 | Chuck_IO_Cherr * cherr; |
| 80 | |
| 81 | #ifndef __DISABLE_OTF_SERVER__ |
| 82 | // OTF programming things |
| 83 | ck_socket otf_socket; |
| 84 | t_CKINT otf_port; |
| 85 | CHUCK_THREAD otf_thread; |
| 86 | #endif |
| 87 | |
| 88 | // STK-specific |
| 89 | #ifndef __DISABLE_WVOUT__ |
| 90 | XWriteThread * stk_writeThread; |
| 91 | std::map<WvOut *, WvOut *> stk_wvOutMap; |
| 92 | #endif |
| 93 | |
| 94 | // constructor |
| 95 | Chuck_Carrier() : |
| 96 | chuck(NULL), |
| 97 | compiler( NULL ), |
| 98 | env( NULL ), |
| 99 | vm( NULL ), |
| 100 | chout( NULL ), |
| 101 | cherr( NULL ), |
| 102 | #ifndef __DISABLE_OTF_SERVER__ |
| 103 | otf_socket( NULL ), |
| 104 | otf_port( 0 ), |
| 105 | otf_thread( 0 ), |
| 106 | #endif |
| 107 | #ifndef __DISABLE_WVOUT__ |
| 108 | stk_writeThread( NULL ) |
| 109 | #endif |
| 110 | { } |
| 111 | |
| 112 | // get hint: is realtime audio? |
| 113 | t_CKBOOL hintIsRealtimeAudio(); |
| 114 | }; |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | #endif |