roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.03k stars 205 forks source link

Create null source and sink #575

Open gavv opened 9 months ago

gavv commented 9 months ago

Add new source and sink implementations: NullSource and NullSink. Also add NullBackend corresponding to them and register it in BackendDispatcher.

Implementation is very simple: null source should produce zeros, and null sink should just ignore samples written to it.

The new backend should be employed when user specifies null:// as --input parameter of roc-recv or --output parameter of roc-send. We should ensure that roc-recv and roc-send work correctly with this special null device.

Null source or sink should report that it doesn't have clock and latency. It should accept any configuration, and if it's not provided, default to 44100 sample rate and 2 channels.

Source, sink, and backend interfaces are here: src/internal_modules/roc_sndio (see ISource, ISink, and IBackend) Example of backend implementation can be found here: src/internal_modules/roc_sndio/target_sox/roc_sndio Documentation for CLI tools is here: https://roc-streaming.org/toolkit/docs/tools/command_line_tools.html

See also #246 for additional hints.