aubio  0.4.1
lvec.h
Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
00003 
00004   This file is part of aubio.
00005 
00006   aubio is free software: you can redistribute it and/or modify
00007   it under the terms of the GNU General Public License as published by
00008   the Free Software Foundation, either version 3 of the License, or
00009   (at your option) any later version.
00010 
00011   aubio is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014   GNU General Public License for more details.
00015 
00016   You should have received a copy of the GNU General Public License
00017   along with aubio.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 #ifndef _AUBIO__LVEC_H
00022 #define _AUBIO__LVEC_H
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /** \file
00029 
00030   Vector of real-valued data in double precision
00031 
00032   This file specifies the ::lvec_t buffer type, which is used in some places in
00033   aubio to store a vector of ::lsmp_t.
00034 
00035   Note: the lvec_t data type is required in some algorithms such as IIR filters
00036   (see temporal/filter.h).
00037 
00038   \example test-lvec.c
00039 
00040 */
00041 
00042 /** Buffer for real data in double precision */
00043 typedef struct {
00044   uint_t length; /**< length of buffer */
00045   lsmp_t *data;  /**< data array of size [length] */
00046 } lvec_t;
00047 
00048 /** lvec_t buffer creation function
00049 
00050   \param length the length of the buffer to create
00051 
00052 */
00053 lvec_t * new_lvec(uint_t length);
00054 /** lvec_t buffer deletion function
00055 
00056   \param s buffer to delete as returned by new_lvec()
00057 
00058 */
00059 void del_lvec(lvec_t *s);
00060 
00061 /** read sample value in a buffer
00062 
00063   \param s vector to read from
00064   \param position sample position to read from 
00065 
00066 */
00067 lsmp_t lvec_get_sample(lvec_t *s, uint_t position);
00068 
00069 /** write sample value in a buffer
00070 
00071   \param s vector to write to 
00072   \param data value to write in s->data[position]
00073   \param position sample position to write to 
00074 
00075 */
00076 void  lvec_set_sample(lvec_t *s, lsmp_t data, uint_t position);
00077 
00078 /** read data from a buffer
00079 
00080   \param s vector to read from
00081 
00082 */
00083 lsmp_t * lvec_get_data(lvec_t *s);
00084 
00085 /** print out lvec data 
00086 
00087   \param s vector to print out 
00088 
00089 */
00090 void lvec_print(lvec_t *s);
00091 
00092 /** set all elements to a given value
00093 
00094   \param s vector to modify
00095   \param val value to set elements to
00096 
00097 */
00098 void lvec_set_all(lvec_t *s, smpl_t val);
00099 
00100 /** set all elements to zero 
00101 
00102   \param s vector to modify
00103 
00104 */
00105 void lvec_zeros(lvec_t *s);
00106 
00107 /** set all elements to ones 
00108 
00109   \param s vector to modify
00110 
00111 */
00112 void lvec_ones(lvec_t *s);
00113 
00114 #ifdef __cplusplus
00115 }
00116 #endif
00117 
00118 #endif /* _AUBIO__LVEC_H */
 All Data Structures Files Functions Variables Typedefs Defines