Changeset c7860af for src/lvec.c


Ignore:
Timestamp:
Dec 4, 2009, 1:32:43 AM (11 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:
66fb3ea
Parents:
c6d0169
Message:

modified fvec and lvec to be mono, added fmat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lvec.c

    rc6d0169 rc7860af  
    2222#include "lvec.h"
    2323
    24 lvec_t * new_lvec( uint_t length, uint_t channels) {
     24lvec_t * new_lvec( uint_t length) {
    2525  lvec_t * s = AUBIO_NEW(lvec_t);
    26   uint_t i,j;
    27   s->channels = channels;
     26  uint_t j;
    2827  s->length = length;
    29   s->data = AUBIO_ARRAY(lsmp_t*,s->channels);
    30   for (i=0; i< s->channels; i++) {
    31     s->data[i] = AUBIO_ARRAY(lsmp_t, s->length);
    32     for (j=0; j< s->length; j++) {
    33       s->data[i][j]=0.;
    34     }
     28  s->data = AUBIO_ARRAY(lsmp_t, s->length);
     29  for (j=0; j< s->length; j++) {
     30    s->data[j]=0.;
    3531  }
    3632  return s;
     
    3834
    3935void del_lvec(lvec_t *s) {
    40   uint_t i;
    41   for (i=0; i<s->channels; i++) {
    42     AUBIO_FREE(s->data[i]);
    43   }
    4436  AUBIO_FREE(s->data);
    4537  AUBIO_FREE(s);
    4638}
    4739
    48 void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t channel, uint_t position) {
    49   s->data[channel][position] = data;
     40void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t position) {
     41  s->data[position] = data;
    5042}
    51 lsmp_t lvec_read_sample(lvec_t *s, uint_t channel, uint_t position) {
    52   return s->data[channel][position];
    53 }
    54 void lvec_put_channel(lvec_t *s, lsmp_t * data, uint_t channel) {
    55   s->data[channel] = data;
    56 }
    57 lsmp_t * lvec_get_channel(lvec_t *s, uint_t channel) {
    58   return s->data[channel];
     43lsmp_t lvec_read_sample(lvec_t *s, uint_t position) {
     44  return s->data[position];
    5945}
    6046
    61 lsmp_t ** lvec_get_data(lvec_t *s) {
     47lsmp_t * lvec_get_data(lvec_t *s) {
    6248  return s->data;
    6349}
     
    6652
    6753void lvec_print(lvec_t *s) {
    68   uint_t i,j;
    69   for (i=0; i< s->channels; i++) {
    70     for (j=0; j< s->length; j++) {
    71       AUBIO_MSG(AUBIO_LSMP_FMT " ", s->data[i][j]);
    72     }
    73     AUBIO_MSG("\n");
     54  uint_t j;
     55  for (j=0; j< s->length; j++) {
     56    AUBIO_MSG(AUBIO_LSMP_FMT " ", s->data[j]);
    7457  }
     58  AUBIO_MSG("\n");
    7559}
    7660
    7761void lvec_set(lvec_t *s, smpl_t val) {
    78   uint_t i,j;
    79   for (i=0; i< s->channels; i++) {
    80     for (j=0; j< s->length; j++) {
    81       s->data[i][j] = val;
    82     }
     62  uint_t j;
     63  for (j=0; j< s->length; j++) {
     64    s->data[j] = val;
    8365  }
    8466}
Note: See TracChangeset for help on using the changeset viewer.