* Add centre-focus option (mid/side processing)

* Simplify RingBuffer and add explicit memory locks
* Fix hang with certain unfortunate combinations of parameters
* Bump version to 1.7
This commit is contained in:
Chris Cannam
2011-11-25 11:11:59 +00:00
parent 9c52352c24
commit c26dc1dc88
19 changed files with 588 additions and 373 deletions

View File

@@ -23,6 +23,8 @@
#include <unistd.h>
#ifdef __APPLE__
#include <sys/sysctl.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
#else /* !__APPLE__, !_WIN32 */
#include <stdio.h>
#include <string.h>
@@ -53,17 +55,17 @@ system_get_platform_tag()
#else /* !_WIN32 */
#ifdef __APPLE__
return "osx";
#else /* !__APPLE__ */
#else
#ifdef __LINUX__
if (sizeof(long) == 8) {
return "linux64";
} else {
return "linux";
}
#else /* !__LINUX__ */
#else
return "posix";
#endif /* !__LINUX__ */
#endif /* !__APPLE__ */
#endif
#endif
#endif /* !_WIN32 */
}
@@ -146,6 +148,27 @@ void gettimeofday(struct timeval *tv, void *tz)
tv->tv_sec = (long)((now.ns100 - 116444736000000000LL) / 10000000LL);
}
void clock_gettime(int, struct timespec *ts)
{
static LARGE_INTEGER cps;
static bool haveCps = false;
if (!haveCps) {
QueryPerformanceFrequency(&cps);
haveCps = true;
}
LARGE_INTEGER counter;
QueryPerformanceCounter(&counter);
//!!! check this
ts->tv_sec = counter.QuadPart / cps.QuadPart;
double sub = counter.QuadPart % cps.QuadPart;
sub = sub / cps.QuadPart;
sub = sub * 1000000000.;
ts->tv_nsec = long(sub) ;
}
void usleep(unsigned long usec)
{
::Sleep(usec == 0 ? 0 : usec < 1000 ? 1 : usec / 1000);
@@ -153,6 +176,20 @@ void usleep(unsigned long usec)
#endif
#ifdef __APPLE__
void clock_gettime(int, struct timespec *ts)
{
uint64_t t = mach_absolute_time();
static mach_timebase_info_data_t sTimebaseInfo;
if (sTimebaseInfo.denom == 0) (void)mach_timebase_info(&sTimebaseInfo);
uint64_t n = t * sTimebaseInfo.numer / sTimebaseInfo.denom;
ts->tv_sec = n / 1000000000;
ts->tv_nsec = n % 1000000000;
}
#endif
void system_specific_initialise()
{
}
@@ -163,7 +200,7 @@ void system_specific_application_initialise()
ProcessStatus
GetProcessStatus(int pid)
system_get_process_status(int pid)
{
#ifdef _WIN32
HANDLE handle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
@@ -186,6 +223,24 @@ GetProcessStatus(int pid)
#endif
}
#ifdef _WIN32
void system_memorybarrier()
{
MemoryBarrier();
}
#else /* !_WIN32 */
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
// Not required
#else
#include <pthread.h>
void system_memorybarrier()
{
pthread_mutex_t dummy = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock(&dummy);
pthread_mutex_unlock(&dummy);
}
#endif
#endif
}