"Post Window" -> "Post window" prevents it being seen as two separate
[supercollider.git] / include / plugin_interface / SC_World.h
blobe37247ba656306682dfcd1fb311956c0e4e68bbf
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
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.
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.
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
22 #ifndef _SC_World_
23 #define _SC_World_
25 #include "SC_Types.h"
26 #include "SC_Rate.h"
27 #include "SC_SndBuf.h"
28 #include "SC_RGen.h"
29 #include "SC_Lock.h"
31 #ifdef SUPERNOVA
32 namespace nova
34 class spin_lock;
35 class padded_rw_spinlock;
37 #endif
39 struct World
41 // a pointer to private implementation, not available to plug-ins.
42 struct HiddenWorld *hw;
44 // a pointer to the table of function pointers that implement the plug-ins'
45 // interface to the server.
46 struct InterfaceTable *ft;
48 // data accessible to plug-ins :
49 double mSampleRate;
50 int mBufLength;
51 int mBufCounter;
53 uint32 mNumAudioBusChannels;
54 uint32 mNumControlBusChannels;
55 uint32 mNumInputs;
56 uint32 mNumOutputs;
58 // vector of samples for all audio busses
59 float *mAudioBus;
61 // vector of samples for all control busses
62 float *mControlBus;
64 // these tell if a buss has been written to during a control period
65 // if the value is equal to mBufCounter then the buss has been touched
66 // this control period.
67 int32 *mAudioBusTouched;
68 int32 *mControlBusTouched;
70 uint32 mNumSndBufs;
71 SndBuf *mSndBufs;
72 SndBuf *mSndBufsNonRealTimeMirror;
73 SndBufUpdates *mSndBufUpdates;
75 struct Group *mTopGroup;
77 Rate mFullRate, mBufRate;
79 uint32 mNumRGens;
80 RGen *mRGen;
82 uint32 mNumUnits, mNumGraphs, mNumGroups;
83 int mSampleOffset; // offset in the buffer of current event time.
85 SC_Lock* mNRTLock;
87 uint32 mNumSharedControls;
88 float *mSharedControls;
90 bool mRealTime;
91 bool mRunning;
92 int mDumpOSC;
94 SC_Lock* mDriverLock;
96 float mSubsampleOffset; // subsample accurate offset in the buffer of current event time.
98 int mVerbosity;
99 int mErrorNotification;
100 int mLocalErrorNotification;
102 bool mRendezvous; // Allow user to disable Rendezvous
104 const char* mRestrictedPath; // OSC commands to read/write data can only do it within this path, if specified
106 #ifdef SUPERNOVA
107 nova::padded_rw_spinlock * mAudioBusLocks;
108 nova::spin_lock * mControlBusLock;
109 #endif
112 extern "C" {
113 #ifdef _WIN32
114 __declspec(dllexport)
115 #endif //_WIN32
116 int scprintf(const char *fmt, ...);
119 inline SndBuf* World_GetBuf(struct World *inWorld, uint32 index)
121 if (index > inWorld->mNumSndBufs) index = 0;
122 return inWorld->mSndBufs + index;
125 inline SndBuf* World_GetNRTBuf(struct World *inWorld, uint32 index)
127 if (index > inWorld->mNumSndBufs) index = 0;
128 return inWorld->mSndBufsNonRealTimeMirror + index;
131 typedef void (*LoadPlugInFunc)(struct InterfaceTable *);
133 #endif