Changeset 41b985f for src


Ignore:
Timestamp:
Mar 12, 2017, 11:26:24 AM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
sampler
Children:
bde49c4a
Parents:
71f2e5f (diff), 67b6618 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge 'origin/master' into sampler

Conflicts:

.travis.yml
Makefile
examples/aubionotes.c
examples/parse_args.h
python/demos/demo_timestretch_online.py
python/lib/moresetuptools.py
python/tests/test_source.py
setup.py
src/io/source.c

Location:
src
Files:
2 added
38 edited

Legend:

Unmodified
Added
Removed
  • src/aubio.h

    r71f2e5f r41b985f  
    110110
    111111  Several examples of C programs are available in the \p examples/ and \p tests/src
    112   directories of the source tree. See more examples:
    113   @ref spectral/test-fft.c
    114   @ref spectral/test-phasevoc.c
    115   @ref onset/test-onset.c
    116   @ref pitch/test-pitch.c
    117   @ref tempo/test-tempo.c
    118   @ref test-fvec.c
    119   @ref test-cvec.c
     112  directories of the source tree.
     113
     114  Some examples:
     115  - @ref spectral/test-fft.c
     116  - @ref spectral/test-phasevoc.c
     117  - @ref onset/test-onset.c
     118  - @ref pitch/test-pitch.c
     119  - @ref tempo/test-tempo.c
     120  - @ref test-fvec.c
     121  - @ref test-cvec.c
    120122
    121123  \subsection unstable_api Unstable API
     
    138140
    139141  Latest versions, further documentation, examples, wiki, and mailing lists can
    140   be found at http://aubio.org .
     142  be found at https://aubio.org .
    141143
    142144 */
  • src/aubio_priv.h

    r71f2e5f r41b985f  
    3434 */
    3535
     36#ifdef HAVE_CONFIG_H
    3637#include "config.h"
     38#endif
    3739
    3840#ifdef HAVE_STDLIB_H
     
    182184#ifdef HAVE_C99_VARARGS_MACROS
    183185#define AUBIO_ERR(...)               aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " __VA_ARGS__)
     186#define AUBIO_INF(...)               aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " __VA_ARGS__)
    184187#define AUBIO_MSG(...)               aubio_log(AUBIO_LOG_MSG, __VA_ARGS__)
    185188#define AUBIO_DBG(...)               aubio_log(AUBIO_LOG_DBG, __VA_ARGS__)
    186189#define AUBIO_WRN(...)               aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " __VA_ARGS__)
    187190#else
    188 #define AUBIO_ERR(format, args...)   aubio_log(stderr, "AUBIO ERROR: " format , ##args)
    189 #define AUBIO_MSG(format, args...)   aubio_log(stdout, format , ##args)
    190 #define AUBIO_DBG(format, args...)   aubio_log(stderr, format , ##args)
    191 #define AUBIO_WRN(format, args...)   aubio_log(stderr, "AUBIO WARNING: " format, ##args)
     191#define AUBIO_ERR(format, args...)   aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " format , ##args)
     192#define AUBIO_INF(format, args...)   aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " format , ##args)
     193#define AUBIO_MSG(format, args...)   aubio_log(AUBIO_LOG_MSG, format , ##args)
     194#define AUBIO_DBG(format, args...)   aubio_log(AUBIO_LOG_DBG, format , ##args)
     195#define AUBIO_WRN(format, args...)   aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " format, ##args)
    192196#endif
    193197
     
    196200#define AUBIO_QUIT(_s)               exit(_s)
    197201#define AUBIO_SPRINTF                sprintf
     202
     203#define AUBIO_MAX_SAMPLERATE (192000*8)
     204#define AUBIO_MAX_CHANNELS 1024
    198205
    199206/* pi and 2*pi */
  • src/fmat.c

    r71f2e5f r41b985f  
    111111  uint_t i,j;
    112112  for (i=0; i< s->height; i++) {
    113     for (j=0; j< FLOOR(s->length/2); j++) {
     113    for (j=0; j< FLOOR((smpl_t)s->length/2); j++) {
    114114      ELEM_SWAP(s->data[i][j], s->data[i][s->length-1-j]);
    115115    }
  • src/fvec.c

    r71f2e5f r41b985f  
    9191void fvec_rev(fvec_t *s) {
    9292  uint_t j;
    93   for (j=0; j< FLOOR(s->length/2); j++) {
     93  for (j=0; j< FLOOR((smpl_t)s->length/2); j++) {
    9494    ELEM_SWAP(s->data[j], s->data[s->length-1-j]);
    9595  }
  • src/io/audio_unit.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 #include "config.h"
     21#include "aubio_priv.h"
    2222#ifdef HAVE_AUDIO_UNIT
    23 #include "aubio_priv.h"
    2423
    2524#include "fvec.h"
  • src/io/sink.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 #include "config.h"
    2221#include "aubio_priv.h"
    2322#include "fvec.h"
     
    9998  }
    10099#endif /* HAVE_WAVWRITE */
    101   AUBIO_ERROR("sink: failed creating %s with samplerate %dHz\n",
    102       uri, samplerate);
     100#if !defined(HAVE_WAVWRITE) && \
     101  !defined(HAVE_SNDFILE) && \
     102  !defined(HAVE_SINK_APPLE_AUDIO)
     103  AUBIO_ERROR("sink: failed creating '%s' at %dHz (no sink built-in)\n", uri, samplerate);
     104#endif
    103105  AUBIO_FREE(s);
    104106  return NULL;
  • src/io/sink_apple_audio.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 #include "config.h"
     21#include "aubio_priv.h"
    2222
    2323#ifdef HAVE_SINK_APPLE_AUDIO
    24 
    25 #include "aubio_priv.h"
    2624#include "fvec.h"
    2725#include "fmat.h"
    2826#include "io/sink_apple_audio.h"
     27#include "io/ioutils.h"
    2928
    3029// CFURLRef, CFURLCreateWithFileSystemPath, ...
     
    6362  s->async = false;
    6463
    65   if (uri == NULL) {
     64  if ( (uri == NULL) || (strlen(uri) < 1) ) {
    6665    AUBIO_ERROR("sink_apple_audio: Aborted opening null path\n");
    6766    goto beach;
     
    7473  s->channels = 0;
    7574
    76   // negative samplerate given, abort
    77   if ((sint_t)samplerate < 0) goto beach;
    7875  // zero samplerate given. do not open yet
    79   if ((sint_t)samplerate == 0) return s;
     76  if ((sint_t)samplerate == 0) {
     77    return s;
     78  }
     79  // invalid samplerate given, abort
     80  if (aubio_io_validate_samplerate("sink_apple_audio", s->path, samplerate)) {
     81    goto beach;
     82  }
    8083
    8184  s->samplerate = samplerate;
     
    9598uint_t aubio_sink_apple_audio_preset_samplerate(aubio_sink_apple_audio_t *s, uint_t samplerate)
    9699{
    97   if ((sint_t)(samplerate) <= 0) return AUBIO_FAIL;
     100  if (aubio_io_validate_samplerate("sink_apple_audio", s->path, samplerate)) {
     101    return AUBIO_FAIL;
     102  }
    98103  s->samplerate = samplerate;
    99104  // automatically open when both samplerate and channels have been set
     
    106111uint_t aubio_sink_apple_audio_preset_channels(aubio_sink_apple_audio_t *s, uint_t channels)
    107112{
    108   if ((sint_t)(channels) <= 0) return AUBIO_FAIL;
     113  if (aubio_io_validate_channels("sink_apple_audio", s->path, channels)) {
     114    return AUBIO_FAIL;
     115  }
    109116  s->channels = channels;
    110117  // automatically open when both samplerate and channels have been set
  • src/io/sink_sndfile.c

    r71f2e5f r41b985f  
    2020
    2121
    22 #include "config.h"
     22#include "aubio_priv.h"
    2323
    2424#ifdef HAVE_SNDFILE
     
    2626#include <sndfile.h>
    2727
    28 #include "aubio_priv.h"
    2928#include "fvec.h"
    3029#include "fmat.h"
    3130#include "io/sink_sndfile.h"
    32 
    33 #define MAX_CHANNELS 6
     31#include "io/ioutils.h"
     32
    3433#define MAX_SIZE 4096
    3534
     
    7069  s->channels = 0;
    7170
    72   // negative samplerate given, abort
    73   if ((sint_t)samplerate < 0) goto beach;
    7471  // zero samplerate given. do not open yet
    75   if ((sint_t)samplerate == 0) return s;
     72  if ((sint_t)samplerate == 0) {
     73    return s;
     74  }
     75  // invalid samplerate given, abort
     76  if (aubio_io_validate_samplerate("sink_sndfile", s->path, samplerate)) {
     77    goto beach;
     78  }
    7679
    7780  s->samplerate = samplerate;
     
    9093uint_t aubio_sink_sndfile_preset_samplerate(aubio_sink_sndfile_t *s, uint_t samplerate)
    9194{
    92   if ((sint_t)(samplerate) <= 0) return AUBIO_FAIL;
     95  if (aubio_io_validate_samplerate("sink_sndfile", s->path, samplerate)) {
     96    return AUBIO_FAIL;
     97  }
    9398  s->samplerate = samplerate;
    9499  // automatically open when both samplerate and channels have been set
     
    101106uint_t aubio_sink_sndfile_preset_channels(aubio_sink_sndfile_t *s, uint_t channels)
    102107{
    103   if ((sint_t)(channels) <= 0) return AUBIO_FAIL;
     108  if (aubio_io_validate_channels("sink_sndfile", s->path, channels)) {
     109    return AUBIO_FAIL;
     110  }
    104111  s->channels = channels;
    105112  // automatically open when both samplerate and channels have been set
     
    133140  if (s->handle == NULL) {
    134141    /* show libsndfile err msg */
    135     AUBIO_ERR("sink_sndfile: Failed opening %s. %s\n", s->path, sf_strerror (NULL));
     142    AUBIO_ERR("sink_sndfile: Failed opening \"%s\" with %d channels, %dHz: %s\n",
     143        s->path, s->channels, s->samplerate, sf_strerror (NULL));
    136144    return AUBIO_FAIL;
    137145  }
     
    139147  s->scratch_size = s->max_size*s->channels;
    140148  /* allocate data for de/interleaving reallocated when needed. */
    141   if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {
     149  if (s->scratch_size >= MAX_SIZE * AUBIO_MAX_CHANNELS) {
     150    abort();
    142151    AUBIO_ERR("sink_sndfile: %d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n",
    143         s->max_size, s->channels, MAX_CHANNELS * MAX_CHANNELS);
     152        s->max_size, s->channels, MAX_SIZE * AUBIO_MAX_CHANNELS);
    144153    return AUBIO_FAIL;
    145154  }
  • src/io/sink_wavwrite.c

    r71f2e5f r41b985f  
    2020
    2121
    22 #include "config.h"
     22#include "aubio_priv.h"
    2323
    2424#ifdef HAVE_WAVWRITE
    2525
    26 #include "aubio_priv.h"
    2726#include "fvec.h"
    2827#include "fmat.h"
    2928#include "io/sink_wavwrite.h"
     29#include "io/ioutils.h"
    3030
    3131#include <errno.h>
    3232
    33 #define MAX_CHANNELS 6
    3433#define MAX_SIZE 4096
    3534
     
    105104  s->channels = 0;
    106105
    107   // negative samplerate given, abort
    108   if ((sint_t)samplerate < 0) goto beach;
    109106  // zero samplerate given. do not open yet
    110   if ((sint_t)samplerate == 0) return s;
    111   // samplerate way too large, fail
    112   if ((sint_t)samplerate > 192000 * 4) goto beach;
     107  if ((sint_t)samplerate == 0) {
     108    return s;
     109  }
     110  // invalid samplerate given, abort
     111  if (aubio_io_validate_samplerate("sink_wavwrite", s->path, samplerate)) {
     112    goto beach;
     113  }
    113114
    114115  s->samplerate = samplerate;
     
    130131uint_t aubio_sink_wavwrite_preset_samplerate(aubio_sink_wavwrite_t *s, uint_t samplerate)
    131132{
    132   if ((sint_t)(samplerate) <= 0) return AUBIO_FAIL;
     133  if (aubio_io_validate_samplerate("sink_wavwrite", s->path, samplerate)) {
     134    return AUBIO_FAIL;
     135  }
    133136  s->samplerate = samplerate;
    134137  // automatically open when both samplerate and channels have been set
     
    141144uint_t aubio_sink_wavwrite_preset_channels(aubio_sink_wavwrite_t *s, uint_t channels)
    142145{
    143   if ((sint_t)(channels) <= 0) return AUBIO_FAIL;
     146  if (aubio_io_validate_channels("sink_wavwrite", s->path, channels)) {
     147    return AUBIO_FAIL;
     148  }
    144149  s->channels = channels;
    145150  // automatically open when both samplerate and channels have been set
     
    214219  s->scratch_size = s->max_size * s->channels;
    215220  /* allocate data for de/interleaving reallocated when needed. */
    216   if (s->scratch_size >= MAX_SIZE * MAX_CHANNELS) {
     221  if (s->scratch_size >= MAX_SIZE * AUBIO_MAX_CHANNELS) {
    217222    AUBIO_ERR("sink_wavwrite: %d x %d exceeds SIZE maximum buffer size %d\n",
    218         s->max_size, s->channels, MAX_SIZE * MAX_CHANNELS);
     223        s->max_size, s->channels, MAX_SIZE * AUBIO_MAX_CHANNELS);
    219224    goto beach;
    220225  }
  • src/io/source.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 #include "config.h"
    2221#include "aubio_priv.h"
    2322#include "fvec.h"
     
    116115  }
    117116#endif /* HAVE_WAVREAD */
    118   //AUBIO_ERROR("source: failed creating aubio source with %s"
    119   //   " at samplerate %d with hop_size %d\n", uri, samplerate, hop_size);
     117#if !defined(HAVE_WAVREAD) && \
     118  !defined(HAVE_LIBAV) && \
     119  !defined(HAVE_SOURCE_APPLE_AUDIO) && \
     120  !defined(HAVE_SNDFILE)
     121  AUBIO_ERROR("source: failed creating with %s at %dHz with hop size %d"
     122     " (no source built-in)\n", uri, samplerate, hop_size);
     123#endif
    120124  AUBIO_FREE(s);
    121125  return NULL;
  • src/io/source_apple_audio.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 #include "config.h"
     21#include "aubio_priv.h"
    2222
    2323#ifdef HAVE_SOURCE_APPLE_AUDIO
    2424
    25 #include "aubio_priv.h"
    2625#include "fvec.h"
    2726#include "fmat.h"
     
    281280{
    282281  OSStatus err = noErr;
    283   if (!s->audioFile) { return AUBIO_FAIL; }
     282  if (!s->audioFile) { return AUBIO_OK; }
    284283  err = ExtAudioFileDispose(s->audioFile);
    285284  s->audioFile = NULL;
  • src/io/source_avcodec.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 
    22 #include "config.h"
     21#include "aubio_priv.h"
    2322
    2423#ifdef HAVE_LIBAV
     24
     25#include <libavcodec/avcodec.h>
     26#include <libavformat/avformat.h>
     27#include <libavresample/avresample.h>
     28#include <libavutil/opt.h>
     29#include <stdlib.h>
    2530
    2631// determine whether we use libavformat from ffmpeg or from libav
     
    3338      )
    3439
    35 #include <libavcodec/avcodec.h>
    36 #include <libavformat/avformat.h>
    37 #include <libavresample/avresample.h>
    38 #include <libavutil/opt.h>
    39 #include <stdlib.h>
     40// backward compatibility with libavcodec55
     41#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
     42#warning "libavcodec55 is deprecated"
     43#define HAVE_AUBIO_LIBAVCODEC_DEPRECATED 1
     44#define av_frame_alloc  avcodec_alloc_frame
     45#define av_frame_free avcodec_free_frame
     46#define av_packet_unref av_free_packet
     47#endif
    4048
    4149#include "aubio_priv.h"
     
    6068  AVCodecContext *avCodecCtx;
    6169  AVFrame *avFrame;
     70  AVPacket avPacket;
    6271  AVAudioResampleContext *avr;
    63   float *output;
     72  smpl_t *output;
    6473  uint_t read_samples;
    6574  uint_t read_index;
     
    151160  sint_t selected_stream = -1;
    152161  for (i = 0; i < avFormatCtx->nb_streams; i++) {
     162#if FF_API_LAVF_AVCTX
     163    if (avFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
     164#else
    153165    if (avFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
     166#endif
    154167      if (selected_stream == -1) {
    155168        selected_stream = i;
     
    168181
    169182  AVCodecContext *avCodecCtx = s->avCodecCtx;
     183#if FF_API_LAVF_AVCTX
     184  AVCodecParameters *codecpar = avFormatCtx->streams[selected_stream]->codecpar;
     185  if (codecpar == NULL) {
     186    AUBIO_ERR("source_avcodec: Could not find decoder for %s", s->path);
     187    goto beach;
     188  }
     189  AVCodec *codec = avcodec_find_decoder(codecpar->codec_id);
     190
     191  /* Allocate a codec context for the decoder */
     192  avCodecCtx = avcodec_alloc_context3(codec);
     193  if (!avCodecCtx) {
     194    AUBIO_ERR("source_avcodec: Failed to allocate the %s codec context for path %s\n",
     195        av_get_media_type_string(AVMEDIA_TYPE_AUDIO), s->path);
     196    goto beach;
     197  }
     198#else
    170199  avCodecCtx = avFormatCtx->streams[selected_stream]->codec;
    171200  AVCodec *codec = avcodec_find_decoder(avCodecCtx->codec_id);
     201#endif
    172202  if (codec == NULL) {
    173203    AUBIO_ERR("source_avcodec: Could not find decoder for %s", s->path);
    174204    goto beach;
    175205  }
     206
     207#if FF_API_LAVF_AVCTX
     208  /* Copy codec parameters from input stream to output codec context */
     209  if ((err = avcodec_parameters_to_context(avCodecCtx, codecpar)) < 0) {
     210    AUBIO_ERR("source_avcodec: Failed to copy %s codec parameters to decoder context for %s\n",
     211       av_get_media_type_string(AVMEDIA_TYPE_AUDIO), s->path);
     212    goto beach;
     213  }
     214#endif
    176215
    177216  if ( ( err = avcodec_open2(avCodecCtx, codec, NULL) ) < 0) {
     
    206245
    207246  /* allocate output for avr */
    208   s->output = (float *)av_malloc(AUBIO_AVCODEC_MAX_BUFFER_SIZE * sizeof(float));
     247  s->output = (smpl_t *)av_malloc(AUBIO_AVCODEC_MAX_BUFFER_SIZE * sizeof(smpl_t));
    209248
    210249  s->read_samples = 0;
     
    233272
    234273void aubio_source_avcodec_reset_resampler(aubio_source_avcodec_t * s, uint_t multi) {
     274  // create or reset resampler to/from mono/multi-channel
    235275  if ( (multi != s->multi) || (s->avr == NULL) ) {
    236276    int64_t input_layout = av_get_default_channel_layout(s->input_channels);
    237277    uint_t output_channels = multi ? s->input_channels : 1;
    238278    int64_t output_layout = av_get_default_channel_layout(output_channels);
    239     if (s->avr != NULL) {
    240       avresample_close( s->avr );
    241       av_free ( s->avr );
    242       s->avr = NULL;
    243     }
    244     AVAudioResampleContext *avr = s->avr;
    245     avr = avresample_alloc_context();
     279    AVAudioResampleContext *avr = avresample_alloc_context();
     280    AVAudioResampleContext *oldavr = s->avr;
    246281
    247282    av_opt_set_int(avr, "in_channel_layout",  input_layout,           0);
     
    250285    av_opt_set_int(avr, "out_sample_rate",    s->samplerate,          0);
    251286    av_opt_set_int(avr, "in_sample_fmt",      s->avCodecCtx->sample_fmt, 0);
     287#if HAVE_AUBIO_DOUBLE
     288    av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_DBL,      0);
     289#else
    252290    av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_FLT,      0);
     291#endif
     292    // TODO: use planar?
     293    //av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_FLTP,      0);
    253294    int err;
    254295    if ( ( err = avresample_open(avr) ) < 0) {
     
    261302    }
    262303    s->avr = avr;
     304    if (oldavr != NULL) {
     305      avresample_close( oldavr );
     306      av_free ( oldavr );
     307      oldavr = NULL;
     308    }
    263309    s->multi = multi;
    264310  }
     
    269315  AVCodecContext *avCodecCtx = s->avCodecCtx;
    270316  AVFrame *avFrame = s->avFrame;
    271   AVPacket avPacket;
     317  AVPacket avPacket = s->avPacket;
    272318  av_init_packet (&avPacket);
    273319  AVAudioResampleContext *avr = s->avr;
    274   float *output = s->output;
     320  smpl_t *output = s->output;
    275321  *read_samples = 0;
    276322
     
    291337
    292338  int got_frame = 0;
     339#if FF_API_LAVF_AVCTX
     340  int ret = avcodec_send_packet(avCodecCtx, &avPacket);
     341  if (ret < 0 && ret != AVERROR_EOF) {
     342    AUBIO_ERR("source_avcodec: error when sending packet for %s\n", s->path);
     343    goto beach;
     344  }
     345  ret = avcodec_receive_frame(avCodecCtx, avFrame);
     346  if (ret >= 0) {
     347    got_frame = 1;
     348  }
     349  if (ret < 0) {
     350    if (ret == AVERROR(EAGAIN)) {
     351      AUBIO_WRN("source_avcodec: output is not available right now - user must try to send new input\n");
     352    } else if (ret == AVERROR_EOF) {
     353      AUBIO_WRN("source_avcodec: the decoder has been fully flushed, and there will be no more output frames\n");
     354    } else {
     355      AUBIO_ERR("source_avcodec: decoding errors on %s\n", s->path);
     356      goto beach;
     357    }
     358  }
     359#else
    293360  int len = avcodec_decode_audio4(avCodecCtx, avFrame, &got_frame, &avPacket);
    294361
    295362  if (len < 0) {
    296     AUBIO_ERR("Error while decoding %s\n", s->path);
    297     goto beach;
    298   }
     363    AUBIO_ERR("source_avcodec: error while decoding %s\n", s->path);
     364    goto beach;
     365  }
     366#endif
    299367  if (got_frame == 0) {
    300     //AUBIO_ERR("Could not get frame for (%s)\n", s->path);
     368    AUBIO_WRN("source_avcodec: did not get a frame when reading %s\n", s->path);
    301369    goto beach;
    302370  }
     
    312380        (uint8_t **)avFrame->data, in_linesize, in_samples);
    313381  if (out_samples <= 0) {
    314     //AUBIO_ERR("No sample found while converting frame (%s)\n", s->path);
     382    AUBIO_WRN("source_avcodec: no sample found while converting frame (%s)\n", s->path);
    315383    goto beach;
    316384  }
     
    329397
    330398void aubio_source_avcodec_do(aubio_source_avcodec_t * s, fvec_t * read_data, uint_t * read){
    331   if (s->multi == 1) aubio_source_avcodec_reset_resampler(s, 0);
    332399  uint_t i;
    333400  uint_t end = 0;
    334401  uint_t total_wrote = 0;
     402  // switch from multi
     403  if (s->multi == 1) aubio_source_avcodec_reset_resampler(s, 0);
    335404  while (total_wrote < s->hop_size) {
    336405    end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
     
    360429
    361430void aubio_source_avcodec_do_multi(aubio_source_avcodec_t * s, fmat_t * read_data, uint_t * read){
    362   if (s->multi == 0) aubio_source_avcodec_reset_resampler(s, 1);
    363431  uint_t i,j;
    364432  uint_t end = 0;
    365433  uint_t total_wrote = 0;
     434  // switch from mono
     435  if (s->multi == 0) aubio_source_avcodec_reset_resampler(s, 1);
    366436  while (total_wrote < s->hop_size) {
    367437    end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
     
    408478  int64_t max_ts = MIN(resampled_pos + 2000, INT64_MAX);
    409479  int seek_flags = AVSEEK_FLAG_FRAME | AVSEEK_FLAG_ANY;
    410   int ret = avformat_seek_file(s->avFormatCtx, s->selected_stream,
     480  int ret = AUBIO_FAIL;
     481  if (s->avFormatCtx != NULL && s->avr != NULL) {
     482    ret = AUBIO_OK;
     483  } else {
     484    AUBIO_ERR("source_avcodec: failed seeking in %s (file not opened?)", s->path);
     485    return ret;
     486  }
     487  if ((sint_t)pos < 0) {
     488    AUBIO_ERR("source_avcodec: could not seek %s at %d (seeking position"
     489       " should be >= 0)\n", s->path, pos);
     490    return AUBIO_FAIL;
     491  }
     492  ret = avformat_seek_file(s->avFormatCtx, s->selected_stream,
    411493      min_ts, resampled_pos, max_ts, seek_flags);
    412494  if (ret < 0) {
    413     AUBIO_ERR("Failed seeking to %d in file %s", pos, s->path);
     495    AUBIO_ERR("source_avcodec: failed seeking to %d in file %s", pos, s->path);
    414496  }
    415497  // reset read status
     
    442524  s->avCodecCtx = NULL;
    443525  if (s->avFormatCtx != NULL) {
    444     avformat_close_input ( &(s->avFormatCtx) );
    445   }
    446   s->avFormatCtx = NULL;
     526    avformat_close_input(&s->avFormatCtx);
     527#ifndef HAVE_AUBIO_LIBAVCODEC_DEPRECATED // avoid crash on old libavcodec54
     528    avformat_free_context(s->avFormatCtx);
     529#endif
     530    s->avFormatCtx = NULL;
     531  }
     532  av_packet_unref(&s->avPacket);
    447533  return AUBIO_OK;
    448534}
     
    458544    av_frame_free( &(s->avFrame) );
    459545  }
    460   if (s->path) AUBIO_FREE(s->path);
    461546  s->avFrame = NULL;
     547  if (s->path) {
     548    AUBIO_FREE(s->path);
     549  }
     550  s->path = NULL;
    462551  AUBIO_FREE(s);
    463552}
  • src/io/source_sndfile.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 
    22 #include "config.h"
     21#include "aubio_priv.h"
    2322
    2423#ifdef HAVE_SNDFILE
     
    2625#include <sndfile.h>
    2726
    28 #include "aubio_priv.h"
    2927#include "fvec.h"
    3028#include "fmat.h"
     
    3331#include "temporal/resampler.h"
    3432
    35 #define MAX_CHANNELS 6
    3633#define MAX_SIZE 4096
    37 #define MAX_SAMPLES MAX_CHANNELS * MAX_SIZE
     34#define MAX_SAMPLES AUBIO_MAX_CHANNELS * MAX_SIZE
    3835
    3936#if !HAVE_AUBIO_DOUBLE
     
    141138    if (s->ratio > 1) {
    142139      // we would need to add a ring buffer for these
    143       if ( (uint_t)(s->input_hop_size * s->ratio + .5)  != s->hop_size ) {
     140      if ( (uint_t)FLOOR(s->input_hop_size * s->ratio + .5)  != s->hop_size ) {
    144141        AUBIO_ERR("source_sndfile: can not upsample %s from %d to %d\n", s->path,
    145142            s->input_samplerate, s->samplerate);
     
    298295uint_t aubio_source_sndfile_seek (aubio_source_sndfile_t * s, uint_t pos) {
    299296  uint_t resampled_pos = (uint_t)ROUND(pos / s->ratio);
    300   sf_count_t sf_ret = sf_seek (s->handle, resampled_pos, SEEK_SET);
     297  sf_count_t sf_ret;
     298  if (s->handle == NULL) {
     299    AUBIO_ERR("source_sndfile: failed seeking in %s (file not opened?)\n",
     300        s->path);
     301    return AUBIO_FAIL;
     302  }
     303  if ((sint_t)pos < 0) {
     304    AUBIO_ERR("source_sndfile: could not seek %s at %d (seeking position"
     305       " should be >= 0)\n", s->path, pos);
     306    return AUBIO_FAIL;
     307  }
     308  sf_ret = sf_seek (s->handle, resampled_pos, SEEK_SET);
    301309  if (sf_ret == -1) {
    302310    AUBIO_ERR("source_sndfile: Failed seeking %s at %d: %s\n", s->path, pos, sf_strerror (NULL));
     
    313321uint_t aubio_source_sndfile_close (aubio_source_sndfile_t *s) {
    314322  if (!s->handle) {
    315     return AUBIO_FAIL;
     323    return AUBIO_OK;
    316324  }
    317325  if(sf_close(s->handle)) {
  • src/io/source_wavread.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 #include "config.h"
     21#include "aubio_priv.h"
    2222
    2323#ifdef HAVE_WAVREAD
    2424
    25 #include "aubio_priv.h"
    2625#include "fvec.h"
    2726#include "fmat.h"
     
    330329  uint_t end = 0;
    331330  uint_t total_wrote = 0;
     331  if (s->fid == NULL) {
     332    AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n",
     333        s->path);
     334    return;
     335  }
    332336  while (total_wrote < s->hop_size) {
    333337    end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
     
    364368  uint_t end = 0;
    365369  uint_t total_wrote = 0;
     370  if (s->fid == NULL) {
     371    AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n",
     372        s->path);
     373    return;
     374  }
    366375  while (total_wrote < s->hop_size) {
    367376    end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
     
    404413uint_t aubio_source_wavread_seek (aubio_source_wavread_t * s, uint_t pos) {
    405414  uint_t ret = 0;
     415  if (s->fid == NULL) {
     416    AUBIO_ERR("source_wavread: could not seek %s (file not opened?)\n", s->path, pos);
     417    return AUBIO_FAIL;
     418  }
    406419  if ((sint_t)pos < 0) {
     420    AUBIO_ERR("source_wavread: could not seek %s at %d (seeking position should be >= 0)\n", s->path, pos);
    407421    return AUBIO_FAIL;
    408422  }
     
    426440
    427441uint_t aubio_source_wavread_close (aubio_source_wavread_t * s) {
    428   if (!s->fid) {
    429     return AUBIO_FAIL;
     442  if (s->fid == NULL) {
     443    return AUBIO_OK;
    430444  }
    431445  if (fclose(s->fid)) {
  • src/io/utils_apple_audio.c

    r71f2e5f r41b985f  
    1 #include "config.h"
     1#include "aubio_priv.h"
    22
    33#if defined(HAVE_SOURCE_APPLE_AUDIO) || defined(HAVE_SINK_APPLE_AUDIO)
     
    77// ExtAudioFileRef, AudioStreamBasicDescription, AudioBufferList, ...
    88#include <AudioToolbox/AudioToolbox.h>
    9 #include "aubio_priv.h"
    109
    1110int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize);
  • src/mathutils.c

    r71f2e5f r41b985f  
    2525#include "mathutils.h"
    2626#include "musicutils.h"
    27 #include "config.h"
    2827
    2928/** Window types */
  • src/notes/notes.c

    r71f2e5f r41b985f  
    2525#include "notes/notes.h"
    2626
     27#define AUBIO_DEFAULT_NOTES_SILENCE -70.
     28// increase to 10. for .1  cent precision
     29//      or to 100. for .01 cent precision
     30#define AUBIO_DEFAULT_CENT_PRECISION 1.
     31#define AUBIO_DEFAULT_NOTES_MINIOI_MS 30.
     32
    2733struct _aubio_notes_t {
    2834
     
    7985  o->pitch = new_aubio_pitch (pitch_method, o->pitch_buf_size, o->hop_size, o->samplerate);
    8086  if (o->pitch_tolerance != 0.) aubio_pitch_set_tolerance (o->pitch, o->pitch_tolerance);
     87  aubio_pitch_set_unit (o->pitch, "midi");
    8188  o->pitch_output = new_fvec (1);
    8289
     
    9198  o->newnote = 0.;
    9299
    93   o->silence_threshold = -90.;
     100  aubio_notes_set_silence(o, AUBIO_DEFAULT_NOTES_SILENCE);
     101  aubio_notes_set_minioi_ms (o, AUBIO_DEFAULT_NOTES_MINIOI_MS);
    94102
    95103  return o;
     
    98106  del_aubio_notes(o);
    99107  return NULL;
     108}
     109
     110uint_t aubio_notes_set_silence(aubio_notes_t *o, smpl_t silence)
     111{
     112  uint_t err = AUBIO_OK;
     113  if (aubio_pitch_set_silence(o->pitch, silence) != AUBIO_OK) {
     114    err = AUBIO_FAIL;
     115  }
     116  if (aubio_onset_set_silence(o->onset, silence) != AUBIO_OK) {
     117    err = AUBIO_FAIL;
     118  }
     119  o->silence_threshold = silence;
     120  return err;
     121}
     122
     123smpl_t aubio_notes_get_silence(const aubio_notes_t *o)
     124{
     125  return aubio_pitch_get_silence(o->pitch);
     126}
     127
     128uint_t aubio_notes_set_minioi_ms (aubio_notes_t *o, smpl_t minioi_ms)
     129{
     130  uint_t err = AUBIO_OK;
     131  if (!o->onset || (aubio_onset_set_minioi_ms(o->onset, minioi_ms) != 0)) {
     132    err = AUBIO_FAIL;
     133  }
     134  return err;
     135}
     136
     137smpl_t aubio_notes_get_minioi_ms(const aubio_notes_t *o)
     138{
     139  return aubio_onset_get_minioi_ms(o->onset);
    100140}
    101141
     
    109149    note_buffer->data[i] = note_buffer->data[i + 1];
    110150  }
    111   note_buffer->data[note_buffer->length - 1] = curnote;
     151  //note_buffer->data[note_buffer->length - 1] = ROUND(10.*curnote)/10.;
     152  note_buffer->data[note_buffer->length - 1] = ROUND(AUBIO_DEFAULT_CENT_PRECISION*curnote);
    112153  return;
    113154}
    114155
    115 static uint_t
     156static smpl_t
    116157aubio_notes_get_latest_note (aubio_notes_t *o)
    117158{
    118   uint_t i;
    119   for (i = 0; i < o->note_buffer->length; i++) {
    120     o->note_buffer2->data[i] = o->note_buffer->data[i];
    121   }
    122   return fvec_median (o->note_buffer2);
     159  fvec_copy(o->note_buffer, o->note_buffer2);
     160  return fvec_median (o->note_buffer2) / AUBIO_DEFAULT_CENT_PRECISION;
    123161}
    124162
  • src/notes/notes.h

    r71f2e5f r41b985f  
    1616  You should have received a copy of the GNU General Public License
    1717  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
     18
     19*/
     20
     21/** \file
     22
     23  Note detection object
    1824
    1925*/
     
    5258
    5359  \param o note detection object as returned by new_aubio_notes()
    54   \param in input signal of size [hop_size]
    55   \param out output notes of size [3] ? FIXME
     60  \param input input signal of size [hop_size]
     61  \param output output notes, fvec of length 3
     62
     63  The notes output is a vector of length 3 containing:
     64   - 0. the midi note value, or 0 if no note was found
     65   - 1. the note velocity
     66   - 2. the midi note to turn off
    5667
    5768*/
    5869void aubio_notes_do (aubio_notes_t *o, const fvec_t * input, fvec_t * output);
     70
     71/** set notes detection silence threshold
     72
     73  \param o notes detection object as returned by new_aubio_notes()
     74  \param silence new silence detection threshold
     75
     76  \return 0 on success, non-zero otherwise
     77
     78*/
     79uint_t aubio_notes_set_silence(aubio_notes_t * o, smpl_t silence);
     80
     81/** get notes detection silence threshold
     82
     83  \param o notes detection object as returned by new_aubio_notes()
     84
     85  \return current silence threshold
     86
     87*/
     88smpl_t aubio_notes_get_silence(const aubio_notes_t * o);
     89
     90/** get notes detection minimum inter-onset interval, in millisecond
     91
     92  \param o notes detection object as returned by new_aubio_notes()
     93
     94  \return current minimum inter onset interval
     95
     96 */
     97smpl_t aubio_notes_get_minioi_ms(const aubio_notes_t *o);
     98
     99/** set notes detection minimum inter-onset interval, in millisecond
     100
     101  \param o notes detection object as returned by new_aubio_notes()
     102  \param minioi_ms new inter-onset interval
     103
     104  \return 0 on success, non-zero otherwise
     105
     106*/
     107uint_t aubio_notes_set_minioi_ms (aubio_notes_t *o, smpl_t minioi_ms);
    59108
    60109#ifdef __cplusplus
  • src/onset/peakpicker.c

    r71f2e5f r41b985f  
    186186   */
    187187  t->biquad = new_aubio_filter_biquad (0.15998789, 0.31997577, 0.15998789,
    188       -0.59488894, 0.23484048);
     188      // FIXME: broken since c9e20ca, revert for now
     189      //-0.59488894, 0.23484048);
     190      0.23484048, 0);
    189191
    190192  return t;
  • src/pitch/pitch.c

    r71f2e5f r41b985f  
    112112  aubio_pitch_t *p = AUBIO_NEW (aubio_pitch_t);
    113113  aubio_pitch_type pitch_type;
     114  if (pitch_mode == NULL) {
     115    AUBIO_ERR ("pitch: can not use ‘NULL‘ for pitch detection method\n");
     116    goto beach;
     117  }
    114118  if (strcmp (pitch_mode, "mcomb") == 0)
    115119    pitch_type = aubio_pitcht_mcomb;
     
    139143    goto beach;
    140144  } else if (bufsize < hopsize) {
    141     AUBIO_ERR("pitch: hop size (%d) is larger than win size (%d)\n", bufsize, hopsize);
     145    AUBIO_ERR("pitch: hop size (%d) is larger than win size (%d)\n", hopsize, bufsize);
    142146    goto beach;
    143147  } else if ((sint_t)samplerate < 1) {
     
    156160      p->buf = new_fvec (bufsize);
    157161      p->p_object = new_aubio_pitchyin (bufsize);
     162      if (!p->p_object) goto beach;
    158163      p->detect_cb = aubio_pitch_do_yin;
    159164      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyin_get_confidence;
     
    163168      p->filtered = new_fvec (hopsize);
    164169      p->pv = new_aubio_pvoc (bufsize, hopsize);
     170      if (!p->pv) goto beach;
    165171      p->fftgrain = new_cvec (bufsize);
    166172      p->p_object = new_aubio_pitchmcomb (bufsize, hopsize);
     
    171177      p->buf = new_fvec (bufsize);
    172178      p->p_object = new_aubio_pitchfcomb (bufsize, hopsize);
     179      if (!p->p_object) goto beach;
    173180      p->detect_cb = aubio_pitch_do_fcomb;
    174181      break;
     
    181188      p->buf = new_fvec (bufsize);
    182189      p->p_object = new_aubio_pitchyinfft (samplerate, bufsize);
     190      if (!p->p_object) goto beach;
    183191      p->detect_cb = aubio_pitch_do_yinfft;
    184192      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyinfft_get_confidence;
     
    188196      p->buf = new_fvec (bufsize);
    189197      p->p_object = new_aubio_pitchspecacf (bufsize);
     198      if (!p->p_object) goto beach;
    190199      p->detect_cb = aubio_pitch_do_specacf;
    191200      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchspecacf_get_tolerance;
     
    198207
    199208beach:
     209  if (p->filtered) del_fvec(p->filtered);
     210  if (p->buf) del_fvec(p->buf);
    200211  AUBIO_FREE(p);
    201212  return NULL;
  • src/pitch/pitch.h

    r71f2e5f r41b985f  
    151151  \param mode set pitch units for output
    152152
     153  mode can be one of "Hz", "midi", "cent", or "bin". Defaults to "Hz".
     154
    153155  \return 0 if successfull, non-zero otherwise
    154156
  • src/pitch/pitchfcomb.c

    r71f2e5f r41b985f  
    5454  p->fftSize = bufsize;
    5555  p->stepSize = hopsize;
     56  p->fft = new_aubio_fft (bufsize);
     57  if (!p->fft) goto beach;
    5658  p->winput = new_fvec (bufsize);
    5759  p->fftOut = new_cvec (bufsize);
    5860  p->fftLastPhase = new_fvec (bufsize);
    59   p->fft = new_aubio_fft (bufsize);
    6061  p->win = new_aubio_window ("hanning", bufsize);
    6162  return p;
     63
     64beach:
     65  AUBIO_FREE(p);
     66  return NULL;
    6267}
    6368
  • src/pitch/pitchspecacf.c

    r71f2e5f r41b985f  
    4343{
    4444  aubio_pitchspecacf_t *p = AUBIO_NEW (aubio_pitchspecacf_t);
     45  p->fft = new_aubio_fft (bufsize);
     46  if (!p->fft) goto beach;
    4547  p->win = new_aubio_window ("hanningz", bufsize);
    4648  p->winput = new_fvec (bufsize);
    47   p->fft = new_aubio_fft (bufsize);
    4849  p->fftout = new_fvec (bufsize);
    4950  p->sqrmag = new_fvec (bufsize);
     
    5253  p->confidence = 0.;
    5354  return p;
     55
     56beach:
     57  AUBIO_FREE(p);
     58  return NULL;
    5459}
    5560
  • src/pitch/pitchyin.c

    r71f2e5f r41b985f  
    128128}
    129129
    130 
    131130/* all the above in one */
    132131void
    133132aubio_pitchyin_do (aubio_pitchyin_t * o, const fvec_t * input, fvec_t * out)
    134133{
    135   smpl_t tol = o->tol;
    136   fvec_t *yin = o->yin;
    137   uint_t j, tau = 0;
     134  const smpl_t tol = o->tol;
     135  fvec_t* yin = o->yin;
     136  const smpl_t *input_data = input->data;
     137  const uint_t length = yin->length;
     138  smpl_t *yin_data = yin->data;
     139  uint_t j, tau;
    138140  sint_t period;
    139   smpl_t tmp = 0., tmp2 = 0.;
    140   yin->data[0] = 1.;
    141   for (tau = 1; tau < yin->length; tau++) {
    142     yin->data[tau] = 0.;
    143     for (j = 0; j < yin->length; j++) {
    144       tmp = input->data[j] - input->data[j + tau];
    145       yin->data[tau] += SQR (tmp);
     141  smpl_t tmp, tmp2 = 0.;
     142
     143  yin_data[0] = 1.;
     144  for (tau = 1; tau < length; tau++) {
     145    yin_data[tau] = 0.;
     146    for (j = 0; j < length; j++) {
     147      tmp = input_data[j] - input_data[j + tau];
     148      yin_data[tau] += SQR (tmp);
    146149    }
    147     tmp2 += yin->data[tau];
     150    tmp2 += yin_data[tau];
    148151    if (tmp2 != 0) {
    149152      yin->data[tau] *= tau / tmp2;
     
    152155    }
    153156    period = tau - 3;
    154     if (tau > 4 && (yin->data[period] < tol) &&
    155         (yin->data[period] < yin->data[period + 1])) {
     157    if (tau > 4 && (yin_data[period] < tol) &&
     158        (yin_data[period] < yin_data[period + 1])) {
    156159      out->data[0] = fvec_quadratic_peak_pos (yin, period);
    157160      goto beach;
  • src/pitch/pitchyinfft.c

    r71f2e5f r41b985f  
    6363  p->winput = new_fvec (bufsize);
    6464  p->fft = new_aubio_fft (bufsize);
     65  if (!p->fft) goto beach;
    6566  p->fftout = new_fvec (bufsize);
    6667  p->sqrmag = new_fvec (bufsize);
     
    9697  p->short_period = (uint_t)ROUND(samplerate / 1300.);
    9798  return p;
     99
     100beach:
     101  if (p->winput) del_fvec(p->winput);
     102  AUBIO_FREE(p);
     103  return NULL;
    98104}
    99105
  • src/spectral/ooura_fft8g.c

    r71f2e5f r41b985f  
    33//  - include "aubio_priv.h" (for config.h and types.h)
    44//  - add missing prototypes
    5 //  - use COS and SIN macros
     5//  - use COS, SIN, and ATAN macros
     6//  - add cast to (smpl_t) to avoid float conversion warnings
    67//  - declare initialization as static
    78//  - prefix public function with aubio_ooura_
     
    364365        a[1] = xi;
    365366    } else {
    366         a[1] = 0.5 * (a[0] - a[1]);
     367        a[1] = (smpl_t)0.5 * (a[0] - a[1]);
    367368        a[0] -= a[1];
    368369        if (n > 4) {
     
    693694    if (nw > 2) {
    694695        nwh = nw >> 1;
    695         delta = atan(1.0) / nwh;
     696        delta = ATAN(1.0) / nwh;
    696697        w[0] = 1;
    697698        w[1] = 0;
     
    727728    if (nc > 1) {
    728729        nch = nc >> 1;
    729         delta = atan(1.0) / nch;
    730         c[0] = cos(delta * nch);
    731         c[nch] = 0.5 * c[0];
     730        delta = ATAN(1.0) / nch;
     731        c[0] = COS(delta * nch);
     732        c[nch] = (smpl_t)0.5 * c[0];
    732733        for (j = 1; j < nch; j++) {
    733             c[j] = 0.5 * cos(delta * j);
    734             c[nc - j] = 0.5 * sin(delta * j);
     734            c[j] = (smpl_t)0.5 * COS(delta * j);
     735            c[nc - j] = (smpl_t)0.5 * SIN(delta * j);
    735736        }
    736737    }
     
    15881589        k = n - j;
    15891590        kk += ks;
    1590         wkr = 0.5 - c[nc - kk];
     1591        wkr = (smpl_t)0.5 - c[nc - kk];
    15911592        wki = c[kk];
    15921593        xr = a[j] - a[k];
     
    16141615        k = n - j;
    16151616        kk += ks;
    1616         wkr = 0.5 - c[nc - kk];
     1617        wkr = (smpl_t)0.5 - c[nc - kk];
    16171618        wki = c[kk];
    16181619        xr = a[j] - a[k];
  • src/spectral/phasevoc.c

    r71f2e5f r41b985f  
    8989    goto beach;
    9090  } else if (win_s < hop_s) {
    91     AUBIO_ERR("pvoc: hop size (%d) is larger than win size (%d)\n", win_s, hop_s);
     91    AUBIO_ERR("pvoc: hop size (%d) is larger than win size (%d)\n", hop_s, win_s);
    9292    goto beach;
    9393  }
  • src/synth/sampler.c

    r71f2e5f r41b985f  
    2121#include <assert.h>
    2222
    23 #include "config.h"
    2423#include "aubio_priv.h"
    2524#include "fvec.h"
  • src/synth/wavetable.c

    r71f2e5f r41b985f  
    2020
    2121
    22 #include "config.h"
    2322#include "aubio_priv.h"
    2423#include "fvec.h"
  • src/tempo/tempo.h

    r71f2e5f r41b985f  
    155155  \param o beat tracking object
    156156
    157   \return confidence with which the tempo has been observed, `0` if no
    158   consistent value is found.
     157  \return confidence with which the tempo has been observed, the higher the
     158  more confidence, `0` if no consistent value is found.
    159159
    160160*/
  • src/temporal/biquad.c

    r71f2e5f r41b985f  
    4242  as->data[0] = 1.;
    4343  as->data[1] = a1;
    44   as->data[1] = a2;
     44  as->data[2] = a2;
    4545  return AUBIO_OK;
    4646}
  • src/temporal/resampler.c

    r71f2e5f r41b985f  
    1818
    1919*/
    20 
    21 #include "config.h"
    2220
    2321#include "aubio_priv.h"
  • src/utils/log.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 #include "config.h"
    2221#include "aubio_priv.h"
    2322#include "log.h"
     
    3635  FILE *out;
    3736  out = stdout;
    38   if (level == AUBIO_LOG_DBG || level == AUBIO_LOG_ERR) {
     37  if (level == AUBIO_LOG_ERR || level == AUBIO_LOG_DBG || level == AUBIO_LOG_WRN) {
    3938    out = stderr;
    4039  }
  • src/utils/log.h

    r71f2e5f r41b985f  
    4646enum aubio_log_level {
    4747  AUBIO_LOG_ERR, /**< critical errors */
    48   AUBIO_LOG_WRN, /**< warnings */
     48  AUBIO_LOG_INF, /**< infos */
    4949  AUBIO_LOG_MSG, /**< general messages */
    5050  AUBIO_LOG_DBG, /**< debug messages */
     51  AUBIO_LOG_WRN, /**< warnings */
    5152  AUBIO_LOG_LAST_LEVEL, /**< number of valid levels */
    5253};
  • src/utils/parameter.c

    r71f2e5f r41b985f  
    1919*/
    2020
    21 #include "config.h"
    2221#include "aubio_priv.h"
    2322#include "parameter.h"
  • src/utils/windll.c

    r71f2e5f r41b985f  
    2525*/
    2626
    27 #include "config.h"
     27#include "aubio_priv.h"
    2828
    2929#ifdef HAVE_WIN_HACKS
  • src/vecutils.c

    r71f2e5f r41b985f  
    1 #include "config.h"
    21#include "aubio_priv.h"
    32#include "types.h"
  • src/wscript_build

    r71f2e5f r41b985f  
    2929elif ctx.env['DEST_OS'] in ['emscripten']:
    3030    build_features = ['cstlib']
    31 else: #linux, darwin, android, mingw, ...
     31elif '--static' in ctx.env['LDFLAGS'] or '--static' in ctx.env['LINKFLAGS']:
     32    # static in cflags, ...
     33    build_features = ['cstlib']
     34else:
     35    # linux, darwin, android, mingw, ...
    3236    build_features = ['cstlib', 'cshlib']
     37
     38# also install static lib
     39from waflib.Tools.c import cstlib
     40from waflib.Tools.fc import fcstlib
     41fcstlib.inst_to = cstlib.inst_to = '${LIBDIR}'
    3342
    3443for target in build_features:
     
    3948
    4049# install headers, except _priv.h ones
    41 ctx.install_files('${PREFIX}/include/aubio/',
     50ctx.install_files('${INCLUDEDIR}/aubio/',
    4251        ctx.path.ant_glob('**/*.h', excl = ['**_priv.h', 'config.h']),
    4352        relative_trick=True)
Note: See TracChangeset for help on using the changeset viewer.