source: src/synth/sampler.h @ 5bc1477

feature/crepe
Last change on this file since 5bc1477 was 6f42c16, checked in by Paul Brossier <piem@piem.org>, 9 years ago

src/: change c header identifiers (see #35)

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[04c8346]1/*
2  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
3
4  This file is part of aubio.
5
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.
10
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.
15
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/>.
18
19*/
20
[6f42c16]21#ifndef AUBIO_SAMPLER_H
22#define AUBIO_SAMPLER_H
[04c8346]23
24/** \file
25
26  Load and play sound files.
27
28  This file loads a sample and gets ready to play it.
29
30  The `_do` function adds the new samples to the input, and write the result as
31  the output.
32
33  \example synth/test-sampler.c
34
35*/
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/** sampler object */
42typedef struct _aubio_sampler_t aubio_sampler_t;
43
44/** create new sampler object
45
46  \param samplerate the sampling rate of the new sampler
[2b6139e7]47  \param hop_size the block size of the new sampler
[04c8346]48
49  \return the newly created ::aubio_sampler_t
50
51*/
52aubio_sampler_t * new_aubio_sampler(uint_t samplerate, uint_t hop_size);
53
54/** load source in sampler
55
[2b6139e7]56  \param o sampler, created by new_aubio_sampler()
[04c8346]57  \param uri the uri of the source to load
58
59  \return 0 if successful, non-zero otherwise
60
61*/
[ce3ff2b]62uint_t aubio_sampler_load( aubio_sampler_t * o, const char_t * uri );
[04c8346]63
64/** process sampler function
65
[2b6139e7]66  \param o sampler, created by new_aubio_sampler()
[04c8346]67  \param input input of the sampler, to be added to the output
68  \param output output of the sampler
69
[2b6139e7]70This function adds the new samples from the playing source to the output.
[04c8346]71
72If `input` is not NULL and different from `output`, then the samples from `input`
73are added to the output.
74
75*/
[ce3ff2b]76void aubio_sampler_do ( aubio_sampler_t * o, const fvec_t * input, fvec_t * output);
[04c8346]77
78/** process sampler function, multiple channels
79
[2b6139e7]80  \param o sampler, created by new_aubio_sampler()
[04c8346]81  \param input input of the sampler, to be added to the output
82  \param output output of the sampler
83
[2b6139e7]84This function adds the new samples from the playing source to the output.
[04c8346]85
86If `input` is not NULL and different from `output`, then the samples from `input`
87are added to the output.
88
89*/
[ce3ff2b]90void aubio_sampler_do_multi ( aubio_sampler_t * o, const fmat_t * input, fmat_t * output);
[04c8346]91
92/** get current playing state
93
[2b6139e7]94  \param o sampler, created by new_aubio_sampler()
[04c8346]95
96  \return 0 if not playing, 1 if playing
97
98*/
[ce3ff2b]99uint_t aubio_sampler_get_playing ( const aubio_sampler_t * o );
[04c8346]100
101/** set current playing state
102
[2b6139e7]103  \param o sampler, created by new_aubio_sampler()
[04c8346]104  \param playing 0 for not playing, 1 for playing
105
106  \return 0 if successful, 1 otherwise
107
108*/
109uint_t aubio_sampler_set_playing ( aubio_sampler_t * o, uint_t playing );
110
111/** play sample from start
112
[2b6139e7]113  \param o sampler, created by new_aubio_sampler()
[04c8346]114
115  \return 0 if successful, 1 otherwise
116
117*/
118uint_t aubio_sampler_play ( aubio_sampler_t * o );
119
[2b6139e7]120/** stop sample
[04c8346]121
[2b6139e7]122  \param o sampler, created by new_aubio_sampler()
[04c8346]123
124  \return 0 if successful, 1 otherwise
125
126*/
127uint_t aubio_sampler_stop ( aubio_sampler_t * o );
128
129/** destroy ::aubio_sampler_t object
130
[2b6139e7]131  \param o sampler, created by new_aubio_sampler()
[04c8346]132
133*/
134void del_aubio_sampler( aubio_sampler_t * o );
135
136#ifdef __cplusplus
137}
138#endif
139
[6f42c16]140#endif /* AUBIO_SAMPLER_H */
Note: See TracBrowser for help on using the repository browser.