Drive MiniDisc recorders over NetMD USB.
A port of the NetMD protocol as implemented by netmd-js and libnetmd
(linux-minidisc), on top of BodgeUSB.
{:ok, device} = NetMD.open()
{:ok, disc} = NetMD.list_content(device)
:ok = NetMD.play(device)
track = %NetMD.Track{title: "New Song", format: :lp2, data: atrac3_data}
{:ok, %{track: n}} = NetMD.download(device, track)This module is a convenience facade; the layers underneath are usable on their own:
NetMD.Commands- disc listing, renaming, transfersNetMD.Interface- the full NetMD command setNetMD.Session/NetMD.Track- secure download sessionsNetMD.Device- the raw USB exchange protocolNetMD.Query- the query format/scan DSL
Summary
Functions
Close the device.
Device state (disc presence, playback state, position).
Download a track to the disc. See NetMD.Commands.download/3.
Eject the disc.
Erase the whole disc.
Erase a track (zero-based).
Enter factory mode for direct memory access and patching. Dangerous;
see NetMD.Factory.
Fast-forward.
Seek to a time within a track. See NetMD.Interface.goto_time/3.
Seek to a track (zero-based).
Full disc listing. See NetMD.Commands.list_content/1.
List all connected NetMD devices. See NetMD.Device.list/1.
Move a track (both positions zero-based).
Skip to the next track.
Open the first NetMD device found. See NetMD.Device.open/1.
Pause playback.
Start playback.
Skip to the previous track.
Rename the disc, preserving groups. See NetMD.Commands.rename_disc/3.
Rename a track (zero-based).
Restart the current track.
Rewind.
Stop playback.
Subscribe to {:netmd_status, status} change events from the background
poller. See NetMD.Device.subscribe/2.
Stop receiving status events. See NetMD.Device.unsubscribe/2.
Upload a track from the disc (MZ-RH1 only). See NetMD.Commands.upload/3.
Functions
@spec close(NetMD.Device.t()) :: :ok
Close the device.
@spec device_status(NetMD.Device.t()) :: {:ok, map()} | {:error, term()}
Device state (disc presence, playback state, position).
@spec download(NetMD.Device.t(), NetMD.Track.t(), keyword()) :: {:ok, map()} | {:error, term()}
Download a track to the disc. See NetMD.Commands.download/3.
@spec eject_disc(NetMD.Device.t()) :: :ok | {:error, term()}
Eject the disc.
@spec erase_disc(NetMD.Device.t()) :: :ok | {:error, term()}
Erase the whole disc.
@spec erase_track(NetMD.Device.t(), non_neg_integer()) :: :ok | {:error, term()}
Erase a track (zero-based).
@spec factory(NetMD.Device.t()) :: {:ok, NetMD.Factory.t()} | {:error, term()}
Enter factory mode for direct memory access and patching. Dangerous;
see NetMD.Factory.
@spec fast_forward(NetMD.Device.t()) :: :ok | {:error, term()}
Fast-forward.
@spec goto_time(NetMD.Device.t(), non_neg_integer(), keyword()) :: :ok | {:error, term()}
Seek to a time within a track. See NetMD.Interface.goto_time/3.
@spec goto_track(NetMD.Device.t(), non_neg_integer()) :: {:ok, non_neg_integer()} | {:error, term()}
Seek to a track (zero-based).
@spec list_content(NetMD.Device.t()) :: {:ok, NetMD.Disc.t()} | {:error, term()}
Full disc listing. See NetMD.Commands.list_content/1.
@spec list_devices(keyword()) :: [NetMD.Device.listing()]
List all connected NetMD devices. See NetMD.Device.list/1.
@spec move_track(NetMD.Device.t(), non_neg_integer(), non_neg_integer()) :: :ok | {:error, term()}
Move a track (both positions zero-based).
@spec next_track(NetMD.Device.t()) :: :ok | {:error, term()}
Skip to the next track.
@spec open(keyword()) :: {:ok, NetMD.Device.t()} | {:error, term()}
Open the first NetMD device found. See NetMD.Device.open/1.
@spec pause(NetMD.Device.t()) :: :ok | {:error, term()}
Pause playback.
@spec play(NetMD.Device.t()) :: :ok | {:error, term()}
Start playback.
@spec previous_track(NetMD.Device.t()) :: :ok | {:error, term()}
Skip to the previous track.
@spec rename_disc(NetMD.Device.t(), String.t(), keyword()) :: :ok | {:error, term()}
Rename the disc, preserving groups. See NetMD.Commands.rename_disc/3.
@spec rename_track(NetMD.Device.t(), non_neg_integer(), String.t(), keyword()) :: :ok | {:error, term()}
Rename a track (zero-based).
@spec restart_track(NetMD.Device.t()) :: :ok | {:error, term()}
Restart the current track.
@spec rewind(NetMD.Device.t()) :: :ok | {:error, term()}
Rewind.
@spec stop(NetMD.Device.t()) :: :ok
Stop playback.
@spec subscribe(NetMD.Device.t(), pid()) :: :ok | {:error, :status_events_unavailable}
Subscribe to {:netmd_status, status} change events from the background
poller. See NetMD.Device.subscribe/2.
@spec unsubscribe(NetMD.Device.t(), pid()) :: :ok | {:error, :status_events_unavailable}
Stop receiving status events. See NetMD.Device.unsubscribe/2.
@spec upload(NetMD.Device.t(), non_neg_integer(), keyword()) :: {:ok, map()} | {:error, term()}
Upload a track from the disc (MZ-RH1 only). See NetMD.Commands.upload/3.