Changeset 194ef6b


Ignore:
Timestamp:
Sep 25, 2009, 4:09:25 AM (12 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
c423c3d
Parents:
d69e37d
Message:

ext/jackio.{c,h}: convert data from smpl_t to jack_default_audio_sample_t when needed

Location:
ext
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ext/jackio.c

    rd69e37d r194ef6b  
    1818*/
    1919
    20 #include "config.h"
    21 #ifdef HAVE_JACK
     20#include <aubio.h>
     21
     22#if HAVE_JACK
    2223#include <jack/jack.h>
    2324#include "aubio_priv.h"
    2425#include "jackio.h"
    2526
    26 /*typedef jack_default_audio_sample_t jack_sample_t; */
    27 /* work with float, never tried in double */
    28 typedef smpl_t jack_sample_t;
     27typedef jack_default_audio_sample_t jack_sample_t;
     28
     29#if !AUBIO_SINGLE_PRECISION
     30#define AUBIO_JACK_MAX_FRAMES 4096
     31#define AUBIO_JACK_NEEDS_CONVERSION
     32#endif
    2933
    3034/**
     
    4246  /** jack output buffer */
    4347  jack_sample_t **obufs;
     48#ifdef AUBIO_JACK_NEEDS_CONVERSION
     49  /** converted jack input buffer */
     50  smpl_t **sibufs;
     51  /** converted jack output buffer */
     52  smpl_t **sobufs;
     53#endif
    4454  /** jack input channels */
    4555  uint_t ichan;
     
    139149  jack_setup->ibufs  = AUBIO_ARRAY(jack_sample_t*, ichan);
    140150  jack_setup->obufs  = AUBIO_ARRAY(jack_sample_t*, ochan);
     151#ifdef AUBIO_JACK_NEEDS_CONVERSION
     152  jack_setup->sibufs = AUBIO_ARRAY(smpl_t*, ichan);
     153  uint_t i;
     154  for (i = 0; i < ichan; i++) {
     155    jack_setup->sibufs[i] = AUBIO_ARRAY(smpl_t, AUBIO_JACK_MAX_FRAMES);
     156  }
     157  jack_setup->sobufs = AUBIO_ARRAY(smpl_t*, ochan);
     158  for (i = 0; i < ochan; i++) {
     159    jack_setup->sobufs[i] = AUBIO_ARRAY(smpl_t, AUBIO_JACK_MAX_FRAMES);
     160  }
     161#endif
    141162  return jack_setup;
    142163}
     
    168189      (jack_sample_t *) jack_port_get_buffer (dev->oports[i], nframes);
    169190  }
     191#ifndef AUBIO_JACK_NEEDS_CONVERSION
    170192  dev->callback(dev->ibufs,dev->obufs,nframes);
     193#else
     194  uint_t j;
     195  for (j = 0; j < MIN(nframes, AUBIO_JACK_MAX_FRAMES); j++) {
     196    for (i = 0; i < dev->ichan; i++) {
     197      dev->sibufs[i][j] = (smpl_t)dev->ibufs[i][j];
     198    }
     199  }
     200  dev->callback(dev->sibufs, dev->sobufs, nframes);
     201  for (j = 0; j < MIN(nframes, AUBIO_JACK_MAX_FRAMES); j++) {
     202    for (i = 0; i < dev->ichan; i++) {
     203      dev->obufs[i][j] = (jack_sample_t)dev->sobufs[i][j];
     204    }
     205  }
     206#endif
    171207  return 0;
    172208}
  • ext/jackio.h

    rd69e37d r194ef6b  
    3535typedef struct _aubio_jack_t aubio_jack_t;
    3636/** jack process function */
    37 typedef int (*aubio_process_func_t)(float **input, float **output, int
    38     nframes);
     37typedef int (*aubio_process_func_t)(smpl_t **input,
     38    smpl_t **output, int nframes);
    3939
    4040/** jack device creation function */
Note: See TracChangeset for help on using the changeset viewer.