Skip to content

Commit

Permalink
add Onda.register_lpcm_format! docstring and shameless steal/edit @er…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels committed Jan 5, 2021
1 parent a8daecc commit 539449c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/formats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@
const LPCM_FORMAT_REGISTRY = Any[]

"""
TODO precompile issues?
Onda.register_lpcm_format!(create_constructor)
Register an `AbstractLPCMFormat` constructor so that it can automatically be used when
[`format`](@ref) is called. Authors of new `AbstractLPCMFormat` subtypes should call this
function for their subtype.
`create_constructor` should be a unary function that accepts a single `file_format::AbstractString`
argument, and return either a matching `AbstractLPCMFormat` constructor or `nothing`. Any returned
`AbstractLPCMFormat` constructor `f` should be of the form `f(signal::Signal; kwargs...)::AbstractLPCMFormat`.
Note that if `Onda.register_lpcm_format!` is called in a downstream package, it must be called
within the `__init__` function of the package's top-level module to ensure that the function
is always invoked when the module is loaded (not just during precompilation). For details,
see https://docs.julialang.org/en/v1/manual/modules/#Module-initialization-and-precompilation.
"""
register_lpcm_format!(create_constructor) = push!(LPCM_FORMAT_REGISTRY, create_constructor)

Expand Down

1 comment on commit 539449c

@ericphanson
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your wording better 😄. Maybe I should copy that back over to Arrow

Please sign in to comment.