Documentation ¶
Index ¶
- Constants
- Variables
- type CDJStatus
- type CDJStatusMonitor
- type Device
- type DeviceID
- type DeviceListener
- type DeviceListenerFunc
- type DeviceManager
- func (m *DeviceManager) ActiveDeviceMap() map[DeviceID]*Device
- func (m *DeviceManager) ActiveDevices() []*Device
- func (m *DeviceManager) OnDeviceAdded(key string, fn DeviceListener)
- func (m *DeviceManager) OnDeviceRemoved(key string, fn DeviceListener)
- func (m *DeviceManager) RemoveListener(key string, fn DeviceListener)
- type DeviceType
- type Network
- func (n *Network) AutoConfigure(wait time.Duration) error
- func (n *Network) CDJStatusMonitor() *CDJStatusMonitor
- func (n *Network) DeviceManager() *DeviceManager
- func (n *Network) RemoteDB() *RemoteDB
- func (n *Network) SetInterface(iface *net.Interface) error
- func (n *Network) SetVirtualCDJID(id DeviceID) error
- type PlayState
- type RemoteDB
- type StatusHandler
- type StatusHandlerFunc
- type Track
- type TrackKey
- type TrackSlot
- type TrackType
Constants ¶
const VirtualCDJFirmware = "1.43"
VirtualCDJFirmware is a string indicating the firmware version reported with status packets.
const VirtualCDJName = "prolink-go"
VirtualCDJName is the name given to the Virtual CDJ device.
Variables ¶
var ErrDeviceNotLinked = fmt.Errorf("The device is not linked on the network")
ErrDeviceNotLinked is returned by RemoteDB if the device being queried is not currently 'linked' on the network.
var Log = log15.New("module", "prolink")
Log specifies the logger that should be used for capturing information. May be disabled by replacing with the logrus.test.NullLogger.
Functions ¶
This section is empty.
Types ¶
type CDJStatus ¶
type CDJStatus struct { PlayerID DeviceID TrackID uint32 TrackDevice DeviceID TrackSlot TrackSlot TrackType TrackType PlayState PlayState IsOnAir bool IsSync bool IsMaster bool TrackBPM float32 EffectivePitch float32 SliderPitch float32 BeatInMeasure uint8 BeatsUntilCue uint16 Beat uint32 PacketNum uint32 }
CDJStatus represents various details about the current state of the CDJ.
type CDJStatusMonitor ¶
type CDJStatusMonitor struct {
// contains filtered or unexported fields
}
CDJStatusMonitor provides an interface for watching for status updates to CDJ devices on the PRO DJ LINK network.
func (*CDJStatusMonitor) AddStatusHandler ¶
func (sm *CDJStatusMonitor) AddStatusHandler(h StatusHandler)
AddStatusHandler registers a StatusHandler to be called when any CDJ on the PRO DJ LINK network reports its status.
type Device ¶
type Device struct { Name string ID DeviceID Type DeviceType MacAddr net.HardwareAddr IP net.IP LastActive time.Time }
Device represents a device on the network.
type DeviceID ¶
type DeviceID byte
DeviceID represents the ID of the device. For CDJs this is the number displayed on screen.
type DeviceListener ¶
type DeviceListener interface {
OnChange(*Device)
}
A DeviceListener responds to devices being added and removed from the PRO DJ LINK network.
type DeviceListenerFunc ¶
type DeviceListenerFunc func(*Device)
The DeviceListenerFunc is an adapter to allow a function to be used as a listener for device changes.
func (DeviceListenerFunc) OnChange ¶
func (f DeviceListenerFunc) OnChange(d *Device)
OnChange implements the DeviceListener interface.
type DeviceManager ¶
type DeviceManager struct {
// contains filtered or unexported fields
}
DeviceManager provides functionality for watching the connection status of PRO DJ LINK devices on the network.
func (*DeviceManager) ActiveDeviceMap ¶
func (m *DeviceManager) ActiveDeviceMap() map[DeviceID]*Device
ActiveDeviceMap returns a mapping of device IDs to their associated devices.
func (*DeviceManager) ActiveDevices ¶
func (m *DeviceManager) ActiveDevices() []*Device
ActiveDevices returns a list of active devices on the PRO DJ LINK network.
func (*DeviceManager) OnDeviceAdded ¶
func (m *DeviceManager) OnDeviceAdded(key string, fn DeviceListener)
OnDeviceAdded registers a listener that will be called when any PRO DJ LINK devices are added to the network. Provide a key if you wish to remove the handler later with RemoveListener by specifying the same key.
func (*DeviceManager) OnDeviceRemoved ¶
func (m *DeviceManager) OnDeviceRemoved(key string, fn DeviceListener)
OnDeviceRemoved registers a listener that will be called when any PRO DJ LINK devices are removed from the network. Provide a key if you wish to remove the handler later with RemoveListener by specifying the same key.
func (*DeviceManager) RemoveListener ¶
func (m *DeviceManager) RemoveListener(key string, fn DeviceListener)
RemoveListener removes a DeviceListener that may have been added by OnDeviceAdded or OnDeviceRemoved. Use the key you provided when adding the handler.
type DeviceType ¶
type DeviceType byte
DeviceType represents the types of devices on the network.
const ( DeviceTypeCDJ DeviceType = 0x01 DeviceTypeMixer DeviceType = 0x03 DeviceTypeRB DeviceType = 0x04 )
Defined device types.
func (DeviceType) String ¶
func (d DeviceType) String() string
String returns a string representation of a device.
type Network ¶
type Network struct { // TargetInterface specifies what network interface to broadcast announce // packets for the virtual CDJ on. // // This field should not be reconfigured, use SetInterface instead to // ensure the announce is correctly restarted on the new interface. TargetInterface *net.Interface // VirtualCDJID specifies the CDJ Device ID (Player ID) that should be used // when announcing the device. // // This field should not be reconfigured, use SetVirtualCDJID instead to // ensure the announce is correctly restarted on the new interface. VirtualCDJID DeviceID // contains filtered or unexported fields }
Network is the primary API to the PRO DJ LINK network.
func Connect ¶
Connect connects to the Pioneer PRO DJ LINK network, returning the singleton Network object to interact with the connection.
Note that after connecting you must configure the virtual CDJ ID and network interface to announce the virtual CDJ on before all functionality of the prolink network will be available, specifically:
- CDJs will not broadcast detailed payer information until they receive the announce packet and recognize the libraries virtual CDJ as being on the network.
- Any remote DB devices will not respond to metadata queries.
Both values may be autodetected or manually configured.
func (*Network) AutoConfigure ¶
AutoConfigure attempts to configure the two configuration parameters of the network.
- Determine which interface to announce the Virtual CDJ over by finding the interface which has a matching net mask to the first CDJ detected on the network.
- Determine the Virtual CDJ ID to assume by looking for the first unused CDJ ID on the network.
wait specifies how long to wait before checking what devices have appeared on the network to determine auto configuration values from.
func (*Network) CDJStatusMonitor ¶
func (n *Network) CDJStatusMonitor() *CDJStatusMonitor
CDJStatusMonitor obtains the CDJStatusMonitor for the network.
func (*Network) DeviceManager ¶
func (n *Network) DeviceManager() *DeviceManager
DeviceManager returns the DeviceManager for the network.
func (*Network) SetInterface ¶
SetInterface configures what network interface should be used when announcing the Virtual CDJ.
func (*Network) SetVirtualCDJID ¶
SetVirtualCDJID configures the CDJ ID (Player ID) that the prolink library should use to identify itself on the network. To correctly access metadata on the network this *must* be in the range from 1-4, and should *not* be a player ID that is already in use by a CDJ, otherwise the CDJ simply will not respond. This is a known issue 1
type PlayState ¶
type PlayState byte
PlayState represents the play state of the CDJ.
const ( PlayStateEmpty PlayState = 0x00 PlayStateLoading PlayState = 0x02 PlayStatePlaying PlayState = 0x03 PlayStateLooping PlayState = 0x04 PlayStatePaused PlayState = 0x05 PlayStateCued PlayState = 0x06 PlayStateCuing PlayState = 0x07 PlayStateSearching PlayState = 0x09 PlayStateSpunDown PlayState = 0x0e PlayStateEnded PlayState = 0x11 )
Play state flags
type RemoteDB ¶
type RemoteDB struct {
// contains filtered or unexported fields
}
RemoteDB provides an interface to talking to the remote database.
type StatusHandler ¶
type StatusHandler interface {
OnStatusUpdate(*CDJStatus)
}
A StatusHandler responds to status updates on a CDJ.
type StatusHandlerFunc ¶
type StatusHandlerFunc func(*CDJStatus)
The StatusHandlerFunc is an adapter to allow a function to be used as a StatusHandler.
func (StatusHandlerFunc) OnStatusUpdate ¶
func (f StatusHandlerFunc) OnStatusUpdate(s *CDJStatus)
OnStatusUpdate implements StatusHandler.
type Track ¶
type Track struct { ID uint32 Path string Title string Artist string Album string Label string Genre string Comment string Key string Length time.Duration DateAdded time.Time Artwork []byte }
Track contains track information retrieved from the remote database.
type TrackKey ¶
type TrackKey struct { TrackID uint32 Slot TrackSlot Type TrackType DeviceID DeviceID // contains filtered or unexported fields }
TrackKey is used to make queries for track metadata.
type TrackSlot ¶
type TrackSlot byte
TrackSlot represents the slot that a track is loaded from on the CDJ.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package mixstatus provides functionality for determining when a track has changed in a mixing situation.
|
Package mixstatus provides functionality for determining when a track has changed in a mixing situation. |