1 | /* |
---|
2 | Copyright (C) 2012-2014 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_SINK_APPLE_AUDIO_H |
---|
22 | #define _AUBIO_SINK_APPLE_AUDIO_H |
---|
23 | |
---|
24 | /** \file |
---|
25 | |
---|
26 | Write to file using Apple AudioToolbox's |
---|
27 | [ExtAudioFileRef](https://developer.apple.com/library/ios/#documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html) |
---|
28 | |
---|
29 | Avoid including this file directly! Prefer using ::aubio_sink_t instead to |
---|
30 | make your code portable. |
---|
31 | |
---|
32 | To read from file, use ::aubio_source_t. |
---|
33 | |
---|
34 | \example io/test-sink_apple_audio.c |
---|
35 | |
---|
36 | */ |
---|
37 | |
---|
38 | #ifdef __cplusplus |
---|
39 | extern "C" { |
---|
40 | #endif |
---|
41 | |
---|
42 | /** sink_apple_audio object */ |
---|
43 | typedef struct _aubio_sink_apple_audio_t aubio_sink_apple_audio_t; |
---|
44 | |
---|
45 | /** |
---|
46 | |
---|
47 | create new ::aubio_sink_apple_audio_t |
---|
48 | |
---|
49 | \param uri the file path or uri to write to |
---|
50 | \param samplerate sample rate to write the file at |
---|
51 | |
---|
52 | \return newly created ::aubio_sink_apple_audio_t |
---|
53 | |
---|
54 | Creates a new sink object. |
---|
55 | |
---|
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 |
---|
58 | been called. |
---|
59 | |
---|
60 | */ |
---|
61 | aubio_sink_apple_audio_t * new_aubio_sink_apple_audio(char_t * uri, uint_t samplerate); |
---|
62 | |
---|
63 | /** |
---|
64 | |
---|
65 | preset sink samplerate |
---|
66 | |
---|
67 | \param s sink, created with ::new_aubio_sink_apple_audio |
---|
68 | \param samplerate samplerate to preset the sink to, in Hz |
---|
69 | |
---|
70 | \return 0 on success, 1 on error |
---|
71 | |
---|
72 | Preset the samplerate of the sink. The file should have been created using a |
---|
73 | samplerate of 0. |
---|
74 | |
---|
75 | The file will be opened only when both samplerate and channels have been set. |
---|
76 | |
---|
77 | */ |
---|
78 | uint_t aubio_sink_apple_audio_preset_samplerate(aubio_sink_apple_audio_t *s, uint_t samplerate); |
---|
79 | |
---|
80 | /** |
---|
81 | |
---|
82 | preset sink channels |
---|
83 | |
---|
84 | \param s sink, created with ::new_aubio_sink_apple_audio |
---|
85 | \param channels number of channels to preset the sink to |
---|
86 | |
---|
87 | \return 0 on success, 1 on error |
---|
88 | |
---|
89 | Preset the samplerate of the sink. The file should have been created using a |
---|
90 | samplerate of 0. |
---|
91 | |
---|
92 | The file will be opened only when both samplerate and channels have been set. |
---|
93 | |
---|
94 | */ |
---|
95 | uint_t aubio_sink_apple_audio_preset_channels(aubio_sink_apple_audio_t *s, uint_t channels); |
---|
96 | |
---|
97 | /** |
---|
98 | |
---|
99 | get samplerate of sink object |
---|
100 | |
---|
101 | \param s sink object, created with ::new_aubio_sink_apple_audio |
---|
102 | \return samplerate, in Hz |
---|
103 | |
---|
104 | */ |
---|
105 | uint_t aubio_sink_apple_audio_get_samplerate(aubio_sink_apple_audio_t *s); |
---|
106 | |
---|
107 | /** |
---|
108 | |
---|
109 | get channels of sink object |
---|
110 | |
---|
111 | \param s sink object, created with ::new_aubio_sink_apple_audio |
---|
112 | \return number of channels |
---|
113 | |
---|
114 | */ |
---|
115 | uint_t aubio_sink_apple_audio_get_channels(aubio_sink_apple_audio_t *s); |
---|
116 | |
---|
117 | /** |
---|
118 | |
---|
119 | write monophonic vector of length hop_size to sink |
---|
120 | |
---|
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 |
---|
124 | |
---|
125 | */ |
---|
126 | void aubio_sink_apple_audio_do(aubio_sink_apple_audio_t * s, fvec_t * write_data, uint_t write); |
---|
127 | |
---|
128 | /** |
---|
129 | |
---|
130 | write polyphonic vector of length hop_size to sink |
---|
131 | |
---|
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 |
---|
135 | |
---|
136 | */ |
---|
137 | void aubio_sink_apple_audio_do_multi(aubio_sink_apple_audio_t * s, fmat_t * write_data, uint_t write); |
---|
138 | |
---|
139 | /** |
---|
140 | |
---|
141 | close sink |
---|
142 | |
---|
143 | \param s sink_apple_audio object, created with ::new_aubio_sink_apple_audio |
---|
144 | |
---|
145 | \return 0 on success, non-zero on failure |
---|
146 | |
---|
147 | */ |
---|
148 | uint_t aubio_sink_apple_audio_close(aubio_sink_apple_audio_t * s); |
---|
149 | |
---|
150 | /** |
---|
151 | |
---|
152 | close sink and cleanup memory |
---|
153 | |
---|
154 | \param s sink, created with ::new_aubio_sink_apple_audio |
---|
155 | |
---|
156 | */ |
---|
157 | void del_aubio_sink_apple_audio(aubio_sink_apple_audio_t * s); |
---|
158 | |
---|
159 | #ifdef __cplusplus |
---|
160 | } |
---|
161 | #endif |
---|
162 | |
---|
163 | #endif /* _AUBIO_SINK_APPLE_AUDIO_H */ |
---|