aubio
0.4.1
|
00001 /* 00002 Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> 00003 00004 This file is part of aubio. 00005 00006 aubio is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 aubio is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with aubio. If not, see <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00021 #ifndef _AUBIO_SAMPLER_H 00022 #define _AUBIO_SAMPLER_H 00023 00024 /** \file 00025 00026 Load and play sound files. 00027 00028 This file loads a sample and gets ready to play it. 00029 00030 The `_do` function adds the new samples to the input, and write the result as 00031 the output. 00032 00033 \example synth/test-sampler.c 00034 00035 */ 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 /** sampler object */ 00042 typedef struct _aubio_sampler_t aubio_sampler_t; 00043 00044 /** create new sampler object 00045 00046 \param samplerate the sampling rate of the new sampler 00047 \param hop_size the block size of the new sampler 00048 00049 \return the newly created ::aubio_sampler_t 00050 00051 */ 00052 aubio_sampler_t * new_aubio_sampler(uint_t samplerate, uint_t hop_size); 00053 00054 /** load source in sampler 00055 00056 \param o sampler, created by new_aubio_sampler() 00057 \param uri the uri of the source to load 00058 00059 \return 0 if successful, non-zero otherwise 00060 00061 */ 00062 uint_t aubio_sampler_load( aubio_sampler_t * o, char_t * uri ); 00063 00064 /** process sampler function 00065 00066 \param o sampler, created by new_aubio_sampler() 00067 \param input input of the sampler, to be added to the output 00068 \param output output of the sampler 00069 00070 This function adds the new samples from the playing source to the output. 00071 00072 If `input` is not NULL and different from `output`, then the samples from `input` 00073 are added to the output. 00074 00075 */ 00076 void aubio_sampler_do ( aubio_sampler_t * o, fvec_t * input, fvec_t * output); 00077 00078 /** process sampler function, multiple channels 00079 00080 \param o sampler, created by new_aubio_sampler() 00081 \param input input of the sampler, to be added to the output 00082 \param output output of the sampler 00083 00084 This function adds the new samples from the playing source to the output. 00085 00086 If `input` is not NULL and different from `output`, then the samples from `input` 00087 are added to the output. 00088 00089 */ 00090 void aubio_sampler_do_multi ( aubio_sampler_t * o, fmat_t * input, fmat_t * output); 00091 00092 /** get current playing state 00093 00094 \param o sampler, created by new_aubio_sampler() 00095 00096 \return 0 if not playing, 1 if playing 00097 00098 */ 00099 uint_t aubio_sampler_get_playing ( aubio_sampler_t * o ); 00100 00101 /** set current playing state 00102 00103 \param o sampler, created by new_aubio_sampler() 00104 \param playing 0 for not playing, 1 for playing 00105 00106 \return 0 if successful, 1 otherwise 00107 00108 */ 00109 uint_t aubio_sampler_set_playing ( aubio_sampler_t * o, uint_t playing ); 00110 00111 /** play sample from start 00112 00113 \param o sampler, created by new_aubio_sampler() 00114 00115 \return 0 if successful, 1 otherwise 00116 00117 */ 00118 uint_t aubio_sampler_play ( aubio_sampler_t * o ); 00119 00120 /** stop sample 00121 00122 \param o sampler, created by new_aubio_sampler() 00123 00124 \return 0 if successful, 1 otherwise 00125 00126 */ 00127 uint_t aubio_sampler_stop ( aubio_sampler_t * o ); 00128 00129 /** destroy ::aubio_sampler_t object 00130 00131 \param o sampler, created by new_aubio_sampler() 00132 00133 */ 00134 void del_aubio_sampler( aubio_sampler_t * o ); 00135 00136 #ifdef __cplusplus 00137 } 00138 #endif 00139 00140 #endif /* _AUBIO_SAMPLER_H */