diff options
author | Miller Puckette <millerpuckette@users.sourceforge.net> | 2008-01-16 21:54:11 +0000 |
---|---|---|
committer | Miller Puckette <millerpuckette@users.sourceforge.net> | 2008-01-16 21:54:11 +0000 |
commit | cde1ee8fa147dfd15dc5c5b43093cd8c8a402b74 (patch) | |
tree | 8682f7eb796e19647afedd5e1c641425879d98b3 /pd/portmidi/porttime | |
parent | c50af0d647849d50a4fbbe44aa855455b92c80fd (diff) |
0.41-0 test 11
svn path=/trunk/; revision=9147
Diffstat (limited to 'pd/portmidi/porttime')
-rw-r--r-- | pd/portmidi/porttime/porttime.h | 6 | ||||
-rw-r--r-- | pd/portmidi/porttime/ptlinux.c | 15 | ||||
-rw-r--r-- | pd/portmidi/porttime/ptmacosx_cf.c | 3 | ||||
-rw-r--r-- | pd/portmidi/porttime/ptmacosx_mach.c | 9 |
4 files changed, 22 insertions, 11 deletions
diff --git a/pd/portmidi/porttime/porttime.h b/pd/portmidi/porttime/porttime.h index 762a71af..029ea777 100644 --- a/pd/portmidi/porttime/porttime.h +++ b/pd/portmidi/porttime/porttime.h @@ -27,9 +27,9 @@ typedef void (PtCallback)( PtTimestamp timestamp, void *userData ); PtError Pt_Start(int resolution, PtCallback *callback, void *userData);
-PtError Pt_Stop( void);
-int Pt_Started( void);
-PtTimestamp Pt_Time( void);
+PtError Pt_Stop();
+int Pt_Started();
+PtTimestamp Pt_Time();
#ifdef __cplusplus
}
diff --git a/pd/portmidi/porttime/ptlinux.c b/pd/portmidi/porttime/ptlinux.c index c99abf04..468575aa 100644 --- a/pd/portmidi/porttime/ptlinux.c +++ b/pd/portmidi/porttime/ptlinux.c @@ -21,7 +21,13 @@ CHANGE LOG thread. Simplified implementation notes.
*/
-
+/* 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"
#include "sys/resource.h"
@@ -63,8 +69,8 @@ static void *Pt_CallbackProc(void *p) select(0, NULL, NULL, NULL, &timeout);
(*(parameters->callback))(Pt_Time(), parameters->userData);
}
- printf("Pt_CallbackProc exiting\n");
-// free(parameters);
+ /* printf("Pt_CallbackProc exiting\n"); */
+ // free(parameters);
return NULL;
}
@@ -93,8 +99,9 @@ PtError Pt_Start(int resolution, PtCallback *callback, void *userData) PtError Pt_Stop()
{
- printf("Pt_Stop called\n");
+ /* printf("Pt_Stop called\n"); */
pt_callback_proc_id++;
+ pthread_join(pt_thread_pid, NULL);
time_started_flag = FALSE;
return ptNoError;
}
diff --git a/pd/portmidi/porttime/ptmacosx_cf.c b/pd/portmidi/porttime/ptmacosx_cf.c index 1837246b..c0c22a32 100644 --- a/pd/portmidi/porttime/ptmacosx_cf.c +++ b/pd/portmidi/porttime/ptmacosx_cf.c @@ -91,6 +91,8 @@ PtError Pt_Start(int resolution, PtCallback *callback, void *userData) PtThreadParams *params = (PtThreadParams*)malloc(sizeof(PtThreadParams));
pthread_t pthread_id;
+ printf("Pt_Start() called\n");
+
// /* make sure we're not already playing */
if (time_started_flag) return ptAlreadyStarted;
startTime = CFAbsoluteTimeGetCurrent();
@@ -111,6 +113,7 @@ PtError Pt_Start(int resolution, PtCallback *callback, void *userData) PtError Pt_Stop()
{
+ printf("Pt_Stop called\n");
CFRunLoopStop(timerRunLoop);
time_started_flag = FALSE;
diff --git a/pd/portmidi/porttime/ptmacosx_mach.c b/pd/portmidi/porttime/ptmacosx_mach.c index 935d99bb..37d4318b 100644 --- a/pd/portmidi/porttime/ptmacosx_mach.c +++ b/pd/portmidi/porttime/ptmacosx_mach.c @@ -57,18 +57,19 @@ static void *Pt_CallbackProc(void *p) /* 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);
+ /* 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);
- (*(parameters->callback))(Pt_Time(), parameters->userData);
+ timestamp = Pt_Time();
+ (*(parameters->callback))(timestamp, parameters->userData);
}
- printf("Pt_CallbackProc exiting\n");
free(parameters);
return NULL;
}
@@ -100,7 +101,7 @@ PtError Pt_Start(int resolution, PtCallback *callback, void *userData) PtError Pt_Stop()
{
- printf("Pt_Stop called\n");
+ /* printf("Pt_Stop called\n"); */
pt_callback_proc_id++;
time_started_flag = FALSE;
return ptNoError;
|