goto error;
}
- printf( "PortAudio version number = %d\nPortAudio version text = '%s'\n",
+ printf( "PortAudio version number = 0x%08X\nPortAudio version text = '%s'\n",
Pa_GetVersion(), Pa_GetVersionText() );
{
#endif /* __cplusplus */
-
-/** Retrieve the release number of the currently running PortAudio build,
- eg 1900.
-*/
+/** Retrieve the release number of the currently running PortAudio build.
+ * For example, for version "19.5.1" this will return 0x00130501.
+ */
int Pa_GetVersion( void );
-
/** Retrieve a textual description of the current PortAudio build,
- eg "PortAudio V19-devel 13 October 2002".
-*/
+ * eg "PortAudio V19.5.0-devel (built Mar 3 2015 09:16:35)".
+ * The format of the text may change so do not try to parse the returned string.
+ */
const char* Pa_GetVersionText( void );
+/**
+ * Generate a packed integer version number in the same format used
+ * by Pa_GetVersion(). Use this to compare a specified version number with
+ * the currently running version. For example:
+ *
+ * if (Pa_GetVersion() < paMakeVersionNumber(19.5.1)) {}
+ */
+#define paMakeVersionNumber(major, minor, subminor) \
+ (((major)&0xFF)<<16 | ((minor)&0xFF)<<8 | ((subminor)&0xFF))
/** Error codes returned by PortAudio functions.
Note that with the exception of paNoError, all PaErrorCodes are negative.
#include "pa_trace.h" /* still usefull?*/
#include "pa_debugprint.h"
+/**
+ * This is incremented if we make incompatible API changes.
+ * This version scheme is based loosely on http://semver.org/
+ */
+#define paVersionMajor 19
+
+/**
+ * This is incremented when we add functionality in a backwards-compatible manner.
+ * Or it is set to zero when paVersionMajor is incremented.
+ */
+#define paVersionMinor 5
-#define PA_VERSION_ 1899
-#define PA_VERSION_TEXT_ "PortAudio V19-devel (built " __DATE__ " " __TIME__ ")"
+/**
+ * This is incremented when we make backwards-compatible bug fixes.
+ * Or it is set to zero when paVersionMinor changes.
+ */
+#define paVersionSubMinor 0
+/**
+ * This is a combination of paVersionMajor, paVersionMinor and paVersionSubMinor.
+ * It will always increase so that version numbers can be compared as integers to
+ * see which is later.
+ */
+#define paVersion paMakeVersionNumber(paVersionMajor, paVersionMinor, paVersionSubMinor)
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+#define PA_VERSION_STRING_ TOSTRING(paVersionMajor) "." TOSTRING(paVersionMinor) "." TOSTRING(paVersionSubMinor)
+#define PA_VERSION_TEXT_ "PortAudio V" PA_VERSION_STRING_ "-devel (built " __DATE__ " " __TIME__ ")"
int Pa_GetVersion( void )
{
- return PA_VERSION_;
+ return paVersion;
}
-
const char* Pa_GetVersionText( void )
{
return PA_VERSION_TEXT_;
}
-
-
#define PA_LAST_HOST_ERROR_TEXT_LENGTH_ 1024
static char lastHostErrorText_[ PA_LAST_HOST_ERROR_TEXT_LENGTH_ + 1 ] = {0};