roc-streaming / roc-toolkit

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

Support devices in roc-copy #655

Open gavv opened 7 months ago

gavv commented 7 months ago

Problem

roc-copy tool copies samples from input to output, performing necessary conversions if necessary.

Currently roc-copy requires that both input and output should be files, and fails otherwise. It does it by checking has_clock() value, which is true for devices and false for files.

Solution

We can allow one of the input or output to be device (but not both, because roc-copy doesn't have clock drift compensation).

Code: https://github.com/roc-streaming/roc-toolkit/blob/develop/src/tools/roc_copy/main.cpp

Testing

Ensure that "copying" from microphone to file, and from file to speakers works fine.

E.g.:

roc-copy -vv -i pulse://default -o file:test.wav
roc-copy -vv -i file:test.wav -o pulse://default

Docs

Manual page should be updated: https://github.com/roc-streaming/roc-toolkit/blob/develop/docs/sphinx/manuals/roc_copy.rst