2 Copyright (C) 2016 Paul Brossier <piem@aubio.org>
4 This file is part of aubio.
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.
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.
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/>.
22 #include "aubio_priv.h"
25 aubio_io_validate_samplerate(const char_t *kind, const char_t *path, uint_t samplerate)
27 if ((sint_t)(samplerate) <= 0) {
28 AUBIO_ERR("%s: failed creating %s, samplerate should be positive, not %d\n",
29 kind, path, samplerate);
32 if ((sint_t)samplerate > AUBIO_MAX_SAMPLERATE) {
33 AUBIO_ERR("%s: failed creating %s, samplerate %dHz is too large\n",
34 kind, path, samplerate);
41 aubio_io_validate_channels(const char_t *kind, const char_t *path, uint_t channels)
43 if ((sint_t)(channels) <= 0) {
44 AUBIO_ERR("sink_%s: failed creating %s, channels should be positive, not %d\n",
45 kind, path, channels);
48 if (channels > AUBIO_MAX_CHANNELS) {
49 AUBIO_ERR("sink_%s: failed creating %s, too many channels (%d but %d available)\n",
50 kind, path, channels, AUBIO_MAX_CHANNELS);