source: src/io/sink.h @ 4ed4b1f

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

src/io/sink.h: add do_multi, preset_samplerate, preset_channels, get_samplerate, and get_channels

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2  Copyright (C) 2012-2014 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
21#ifndef _AUBIO_SINK_H
22#define _AUBIO_SINK_H
23
24/** \file
25
26  Media sink to write blocks of consecutive audio samples to file.
27
28  To read from file, use ::aubio_source_t.
29
30  \example io/test-sink.c
31
32*/
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/** media sink object */
39typedef struct _aubio_sink_t aubio_sink_t;
40
41/**
42
43  create new ::aubio_sink_t
44
45  \param uri the file path or uri to write to
46  \param samplerate sample rate to write the file at
47
48  \return newly created ::aubio_sink_t
49
50  Creates a new sink object.
51
52  If samplerate is set to 0, the creation of the file will be delayed until
53  both ::aubio_sink_preset_samplerate and ::aubio_sink_preset_channels have
54  been called.
55
56*/
57aubio_sink_t * new_aubio_sink(char_t * uri, uint_t samplerate);
58
59/**
60
61  preset sink samplerate
62
63  \param s sink, created with ::new_aubio_sink
64  \param samplerate samplerate to preset the sink to, in Hz
65
66  \return 0 on success, 1 on error
67
68  Preset the samplerate of the sink. The file should have been created using a
69  samplerate of 0.
70
71  The file will be opened only when both samplerate and channels have been set.
72
73*/
74uint_t aubio_sink_preset_samplerate(aubio_sink_t *s, uint_t samplerate);
75
76/**
77
78  preset sink channels
79
80  \param s sink, created with ::new_aubio_sink
81  \param channels number of channels to preset the sink to
82
83  \return 0 on success, 1 on error
84
85  Preset the samplerate of the sink. The file should have been created using a
86  samplerate of 0.
87
88  The file will be opened only when both samplerate and channels have been set.
89
90*/
91uint_t aubio_sink_preset_channels(aubio_sink_t *s, uint_t channels);
92
93/**
94
95  get samplerate of sink object
96
97  \param s sink object, created with ::new_aubio_sink
98  \return samplerate, in Hz
99
100*/
101uint_t aubio_sink_get_samplerate(aubio_sink_t *s);
102
103/**
104
105  get channels of sink object
106
107  \param s sink object, created with ::new_aubio_sink
108  \return number of channels
109
110*/
111uint_t aubio_sink_get_channels(aubio_sink_t *s);
112
113/**
114
115  write monophonic vector of length hop_size to sink
116
117  \param s sink, created with ::new_aubio_sink
118  \param write_data ::fvec_t samples to write to sink
119  \param write number of frames to write
120
121*/
122void aubio_sink_do(aubio_sink_t * s, fvec_t * write_data, uint_t write);
123
124/**
125
126  write polyphonic vector of length hop_size to sink
127
128  \param s sink, created with ::new_aubio_sink
129  \param write_data ::fmat_t samples to write to sink
130  \param write number of frames to write
131
132*/
133void aubio_sink_do_multi(aubio_sink_t * s, fmat_t * write_data, uint_t write);
134
135/**
136
137  close sink
138
139  \param s sink object, created with ::new_aubio_sink
140
141  \return 0 on success, non-zero on failure
142
143*/
144uint_t aubio_sink_close(aubio_sink_t * s);
145
146/**
147
148  close sink and cleanup memory
149
150  \param s sink object, created with ::new_aubio_sink
151
152*/
153void del_aubio_sink(aubio_sink_t * s);
154
155#ifdef __cplusplus
156}
157#endif
158
159#endif /* _AUBIO_SINK_H */
Note: See TracBrowser for help on using the repository browser.