diff options
Diffstat (limited to 'portmidi/porttime/porttime.h')
| -rwxr-xr-x | portmidi/porttime/porttime.h | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/portmidi/porttime/porttime.h b/portmidi/porttime/porttime.h deleted file mode 100755 index 0a61c5c..0000000 --- a/portmidi/porttime/porttime.h +++ /dev/null | |||
| @@ -1,103 +0,0 @@ | |||
| 1 | /** @file porttime.h portable interface to millisecond timer. */ | ||
| 2 | |||
| 3 | /* CHANGE LOG FOR PORTTIME | ||
| 4 | 10-Jun-03 Mark Nelson & RBD | ||
| 5 | boost priority of timer thread in ptlinux.c implementation | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef PORTMIDI_PORTTIME_H | ||
| 9 | #define PORTMIDI_PORTTIME_H | ||
| 10 | |||
| 11 | /* Should there be a way to choose the source of time here? */ | ||
| 12 | |||
| 13 | #ifdef WIN32 | ||
| 14 | #ifndef INT32_DEFINED | ||
| 15 | // rather than having users install a special .h file for windows, | ||
| 16 | // just put the required definitions inline here. portmidi.h uses | ||
| 17 | // these too, so the definitions are (unfortunately) duplicated there | ||
| 18 | typedef int int32_t; | ||
| 19 | typedef unsigned int uint32_t; | ||
| 20 | #define INT32_DEFINED | ||
| 21 | #endif | ||
| 22 | #else | ||
| 23 | #include <stdint.h> // needed for int32_t | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #ifdef __cplusplus | ||
| 27 | extern "C" { | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #ifndef PMEXPORT | ||
| 31 | #ifdef _WINDLL | ||
| 32 | #define PMEXPORT __declspec(dllexport) | ||
| 33 | #else | ||
| 34 | #define PMEXPORT | ||
| 35 | #endif | ||
| 36 | #endif | ||
| 37 | |||
| 38 | /** @defgroup grp_porttime PortTime: Millisecond Timer | ||
| 39 | @{ | ||
| 40 | */ | ||
| 41 | |||
| 42 | typedef enum { | ||
| 43 | ptNoError = 0, /* success */ | ||
| 44 | ptHostError = -10000, /* a system-specific error occurred */ | ||
| 45 | ptAlreadyStarted, /* cannot start timer because it is already started */ | ||
| 46 | ptAlreadyStopped, /* cannot stop timer because it is already stopped */ | ||
| 47 | ptInsufficientMemory /* memory could not be allocated */ | ||
| 48 | } PtError; /**< @brief @enum PtError PortTime error code; a common return type. | ||
| 49 | * No error is indicated by zero; errors are indicated by < 0. | ||
| 50 | */ | ||
| 51 | |||
| 52 | /** real time or time offset in milliseconds. */ | ||
| 53 | typedef int32_t PtTimestamp; | ||
| 54 | |||
| 55 | /** a function that gets a current time */ | ||
| 56 | typedef void (PtCallback)(PtTimestamp timestamp, void *userData); | ||
| 57 | |||
| 58 | /** start a real-time clock service. | ||
| 59 | |||
| 60 | @param resolution the timer resolution in ms. The time will advance every | ||
| 61 | \p resolution ms. | ||
| 62 | |||
| 63 | @param callback a function pointer to be called every resolution ms. | ||
| 64 | |||
| 65 | @param userData is passed to \p callback as a parameter. | ||
| 66 | |||
| 67 | @return #ptNoError on success. See #PtError for other values. | ||
| 68 | */ | ||
| 69 | PMEXPORT PtError Pt_Start(int resolution, PtCallback *callback, void *userData); | ||
| 70 | |||
| 71 | /** stop the timer. | ||
| 72 | |||
| 73 | @return #ptNoError on success. See #PtError for other values. | ||
| 74 | */ | ||
| 75 | PMEXPORT PtError Pt_Stop(void); | ||
| 76 | |||
| 77 | /** test if the timer is running. | ||
| 78 | |||
| 79 | @return TRUE or FALSE | ||
| 80 | */ | ||
| 81 | PMEXPORT int Pt_Started(void); | ||
| 82 | |||
| 83 | /** get the current time in ms. | ||
| 84 | |||
| 85 | @return the current time | ||
| 86 | */ | ||
| 87 | PMEXPORT PtTimestamp Pt_Time(void); | ||
| 88 | |||
| 89 | /** pauses the current thread, allowing other threads to run. | ||
| 90 | |||
| 91 | @param duration the length of the pause in ms. The true duration | ||
| 92 | of the pause may be rounded to the nearest or next clock tick | ||
| 93 | as determined by resolution in #Pt_Start(). | ||
| 94 | */ | ||
| 95 | PMEXPORT void Pt_Sleep(int32_t duration); | ||
| 96 | |||
| 97 | /** @} */ | ||
| 98 | |||
| 99 | #ifdef __cplusplus | ||
| 100 | } | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #endif // PORTMIDI_PORTTIME_H | ||
