Skip to content

Bug fixes, improvements and Node-API 8

Compare
Choose a tag to compare
@melchor629 melchor629 released this 30 May 16:14
· 125 commits to dev since this release

Improvements

  • Changed memory handling in C++ code (improves safety and could improve performance a bit).
  • Moved audio transformation code to C++ to improve performance.
  • Improved metadata types in functions and methods (TypeScript) so the right instance can be automatically casted with the right if condition.
  • StreamDecoder and FileDecoder now emits format which tells some information about the audio format inside the stream/file. This information can be read from another stream when piped (like in speaker package) to automatically configure itself.
  • StreamEncoder and FileEncoder now understands format event from source stream when piped. This information is used to configure the encoder automatically (if some of the values are provided already, they will be overridden by the event). Can be helpful when paired with a source stream like wav's Reader.
  • Changes Node-API v7 to v8 (affects node 12 & 14 series).
  • Supports node 16

Bug fixes

  • Properly handle exceptions when resolving promises of async methods. Previously, if an exception was thrown when resolving the promise in C++, the promise left unresolved indefinitely and the exception was lost. Now is handled properly and the promise rejects.
  • FileDecoder could retry a read if it failed, throwing two or more times the same error.
  • Avoid garbage noise under some circumstances when using StreamEncoder or FileEncoder.
  • Updated error handling in StreamDecoder, FileDecoder, StreamEncoder and FileEncoder so errors are not lost.

Possible breaking changes

  • All init functions now throws instead of returning status. The migration path is not to check the returned value in the init function and use a try/catch block if error handling is required.
  • Moved StreamDecoder and FileDecoder into a decoder module, and split implementations inside their own modules (decoder/stream-decoder and decoder/file-decoder).
  • Moved StreamEncoder and FileEncoder into a encoder module, and split implementations inside their own modules (encoder/stream-encoder and encoder/file-encoder).
  • StreamDecoder and FileDecoder now by default the outputAs32 will be always false (previously was set to true if the flac was 24 bit).
  • StreamEncoder and FileEncoder now by default the inputAs32 will be always false (previously was set to true if the input was 24 bit).