Update of /cvsroot/pure-data/pd/portmidi/porttime In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5166/pd/portmidi/porttime
Modified Files: porttime.h ptlinux.c ptmacosx_cf.c ptmacosx_mach.c Log Message: 0.41-0 test 11
Index: porttime.h =================================================================== RCS file: /cvsroot/pure-data/pd/portmidi/porttime/porttime.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** porttime.h 31 Dec 2005 02:56:03 -0000 1.2 --- porttime.h 16 Jan 2008 21:54:10 -0000 1.3 *************** *** 28,34 ****
PtError Pt_Start(int resolution, PtCallback *callback, void *userData); ! PtError Pt_Stop( void); ! int Pt_Started( void); ! PtTimestamp Pt_Time( void);
#ifdef __cplusplus --- 28,34 ----
PtError Pt_Start(int resolution, PtCallback *callback, void *userData); ! PtError Pt_Stop(); ! int Pt_Started(); ! PtTimestamp Pt_Time();
#ifdef __cplusplus
Index: ptmacosx_cf.c =================================================================== RCS file: /cvsroot/pure-data/pd/portmidi/porttime/ptmacosx_cf.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ptmacosx_cf.c 31 Dec 2005 02:56:03 -0000 1.2 --- ptmacosx_cf.c 16 Jan 2008 21:54:10 -0000 1.3 *************** *** 92,95 **** --- 92,97 ---- pthread_t pthread_id;
+ printf("Pt_Start() called\n"); + // /* make sure we're not already playing */ if (time_started_flag) return ptAlreadyStarted; *************** *** 112,115 **** --- 114,118 ---- PtError Pt_Stop() { + printf("Pt_Stop called\n");
CFRunLoopStop(timerRunLoop);
Index: ptmacosx_mach.c =================================================================== RCS file: /cvsroot/pure-data/pd/portmidi/porttime/ptmacosx_mach.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ptmacosx_mach.c 15 Dec 2005 00:57:02 -0000 1.1 --- ptmacosx_mach.c 16 Jan 2008 21:54:10 -0000 1.2 *************** *** 58,73 ****
/* to kill a process, just increment the pt_callback_proc_id */ ! printf("pt_callback_proc_id %d, id %d\n", pt_callback_proc_id, parameters->id); while (pt_callback_proc_id == parameters->id) { /* wait for a multiple of resolution ms */ UInt64 wait_time; int delay = mytime++ * parameters->resolution - Pt_Time(); if (delay < 0) delay = 0; wait_time = AudioConvertNanosToHostTime((UInt64)delay * NSEC_PER_MSEC); wait_time += AudioGetCurrentHostTime(); error = mach_wait_until(wait_time); ! (*(parameters->callback))(Pt_Time(), parameters->userData); } - printf("Pt_CallbackProc exiting\n"); free(parameters); return NULL; --- 58,74 ----
/* to kill a process, just increment the pt_callback_proc_id */ ! /* printf("pt_callback_proc_id %d, id %d\n", pt_callback_proc_id, parameters->id); */ while (pt_callback_proc_id == parameters->id) { /* wait for a multiple of resolution ms */ UInt64 wait_time; int delay = mytime++ * parameters->resolution - Pt_Time(); + long timestamp; if (delay < 0) delay = 0; wait_time = AudioConvertNanosToHostTime((UInt64)delay * NSEC_PER_MSEC); wait_time += AudioGetCurrentHostTime(); error = mach_wait_until(wait_time); ! timestamp = Pt_Time(); ! (*(parameters->callback))(timestamp, parameters->userData); } free(parameters); return NULL; *************** *** 101,105 **** PtError Pt_Stop() { ! printf("Pt_Stop called\n"); pt_callback_proc_id++; time_started_flag = FALSE; --- 102,106 ---- PtError Pt_Stop() { ! /* printf("Pt_Stop called\n"); */ pt_callback_proc_id++; time_started_flag = FALSE;
Index: ptlinux.c =================================================================== RCS file: /cvsroot/pure-data/pd/portmidi/porttime/ptlinux.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ptlinux.c 15 Dec 2005 00:57:02 -0000 1.1 --- ptlinux.c 16 Jan 2008 21:54:10 -0000 1.2 *************** *** 22,26 ****
*/ ! #include "porttime.h" #include "sys/time.h" --- 22,32 ----
*/ ! /* stdlib, stdio, unistd, and sys/types were added because they appeared ! * in a Gentoo patch, but I'm not sure why they are needed. -RBD ! */ ! #include <stdlib.h> ! #include <stdio.h> ! #include <unistd.h> ! #include <sys/types.h> #include "porttime.h" #include "sys/time.h" *************** *** 64,69 **** (*(parameters->callback))(Pt_Time(), parameters->userData); } ! printf("Pt_CallbackProc exiting\n"); ! // free(parameters); return NULL; } --- 70,75 ---- (*(parameters->callback))(Pt_Time(), parameters->userData); } ! /* printf("Pt_CallbackProc exiting\n"); */ ! // free(parameters); return NULL; } *************** *** 94,99 **** PtError Pt_Stop() { ! printf("Pt_Stop called\n"); pt_callback_proc_id++; time_started_flag = FALSE; return ptNoError; --- 100,106 ---- PtError Pt_Stop() { ! /* printf("Pt_Stop called\n"); */ pt_callback_proc_id++; + pthread_join(pt_thread_pid, NULL); time_started_flag = FALSE; return ptNoError;