@@ -77,6 +77,8 @@ namespace lsp
77
77
float *pData; // Pointer to channel data
78
78
} channel_t ;
79
79
80
+ typedef void (*copy_function_t )(float *dst, const float *src, size_t count);
81
+
80
82
protected:
81
83
ipc::SharedMem hMem; // Shared memory descriptor
82
84
sh_header_t *pHeader; // Header of the shared buffer
@@ -94,6 +96,8 @@ namespace lsp
94
96
bool check_channels_synchronized ();
95
97
status_t open_internal ();
96
98
status_t create_internal (size_t channels, const alloc_params_t *params);
99
+ status_t read_internal (size_t channel, float *dst, size_t samples, copy_function_t copy_func);
100
+ status_t write_internal (size_t channel, const float *src, size_t samples, copy_function_t copy_func);
97
101
98
102
protected:
99
103
static bool calc_params (alloc_params_t *params, size_t channels, size_t length);
@@ -183,26 +187,32 @@ namespace lsp
183
187
184
188
public:
185
189
/* *
186
- * Return number of channels
190
+ * Return number of channels, RT safe
187
191
* @return number of channels
188
192
*/
189
193
size_t channels () const ;
190
194
191
195
/* *
192
- * Get number of samples per channel
193
- * @return number of samples per channel
196
+ * Get number of frames (or samples per channel) in the buffer, RT safe
197
+ * @return number of frames
194
198
*/
195
199
size_t length () const ;
196
200
197
201
/* *
198
- * Begin I/O operation on the stream
202
+ * Begin I/O operation on the stream, RT safe
199
203
* @param block_size the desired block size that will be read or written, zero value means infinite block size
200
204
* @return status of operation
201
205
*/
202
206
status_t begin (ssize_t block_size = 0 );
203
207
204
208
/* *
205
- * Read contents of specific channel
209
+ * Get change counter
210
+ * @return change counter
211
+ */
212
+ uint32_t counter () const ;
213
+
214
+ /* *
215
+ * Read contents of specific channel, RT safe
206
216
* Should be called between begin() and end() calls
207
217
*
208
218
* @param channel number of channel
@@ -213,18 +223,40 @@ namespace lsp
213
223
status_t read (size_t channel, float *dst, size_t samples);
214
224
215
225
/* *
216
- * Read contents of specific channel
226
+ * Read sanitized contents (removed NaNs, Infs and denormals) of specific channel, RT safe
217
227
* Should be called between begin() and end() calls
218
228
*
219
229
* @param channel number of channel
220
230
* @param dst destination buffer to store data
221
231
* @param samples number of samples to read
222
232
* @return status of operation
223
233
*/
234
+ status_t read_sanitized (size_t channel, float *dst, size_t samples);
235
+
236
+ /* *
237
+ * Write contents of the specific channel, RT safe
238
+ * Should be called between begin() and end() calls
239
+ *
240
+ * @param channel number of channel
241
+ * @param src source buffer to take data
242
+ * @param samples number of samples to write
243
+ * @return status of operation
244
+ */
224
245
status_t write (size_t channel, const float *src, size_t samples);
225
246
226
247
/* *
227
- * End I/O operations on the stream
248
+ * Write sanitized contents (removed NaNs, Infs and denormals) of the specific channel, RT safe
249
+ * Should be called between begin() and end() calls
250
+ *
251
+ * @param channel number of channel
252
+ * @param src source buffer to take data
253
+ * @param samples number of samples to write
254
+ * @return status of operation
255
+ */
256
+ status_t write_sanitized (size_t channel, const float *src, size_t samples);
257
+
258
+ /* *
259
+ * End I/O operations on the stream, RT safe
228
260
* @return status of operation
229
261
*/
230
262
status_t end ();
0 commit comments