Ignore:
Timestamp:
Oct 4, 2016, 11:16:14 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
sampler
Children:
0a756ea
Parents:
923670d
Message:

src/synth/sampler.c: refactor interface, add file opening thread and utility functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/synth/sampler.h

    r923670d r88042ef  
    2424/** \file
    2525
    26   Load and play sound files.
     26  Load and play a sound file.
    2727
    2828  This file loads a sample and gets ready to play it.
     
    3030  The `_do` function adds the new samples to the input, and write the result as
    3131  the output.
     32
     33TODO:
     34  - add _preset_threaded(level)
     35  - add _set_stretch
     36  - add _set_pitch
    3237
    3338  \example synth/test-sampler.c
     
    5055
    5156*/
    52 aubio_sampler_t * new_aubio_sampler(uint_t samplerate, uint_t hop_size);
     57aubio_sampler_t * new_aubio_sampler(uint_t hop_size, uint_t samplerate);
    5358
    5459/** load source in sampler
     
    6267uint_t aubio_sampler_load( aubio_sampler_t * o, const char_t * uri );
    6368
     69/** queue source in sampler
     70
     71  \param o sampler, created by new_aubio_sampler()
     72  \param uri the uri of the source to load
     73
     74  \return 0 if successfully queued, non-zero otherwise
     75
     76*/
     77uint_t aubio_sampler_queue(aubio_sampler_t * o, const char_t * uri );
     78
    6479/** process sampler function
    6580
    6681  \param o sampler, created by new_aubio_sampler()
    67   \param input input of the sampler, to be added to the output
    6882  \param output output of the sampler
    6983
    70 This function adds the new samples from the playing source to the output.
    71 
    72 If `input` is not NULL and different from `output`, then the samples from `input`
    73 are added to the output.
    74 
    75 */
    76 void aubio_sampler_do ( aubio_sampler_t * o, const fvec_t * input, fvec_t * output);
     84This function get new samples from the playing source into output.
     85
     86*/
     87void aubio_sampler_do ( aubio_sampler_t * o, fvec_t * output, uint_t *read);
    7788
    7889/** process sampler function, multiple channels
    7990
    8091  \param o sampler, created by new_aubio_sampler()
    81   \param input input of the sampler, to be added to the output
    8292  \param output output of the sampler
    8393
    84 This function adds the new samples from the playing source to the output.
    85 
    86 If `input` is not NULL and different from `output`, then the samples from `input`
    87 are added to the output.
    88 
    89 */
    90 void aubio_sampler_do_multi ( aubio_sampler_t * o, const fmat_t * input, fmat_t * output);
     94This function gets new samples from the playing source into output.
     95
     96*/
     97void aubio_sampler_do_multi ( aubio_sampler_t * o, fmat_t * output, uint_t *read);
    9198
    9299/** get current playing state
     
    109116uint_t aubio_sampler_set_playing ( aubio_sampler_t * o, uint_t playing );
    110117
     118uint_t aubio_sampler_get_loop(aubio_sampler_t * o);
     119
     120/** set current looping state
     121
     122  \param o sampler, created by new_aubio_sampler()
     123  \param looping 0 for not looping, 1 for looping
     124
     125  \return 0 if successful, 1 otherwise
     126
     127*/
     128uint_t aubio_sampler_set_loop(aubio_sampler_t * o, uint_t loop);
     129
    111130/** play sample from start
    112131
     
    118137uint_t aubio_sampler_play ( aubio_sampler_t * o );
    119138
     139/** play sample from start, looping it
     140
     141  \param o sampler, created by new_aubio_sampler()
     142
     143  \return 0 if successful, 1 otherwise
     144
     145*/
     146uint_t aubio_sampler_loop ( aubio_sampler_t * o );
     147
     148/** play sample from start, once
     149
     150  \param o sampler, created by new_aubio_sampler()
     151
     152  \return 0 if successful, 1 otherwise
     153
     154*/
     155uint_t aubio_sampler_trigger ( aubio_sampler_t * o );
     156
    120157/** stop sample
    121158
     
    126163*/
    127164uint_t aubio_sampler_stop ( aubio_sampler_t * o );
     165
     166/** get end-of-file status
     167
     168  \param o sampler, created by new_aubio_sampler()
     169
     170  \return 1 when the eof is being reached, 0 otherwise
     171
     172*/
     173uint_t aubio_sampler_get_eof(aubio_sampler_t * o);
     174
     175/** get end-of-file status
     176
     177  \param o sampler, created by new_aubio_sampler()
     178
     179  \return 1 when the eof is being reached, 0 otherwise
     180
     181*/
     182uint_t aubio_sampler_get_finished (aubio_sampler_t * o);
     183
     184/** get samplerate
     185
     186  \param o sampler, created by new_aubio_sampler()
     187
     188  \return samplerate of the sampler
     189
     190*/
     191uint_t aubio_sampler_get_samplerate(aubio_sampler_t * o);
     192
     193/** get the number of samples that were set to zero while opening a file
     194
     195  \param o sampler, created by new_aubio_sampler()
     196
     197  \return samplerate of the sampler
     198
     199*/
     200uint_t aubio_sampler_get_waited_opening(aubio_sampler_t * o, uint_t waited);
     201
     202/** seek to position
     203
     204  \param o sampler, created by new_aubio_sampler()
     205  \param pos position to seek to, in samples
     206
     207  \return 0 if successful, 1 otherwise
     208
     209*/
     210uint_t aubio_sampler_seek(aubio_sampler_t * o, uint_t pos);
    128211
    129212/** destroy ::aubio_sampler_t object
Note: See TracChangeset for help on using the changeset viewer.