2 Copyright (C) 2012-2014 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/>.
21 #ifndef AUBIO_SINK_APPLE_AUDIO_H
22 #define AUBIO_SINK_APPLE_AUDIO_H
26 Write to file using Apple AudioToolbox's
27 [ExtAudioFileRef](https://developer.apple.com/library/ios/#documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html)
29 Avoid including this file directly! Prefer using ::aubio_sink_t instead to
30 make your code portable.
32 To read from file, use ::aubio_source_t.
34 \example io/test-sink_apple_audio.c
42 /** sink_apple_audio object */
43 typedef struct _aubio_sink_apple_audio_t aubio_sink_apple_audio_t;
47 create new ::aubio_sink_apple_audio_t
49 \param uri the file path or uri to write to
50 \param samplerate sample rate to write the file at
52 \return newly created ::aubio_sink_apple_audio_t
54 Creates a new sink object.
56 If samplerate is set to 0, the creation of the file will be delayed until
57 both ::aubio_sink_preset_samplerate and ::aubio_sink_preset_channels have
61 aubio_sink_apple_audio_t * new_aubio_sink_apple_audio(const char_t * uri, uint_t samplerate);
65 preset sink samplerate
67 \param s sink, created with ::new_aubio_sink_apple_audio
68 \param samplerate samplerate to preset the sink to, in Hz
70 \return 0 on success, 1 on error
72 Preset the samplerate of the sink. The file should have been created using a
75 The file will be opened only when both samplerate and channels have been set.
78 uint_t aubio_sink_apple_audio_preset_samplerate(aubio_sink_apple_audio_t *s, uint_t samplerate);
84 \param s sink, created with ::new_aubio_sink_apple_audio
85 \param channels number of channels to preset the sink to
87 \return 0 on success, 1 on error
89 Preset the samplerate of the sink. The file should have been created using a
92 The file will be opened only when both samplerate and channels have been set.
95 uint_t aubio_sink_apple_audio_preset_channels(aubio_sink_apple_audio_t *s, uint_t channels);
99 get samplerate of sink object
101 \param s sink object, created with ::new_aubio_sink_apple_audio
102 \return samplerate, in Hz
105 uint_t aubio_sink_apple_audio_get_samplerate(const aubio_sink_apple_audio_t *s);
109 get channels of sink object
111 \param s sink object, created with ::new_aubio_sink_apple_audio
112 \return number of channels
115 uint_t aubio_sink_apple_audio_get_channels(const aubio_sink_apple_audio_t *s);
119 write monophonic vector of length hop_size to sink
121 \param s sink, created with ::new_aubio_sink_apple_audio
122 \param write_data ::fvec_t samples to write to sink
123 \param write number of frames to write
126 void aubio_sink_apple_audio_do(aubio_sink_apple_audio_t * s, fvec_t * write_data, uint_t write);
130 write polyphonic vector of length hop_size to sink
132 \param s sink, created with ::new_aubio_sink_apple_audio
133 \param write_data ::fmat_t samples to write to sink
134 \param write number of frames to write
137 void aubio_sink_apple_audio_do_multi(aubio_sink_apple_audio_t * s, fmat_t * write_data, uint_t write);
143 \param s sink_apple_audio object, created with ::new_aubio_sink_apple_audio
145 \return 0 on success, non-zero on failure
148 uint_t aubio_sink_apple_audio_close(aubio_sink_apple_audio_t * s);
152 close sink and cleanup memory
154 \param s sink, created with ::new_aubio_sink_apple_audio
157 void del_aubio_sink_apple_audio(aubio_sink_apple_audio_t * s);
163 #endif /* AUBIO_SINK_APPLE_AUDIO_H */