source: src/sample.h @ c9b33bb

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since c9b33bb was 7c206df, checked in by Paul Brossier <piem@altern.org>, 19 years ago

[src,swig] added cvec methods to sample
[src,swig] added cvec methods to sample

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2   Copyright (C) 2003 Paul Brossier
3
4   This program 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 2 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13
14   You should have received a copy of the GNU General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18*/
19
20#ifndef _SAMPLE_H
21#define _SAMPLE_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/** @file
28 * Sample buffers
29 *
30 * Create fvec_t and cvec_t buffers
31 */
32
33/**
34 * Sample buffer type
35 *       
36 *   contains length and channels number
37 */
38typedef struct _fvec_t fvec_t;
39/**
40 * Spectrum buffer type
41 *
42 *   contains length and channels number
43 */ 
44typedef struct _cvec_t cvec_t;
45
46/**
47 * Buffer for audio samples
48 */
49struct _fvec_t {
50  uint_t length;
51  uint_t channels;
52  smpl_t **data;
53};
54
55/**
56 * Buffer for spectral data
57 */
58struct _cvec_t {
59  uint_t length;
60  uint_t channels;
61  smpl_t **norm;
62  smpl_t **phas;
63};
64
65
66/* buffer function */
67extern fvec_t * new_fvec(uint_t length, uint_t channels);
68extern void del_fvec(fvec_t *s);
69smpl_t fvec_read_sample(fvec_t *s, uint_t channel, uint_t position);
70void  fvec_write_sample(fvec_t *s, smpl_t data, uint_t channel, uint_t position);
71smpl_t * fvec_get_channel(fvec_t *s, uint_t channel);
72smpl_t ** fvec_get_data(fvec_t *s);
73void fvec_put_channel(fvec_t *s, smpl_t * data, uint_t channel);
74
75extern cvec_t * new_cvec(uint_t length, uint_t channels);
76extern void del_cvec(cvec_t *s);
77void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position);
78void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position);
79smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position);
80smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position);
81void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel);
82void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel);
83smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel);
84smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel);
85smpl_t ** cvec_get_norm(cvec_t *s);
86smpl_t ** cvec_get_phas(cvec_t *s);
87
88#ifdef __cplusplus
89}
90#endif
91
92#endif /* _SAMPLE_H */
Note: See TracBrowser for help on using the repository browser.