Changeset 33cd81f for src


Ignore:
Timestamp:
Mar 3, 2013, 4:50:04 AM (11 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
a64ef1d
Parents:
9e56228
Message:

src/musicutils.h: add fvec_set_window

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mathutils.c

    r9e56228 r33cd81f  
    4444
    4545fvec_t *
    46 new_aubio_window (char_t * window_type, uint_t size)
    47 {
    48   fvec_t * win = new_fvec (size);
     46new_aubio_window (char_t * window_type, uint_t length)
     47{
     48  fvec_t * win = new_fvec (length);
     49  fvec_set_window (win, window_type);
     50  return win;
     51}
     52
     53uint_t fvec_set_window (fvec_t *win, char_t *window_type) {
    4954  smpl_t * w = win->data;
    50   uint_t i;
     55  uint_t i, size = win->length;
    5156  aubio_window_type wintype;
    52   if (strcmp (window_type, "rectangle") == 0)
     57  if (window_type == NULL) {
     58      AUBIO_ERR ("window type can not be null.\n");
     59      return 1;
     60  } else if (strcmp (window_type, "rectangle") == 0)
    5361      wintype = aubio_win_rectangle;
    5462  else if (strcmp (window_type, "hamming") == 0)
     
    7179      wintype = aubio_win_default;
    7280  else {
    73       AUBIO_ERR ("unknown window type %s, using default.\n", window_type);
    74       wintype = aubio_win_default;
     81      AUBIO_ERR ("unknown window type `%s`.\n", window_type);
     82      return 1;
    7583  }
    7684  switch(wintype) {
     
    127135      break;
    128136  }
    129   return win;
     137  return 0;
    130138}
    131139
  • src/musicutils.h

    r9e56228 r33cd81f  
    4545*/
    4646fvec_t *new_aubio_window (char_t * window_type, uint_t size);
     47
     48/** set elements of a vector to window coefficients
     49
     50 */
     51uint_t fvec_set_window (fvec_t * window, char_t * window_type);
    4752
    4853/** compute the principal argument
Note: See TracChangeset for help on using the changeset viewer.