AC_CHECK_LIB(pthread, pthread_create)
dnl Check for header files
-AC_CHECK_HEADERS([string.h stdlib.h stdio.h math.h errno.h stdarg.h unistd.h signal.h],,)
+AC_CHECK_HEADERS([string.h stdlib.h stdio.h math.h limits.h errno.h stdarg.h unistd.h signal.h],,)
AC_CHECK_HEADERS(fftw3.h,,AC_MSG_ERROR([Ouch! missing fftw3.h header]))
AC_ARG_ENABLE(complex,
AC_HELP_STRING([--enable-complex],[compile with complex.h [[default=auto]]]),
#include <string.h>
#endif
+#if HAVE_LIMITS_H
+#include <limits.h> // for CHAR_BIT, in C99 standard
+#endif
+
#include "types.h"
/****
return aubio_freqtobin (freq, samplerate, fftsize);
}
+uint_t
+aubio_is_power_of_two(uint_t a) {
+ if ((a & a-1) == 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+uint_t
+aubio_next_power_of_two(uint_t a) {
+ uint_t i;
+ a--;
+ for (i = 0; i < sizeof(uint_t) * CHAR_BIT; i++ ) {
+ a = a | a >> 1;
+ }
+ return a+1;
+}
+
smpl_t
aubio_db_spl (fvec_t * o)
{
/** convert midi value (0-128) to frequency (Hz) */
smpl_t aubio_miditofreq (smpl_t midi);
+/** return 1 if a is a power of 2, 0 otherwise */
+uint_t aubio_is_power_of_two(uint_t a);
+
+/** return the next power of power of 2 greater than a */
+uint_t aubio_next_power_of_two(uint_t a);
+
/** compute sound pressure level (SPL) in dB
This quantity is often wrongly called 'loudness'.
conf.check(header_name='stdio.h')
conf.check(header_name='math.h')
conf.check(header_name='string.h')
+ conf.check(header_name='limits.h')
# optionally use complex.h
if (Options.options.disable_complex == False):