1 /* 2 SuperCollider real time audio synthesis system 3 Copyright (c) 2002 James McCartney. All rights reserved. 4 http://www.audiosynth.com 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #pragma once 22 23 #include "SC_SynthDef.h" 24 #include "HashTable.h" 25 #include <boost/filesystem/path.hpp> // path 26 27 struct ParamSpec { 28 int32 mName[kSCNameLen]; 29 int32 mIndex; 30 int32 mHash; 31 int32 mNumChannels; 32 }; 33 34 typedef HashTable<ParamSpec, Malloc> ParamSpecTable; 35 36 /** \note Relevant scsynth code: `GraphDef_Read(World *, char*&, GraphDef*, int32)` 37 * \note Relevant supernova code: `sc_synthdef::prepare(void)` 38 */ 39 struct GraphDef { 40 NodeDef mNodeDef; 41 42 uint32 mNumControls; 43 uint32 mNumAudioControls; 44 45 uint32 mNumWires; 46 uint32 mNumConstants; 47 uint32 mNumUnitSpecs; 48 uint32 mNumWireBufs; 49 uint32 mNumCalcUnits; 50 51 float32* mInitialControlValues; 52 float32* mConstants; 53 54 struct UnitSpec* mUnitSpecs; 55 56 size_t mWiresAllocSize, mUnitsAllocSize, mCalcUnitsAllocSize; 57 size_t mControlAllocSize, mMapControlsAllocSize, mMapControlRatesAllocSize, mAudioMapBusOffsetSize; 58 59 uint32 mNumParamSpecs; 60 ParamSpec* mParamSpecs; 61 ParamSpecTable* mParamSpecTable; 62 63 int mRefCount; 64 struct GraphDef* mNext; 65 66 struct GraphDef* mOriginal; 67 68 uint32 mNumVariants; 69 struct GraphDef* mVariants; 70 }; 71 typedef struct GraphDef GraphDef; 72 73 GraphDef* GraphDef_Recv(World* inWorld, char* buffer, GraphDef* inList); 74 GraphDef* GraphDef_Load(struct World* inWorld, const boost::filesystem::path& path, GraphDef* inList); 75 GraphDef* GraphDef_LoadDir(struct World* inWorld, const boost::filesystem::path& path, GraphDef* inList); 76 GraphDef* GraphDef_LoadGlob(World* inWorld, const char* pattern, GraphDef* inList); 77 SCErr GraphDef_Remove(World* inWorld, int32* inName); 78 SCErr GraphDef_DeleteMsg(struct World* inWorld, GraphDef* inDef); 79 void GraphDef_Dump(GraphDef* inGraphDef); 80 int32 GetHash(ParamSpec* inParamSpec); 81 int32* GetKey(ParamSpec* inParamSpec); 82