Fix inconsistency in categories: "Internal" (1 file) vs "Internals" (2 files)
[supercollider.git] / include / lang / PyrSched.h
blob4b6887876a9ca8e151f7b444505a044585160d42
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
21 #ifndef _PYRSCHED_H_
22 #define _PYRSCHED_H_
24 #include "VMGlobals.h"
25 #include "SC_Export.h"
26 #include <pthread.h>
28 extern pthread_mutex_t gLangMutex;
30 SC_DLLEXPORT_C void schedInit();
31 SC_DLLEXPORT_C void schedCleanup();
33 SC_DLLEXPORT_C void schedRun();
34 SC_DLLEXPORT_C void schedStop();
35 SC_DLLEXPORT_C void schedClear();
37 double elapsedTime();
38 int64 OSCTime();
40 int64 ElapsedTimeToOSC(double elapsed);
41 double OSCToElapsedTime(int64 oscTime);
43 void syncOSCOffsetWithTimeOfDay();
44 void doubleToTimespec(double secs, struct timespec *spec);
47 bool addheap(VMGlobals *g, PyrObject *heap, double schedtime, PyrSlot *task);
48 bool lookheap(PyrObject *heap, double *schedtime, PyrSlot *task) ;
49 bool getheap(VMGlobals *g, PyrObject *heap, double *schedtime, PyrSlot *task) ;
50 void offsetheap(VMGlobals *g, PyrObject *heap, double offset) ;
51 void dumpheap(PyrObject *heap);
53 const double kSecondsToOSC = 4294967296.; // pow(2,32)/1
54 const double kMicrosToOSC = 4294.967296; // pow(2,32)/1e6
55 const double kNanosToOSC = 4.294967296; // pow(2,32)/1e9
56 const double kOSCtoSecs = 2.328306436538696e-10; // 1/pow(2,32)
57 const double kOSCtoNanos = 0.2328306436538696; // 1e9/pow(2,32)
59 #endif