Shirakumo / cl-mixed

A simple audio mixing and processing library based on libmixed.
https://shirakumo.github.io/cl-mixed/
zlib License
22 stars 7 forks source link

File drain #16

Closed Gleefre closed 1 year ago

Gleefre commented 1 year ago

Adds file-drain class which opens and closes a stream for mixed:start, mixed:end and mixed:free. You can pass :file or :stream argument to choose destination. You can pass :dont-close T to prevent closing the passed stream.

Adds mixed.wav:file-drain which implements WAV format.

Important note: it shadows #:stream in #:org.shirakumo.fraf.mixed package - I used it as field name of file-drain class.

Also I didn't add documentation yet.

Gleefre commented 1 year ago

mixed:file-drain class now only have frame-position slot. Subclasses of the file-drain class should keep it updated themselves.

mixed.wav:file-drain implements writing WAV files. Destination can be a :file or a :stream (which, however, must support changing file-position). Parameters such as encoding, samplerate, number of channels are taken from the pack instance. Supported encodings are :uint8, :int16, :int24, :int32 and :float.

examples:play-to-file copies audio from one file to output (file or stream), probably changing audio parameters and file type. It also can write raw samples (with raw-file-drain).

Gleefre commented 1 year ago

I also hope I didn't misunderstood the file header format :)

Shinmera commented 1 year ago

Looks good, thanks!