Packages
wavex
0.14.0
0.14.1
0.14.0
0.13.0
0.12.0
0.11.0
0.10.0
0.9.4
0.9.3
0.9.1
0.9.0
0.8.1
0.8.0
0.7.3
0.7.2
0.7.1
0.5.5
0.5.4
0.5.3
0.5.2
0.5.0
0.4.14
0.4.13
0.4.12
0.4.11
0.4.10
0.4.9
0.4.7
0.4.6
0.4.5
0.4.4
0.4.3
0.4.2
0.4.0
0.3.0
0.2.16
0.2.13
0.2.11
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.2
0.2.1
0.2.0
0.1.8
0.1.0
Read WAVE LPCM data
Current section
Files
Jump to
Current section
Files
lib/wavex/zstr.ex
defmodule Wavex.ZSTR do
@moduledoc """
A ZSTR: a NULL-terminated string.
"""
@doc """
Read a `ZSTR` value.
"""
@spec read(binary) :: binary
def read(binary) when is_binary(binary), do: do_read(binary)
@spec do_read(binary, binary) :: binary
defp do_read(etc, read \\ <<>>)
defp do_read(<<>>, read), do: String.reverse(read)
defp do_read(<<0, _::binary>>, read), do: String.reverse(read)
defp do_read(<<h, etc::binary>>, read), do: do_read(etc, <<h>> <> read)
end