update to rubberband 1.2

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3576 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-07-10 11:30:19 +00:00
parent 94f3ead75e
commit ce601905c0
51 changed files with 4092 additions and 979 deletions

View file

@ -3,7 +3,7 @@
/*
Rubber Band
An audio time-stretching and pitch-shifting library.
Copyright 2007 Chris Cannam.
Copyright 2007-2008 Chris Cannam.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@ -27,6 +27,7 @@
#include <iostream>
namespace RubberBand {
bool
@ -81,7 +82,7 @@ system_is_multiprocessor()
#ifdef _WIN32
void gettimeofday(struct timeval *tv, void *tz)
int gettimeofday(struct timeval *tv, void *tz)
{
union {
long long ns100;
@ -91,6 +92,7 @@ void gettimeofday(struct timeval *tv, void *tz)
::GetSystemTimeAsFileTime(&now.ft);
tv->tv_usec = (long)((now.ns100 / 10LL) % 1000000LL);
tv->tv_sec = (long)((now.ns100 - 116444736000000000LL) / 10000000LL);
return 0;
}
void usleep(unsigned long usec)
@ -100,6 +102,52 @@ void usleep(unsigned long usec)
#endif
float *allocFloat(float *ptr, int count)
{
if (ptr) free((void *)ptr);
void *allocated;
#ifndef _WIN32
if (!posix_memalign(&allocated, 16, count * sizeof(float)))
#endif
allocated = malloc(count * sizeof(float));
for (int i = 0; i < count; ++i) ((float *)allocated)[i] = 0.f;
return (float *)allocated;
}
float *allocFloat(int count)
{
return allocFloat(0, count);
}
void freeFloat(float *ptr)
{
if (ptr) free(ptr);
}
double *allocDouble(double *ptr, int count)
{
if (ptr) free((void *)ptr);
void *allocated;
#ifndef _WIN32
if (!posix_memalign(&allocated, 16, count * sizeof(double)))
#endif
allocated = malloc(count * sizeof(double));
for (int i = 0; i < count; ++i) ((double *)allocated)[i] = 0.f;
return (double *)allocated;
}
double *allocDouble(int count)
{
return allocDouble(0, count);
}
void freeDouble(double *ptr)
{
if (ptr) free(ptr);
}
}