void ElapsedTimeToTimespec(double elapsed, struct timespec *spec) { int64 oscTime = ElapsedTimeToOSC(elapsed); spec->tv_sec = (time_t)((oscTime >> 32) - kSECONDS_FROM_1900_to_1970); spec->tv_nsec = (int32)((oscTime & 0xFFFFFFFF) * kOSCtoNanos); }
int makeSynthBundle(big_scpacket *packet, PyrSlot *slots, int size, bool useElapsed) { double time; int err; int64 oscTime; err = slotDoubleVal(slots, &time); if (!err) { if (useElapsed) { oscTime = ElapsedTimeToOSC(time); } else { oscTime = (int64)(time * kSecondsToOSC); } } else { oscTime = 1; // immediate } packet->OpenBundle(oscTime); for (int i=1; i<size; ++i) { if (isKindOfSlot(slots+i, class_array)) { PyrObject *obj = slots[i].uo; makeSynthMsgWithTags(packet, obj->slots, obj->size); } } packet->CloseBundle(); return errNone; }
int64 OSCTime() { return ElapsedTimeToOSC(elapsedTime()); }