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 22 #pragma once 23 24 #include <stdarg.h> 25 #include "SC_Reply.h" 26 #include "SC_Types.h" 27 #include "SC_Export.h" 28 29 typedef int (*PrintFunc)(const char* format, va_list ap); 30 31 struct WorldOptions { WorldOptionsWorldOptions32 WorldOptions() {} 33 34 const char* mPassword = nullptr; 35 uint32 mNumBuffers = 1024; 36 uint32 mMaxLogins = 64; 37 uint32 mMaxNodes = 1024; 38 uint32 mMaxGraphDefs = 1024; 39 uint32 mMaxWireBufs = 64; 40 uint32 mNumAudioBusChannels = 1024; 41 uint32 mNumInputBusChannels = 8; 42 uint32 mNumOutputBusChannels = 8; 43 uint32 mNumControlBusChannels = 16384; 44 uint32 mBufLength = 64; 45 uint32 mRealTimeMemorySize = 8192; // in kilobytes 46 47 int mNumSharedControls = 0; 48 float* mSharedControls = nullptr; 49 50 bool mRealTime = true; 51 bool mMemoryLocking = false; 52 53 const char* mNonRealTimeCmdFilename = nullptr; 54 const char* mNonRealTimeInputFilename = nullptr; 55 const char* mNonRealTimeOutputFilename = nullptr; 56 const char* mNonRealTimeOutputHeaderFormat = nullptr; 57 const char* mNonRealTimeOutputSampleFormat = nullptr; 58 59 uint32 mPreferredSampleRate = 0; 60 61 uint32 mNumRGens = 64; 62 63 uint32 mPreferredHardwareBufferFrameSize = 0; 64 65 uint32 mLoadGraphDefs = 1; 66 67 const char* mInputStreamsEnabled = nullptr; 68 const char* mOutputStreamsEnabled = nullptr; 69 const char* mInDeviceName = nullptr; 70 71 int mVerbosity = 0; 72 73 bool mRendezvous = true; 74 75 const char* mUGensPluginPath = nullptr; 76 77 const char* mOutDeviceName = nullptr; 78 79 const char* mRestrictedPath = nullptr; 80 81 int mSharedMemoryID = 0; 82 }; 83 84 struct SndBuf; 85 86 SCSYNTH_DLLEXPORT_C void SetPrintFunc(PrintFunc func); 87 SCSYNTH_DLLEXPORT_C struct World* World_New(struct WorldOptions* inOptions); 88 SCSYNTH_DLLEXPORT_C void World_Cleanup(struct World* inWorld, bool unload_plugins = false); 89 SCSYNTH_DLLEXPORT_C void World_NonRealTimeSynthesis(struct World* inWorld, struct WorldOptions* inOptions); 90 SCSYNTH_DLLEXPORT_C int World_OpenUDP(struct World* inWorld, const char* bindTo, int inPort); 91 SCSYNTH_DLLEXPORT_C int World_OpenTCP(struct World* inWorld, const char* bindTo, int inPort, int inMaxConnections, 92 int inBacklog); 93 SCSYNTH_DLLEXPORT_C void World_WaitForQuit(struct World* inWorld, bool unload_plugins = false); 94 SCSYNTH_DLLEXPORT_C bool World_SendPacket(struct World* inWorld, int inSize, char* inData, ReplyFunc inFunc); 95 SCSYNTH_DLLEXPORT_C bool World_SendPacketWithContext(struct World* inWorld, int inSize, char* inData, ReplyFunc inFunc, 96 void* inContext); 97 SCSYNTH_DLLEXPORT_C int World_CopySndBuf(struct World* world, uint32 index, struct SndBuf* outBuf, bool onlyIfChanged, 98 bool* didChange); 99 SCSYNTH_DLLEXPORT_C int scprintf(const char* fmt, ...); 100