You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
2.5KB

  1. /*
  2. Copyright (C) 2003-2015 Paul Brossier <piem@aubio.org>
  3. This file is part of aubio.
  4. aubio is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. aubio is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with aubio. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef AUBIO_LVEC_H
  16. #define AUBIO_LVEC_H
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /** \file
  21. Vector of real-valued data in double precision
  22. This file specifies the ::lvec_t buffer type, which is used in some places in
  23. aubio to store a vector of ::lsmp_t.
  24. Note: the lvec_t data type is required in some algorithms such as IIR filters
  25. (see temporal/filter.h).
  26. \example test-lvec.c
  27. */
  28. /** Buffer for real data in double precision */
  29. typedef struct {
  30. uint_t length; /**< length of buffer */
  31. lsmp_t *data; /**< data array of size [length] */
  32. } lvec_t;
  33. /** lvec_t buffer creation function
  34. \param length the length of the buffer to create
  35. */
  36. lvec_t * new_lvec(uint_t length);
  37. /** lvec_t buffer deletion function
  38. \param s buffer to delete as returned by new_lvec()
  39. */
  40. void del_lvec(lvec_t *s);
  41. /** read sample value in a buffer
  42. \param s vector to read from
  43. \param position sample position to read from
  44. */
  45. lsmp_t lvec_get_sample(lvec_t *s, uint_t position);
  46. /** write sample value in a buffer
  47. \param s vector to write to
  48. \param data value to write in s->data[position]
  49. \param position sample position to write to
  50. */
  51. void lvec_set_sample(lvec_t *s, lsmp_t data, uint_t position);
  52. /** read data from a buffer
  53. \param s vector to read from
  54. */
  55. lsmp_t * lvec_get_data(const lvec_t *s);
  56. /** print out lvec data
  57. \param s vector to print out
  58. */
  59. void lvec_print(const lvec_t *s);
  60. /** set all elements to a given value
  61. \param s vector to modify
  62. \param val value to set elements to
  63. */
  64. void lvec_set_all(lvec_t *s, smpl_t val);
  65. /** set all elements to zero
  66. \param s vector to modify
  67. */
  68. void lvec_zeros(lvec_t *s);
  69. /** set all elements to ones
  70. \param s vector to modify
  71. */
  72. void lvec_ones(lvec_t *s);
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76. #endif /* AUBIO_LVEC_H */