source: src/io/sink.h @ 3e94f77e

feature/cnnfeature/crepefix/ffmpeg5
Last change on this file since 3e94f77e 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: 4.4 KB
RevLine 
[9316173]1/*
[4ed4b1f]2  Copyright (C) 2012-2014 Paul Brossier <piem@aubio.org>
[9316173]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_SINK_H
22#define AUBIO_SINK_H
[9316173]23
24/** \file
25
[ac20c85]26  Media sink to write blocks of consecutive audio samples to file.
[9316173]27
[4ed4b1f]28  To read from file, use ::aubio_source_t.
29
[db21ca4]30  Depending on how aubio was compiled, the following sinks will be available.
31
32  When creating a new sink using ::new_aubio_sink, the new function of each of
33  the compiled-in sinks will be attempted, in the following order, until one of
34  them gets successfully created. If all sinks returned NULL, ::new_aubio_sink
35  will return NULL.
36
37  \b \p sink_apple_audio : ExtAudioFileRef
38
39  This sink uses CoreAudio [Extended Audio File Services]
40  (https://developer.apple.com/library/mac/documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html)
41  to write 16-bits encoded WAV files.
42
43  \b \p sink_sndfile : libsndfile
44
45  This sink uses [libsndfile](http://www.mega-nerd.com/libsndfile/) to write
46  16-bits encoded WAV files.
47
48  \b \p sink_wavwrite : native WAV write
49
50  A simple sink to write 16-bits PCM RIFF encoded WAV files.
51
[69b11d8]52  \example io/test-sink.c
53
[9316173]54*/
55
[4e3723d]56#ifdef __cplusplus
57extern "C" {
58#endif
59
[ac20c85]60/** media sink object */
[9316173]61typedef struct _aubio_sink_t aubio_sink_t;
[ac20c85]62
63/**
64
65  create new ::aubio_sink_t
66
67  \param uri the file path or uri to write to
68  \param samplerate sample rate to write the file at
69
70  \return newly created ::aubio_sink_t
71
72  Creates a new sink object.
73
[4ed4b1f]74  If samplerate is set to 0, the creation of the file will be delayed until
75  both ::aubio_sink_preset_samplerate and ::aubio_sink_preset_channels have
76  been called.
77
[ac20c85]78*/
[ae5d58a]79aubio_sink_t * new_aubio_sink(const char_t * uri, uint_t samplerate);
[ac20c85]80
81/**
82
[4ed4b1f]83  preset sink samplerate
84
85  \param s sink, created with ::new_aubio_sink
86  \param samplerate samplerate to preset the sink to, in Hz
87
88  \return 0 on success, 1 on error
89
90  Preset the samplerate of the sink. The file should have been created using a
91  samplerate of 0.
92
93  The file will be opened only when both samplerate and channels have been set.
94
95*/
96uint_t aubio_sink_preset_samplerate(aubio_sink_t *s, uint_t samplerate);
97
98/**
99
100  preset sink channels
101
102  \param s sink, created with ::new_aubio_sink
103  \param channels number of channels to preset the sink to
104
105  \return 0 on success, 1 on error
106
107  Preset the samplerate of the sink. The file should have been created using a
108  samplerate of 0.
109
110  The file will be opened only when both samplerate and channels have been set.
111
112*/
113uint_t aubio_sink_preset_channels(aubio_sink_t *s, uint_t channels);
114
115/**
116
117  get samplerate of sink object
118
119  \param s sink object, created with ::new_aubio_sink
120  \return samplerate, in Hz
121
122*/
[ae5d58a]123uint_t aubio_sink_get_samplerate(const aubio_sink_t *s);
[4ed4b1f]124
125/**
126
127  get channels of sink object
128
129  \param s sink object, created with ::new_aubio_sink
130  \return number of channels
131
132*/
[ae5d58a]133uint_t aubio_sink_get_channels(const aubio_sink_t *s);
[4ed4b1f]134
135/**
136
[ac20c85]137  write monophonic vector of length hop_size to sink
138
139  \param s sink, created with ::new_aubio_sink
140  \param write_data ::fvec_t samples to write to sink
141  \param write number of frames to write
142
143*/
144void aubio_sink_do(aubio_sink_t * s, fvec_t * write_data, uint_t write);
145
146/**
147
[4ed4b1f]148  write polyphonic vector of length hop_size to sink
149
150  \param s sink, created with ::new_aubio_sink
151  \param write_data ::fmat_t samples to write to sink
152  \param write number of frames to write
153
154*/
155void aubio_sink_do_multi(aubio_sink_t * s, fmat_t * write_data, uint_t write);
156
157/**
158
[a9fd272]159  close sink
160
161  \param s sink object, created with ::new_aubio_sink
162
163  \return 0 on success, non-zero on failure
164
165*/
166uint_t aubio_sink_close(aubio_sink_t * s);
167
168/**
169
[ac20c85]170  close sink and cleanup memory
171
[a9fd272]172  \param s sink object, created with ::new_aubio_sink
[ac20c85]173
174*/
[9316173]175void del_aubio_sink(aubio_sink_t * s);
176
177#ifdef __cplusplus
178}
179#endif
180
[6f42c16]181#endif /* AUBIO_SINK_H */
Note: See TracBrowser for help on using the repository browser.