2 Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
4 This file is part of aubio.
6 aubio is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 aubio is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with aubio. If not, see <http://www.gnu.org/licenses/>.
21 #include "aubio_priv.h"
24 lvec_t * new_lvec(uint_t length) {
26 if ((sint_t)length <= 0) {
29 s = AUBIO_NEW(lvec_t);
31 s->data = AUBIO_ARRAY(lsmp_t, s->length);
35 void del_lvec(lvec_t *s) {
40 void lvec_set_sample(lvec_t *s, lsmp_t data, uint_t position) {
41 s->data[position] = data;
44 lsmp_t lvec_get_sample(lvec_t *s, uint_t position) {
45 return s->data[position];
48 lsmp_t * lvec_get_data(const lvec_t *s) {
52 /* helper functions */
54 void lvec_print(const lvec_t *s) {
56 for (j=0; j< s->length; j++) {
57 AUBIO_MSG(AUBIO_LSMP_FMT " ", s->data[j]);
62 void lvec_set_all (lvec_t *s, smpl_t val) {
64 for (j=0; j< s->length; j++) {
69 void lvec_zeros(lvec_t *s) {
71 memset(s->data, 0, s->length * sizeof(lsmp_t));
77 void lvec_ones(lvec_t *s) {