[ci] add pip install to readthedocs.yaml
[aubio.git] / src / io / ioutils.h
1 /*
2   Copyright (C) 2016 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_IOUTILS_H
22 #define AUBIO_IOUTILS_H
23
24 /** \file
25
26   Simple utility functions to validate input parameters.
27
28 */
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /** validate samplerate
35
36   \param kind       the object kind to report on
37   \param path       the object properties to report on
38   \param samplerate the object properties to report on
39   \return  0 if ok, non-zero if validation failed
40
41  */
42 uint_t aubio_io_validate_samplerate(const char_t *kind, const char_t *path,
43     uint_t samplerate);
44
45 /** validate number of channels
46
47   \param kind       the object kind to report on
48   \param path       the object properties to report on
49   \param channels   the object properties to report on
50   \return  0 if ok, non-zero if validation failed
51
52  */
53 uint_t aubio_io_validate_channels(const char_t *kind, const char_t *path,
54     uint_t channels);
55
56 /** validate length of source output
57
58   \param kind       the object kind to report on
59   \param path       the path to report on
60   \param hop_size   number of frames to be read
61   \param read_data_length actual length of input
62
63   \return hop_size or the maximum number of frames that can be written
64 */
65 uint_t
66 aubio_source_validate_input_length(const char_t *kind, const char_t *path,
67     uint_t hop_size, uint_t read_data_length);
68
69 /** validate height of source output
70
71   \param kind       the object kind to report on
72   \param path       the path to report on
73   \param source_channels maximum number of channels that can be written
74   \param read_data_height actual height of input
75
76   \return write_data_height or the maximum number of channels
77 */
78 uint_t
79 aubio_source_validate_input_channels(const char_t *kind, const char_t *path,
80     uint_t source_channels, uint_t read_data_height);
81
82 /** pad end of source output vector with zeroes
83
84   \param read_data   output vector to pad
85   \param source_read number of frames read
86
87 */
88 void
89 aubio_source_pad_output (fvec_t *read_data, uint_t source_read);
90
91 /** pad end of source output matrix with zeroes
92
93   \param read_data   output matrix to pad
94   \param source_channels number of channels in the source
95   \param source_read number of frames read
96
97 */
98 void
99 aubio_source_pad_multi_output (fmat_t *read_data, uint_t source_channels,
100         uint_t source_read);
101
102 /** validate length of sink input
103
104   \param kind       the object kind to report on
105   \param path       the path to report on
106   \param max_size   maximum number of frames that can be written
107   \param write_data_length actual length of input
108   \param write number of samples asked
109
110   \return write or the maximum number of frames that can be written
111 */
112 uint_t
113 aubio_sink_validate_input_length(const char_t *kind, const char_t *path,
114     uint_t max_size, uint_t write_data_length, uint_t write);
115
116 /** validate height of sink input
117
118   \param kind       the object kind to report on
119   \param path       the path to report on
120   \param sink_channels maximum number of channels that can be written
121   \param write_data_height actual height of input matrix
122
123   \return write_data_height or the maximum number of channels
124 */
125 uint_t
126 aubio_sink_validate_input_channels(const char_t *kind, const char_t *path,
127     uint_t sink_channels, uint_t write_data_height);
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif /* AUBIO_IOUTILS_H */