-
Notifications
You must be signed in to change notification settings - Fork 0
Class Documentation
The following descriptors/headers are used to organize the methods and variables applicable to each class detailed in this documentation file.
- ๐ Instantiation: how to create a new instance of the class.
- ๐ฌ Exposed Variables: declared upon object initialization and can be read/modified.
- โ๏ธ Configuration Methods: generally unimportant setup/debugging methods
- ๐ Action Methods: modify values or relay instructions
- ๐ฎ Request Methods: return information from a device/variable
The LtAmpBase class contains the key, shared methods and configuration options that exist between both the synchronous and asynchronous child classes, which are documented below.
Instead of instantiating LtAmpBase, you should instantiate one of its child-classes: LtAmpSync or LtAmp
Instance of HidDevice typically set by connect(). Can be set externally to any compatible object.
An instance of HidWrapper declared for each LtAmpBase-inheriting class, this can be accessed in instances where HidWrapping functionality needs to be altered or customized. LtAmpBase's self.debug is passed through to the HidWrapper
Whether received input data from the amp should be printed
The max amoount of time given for requests to be returned by the amp. Can be specified during instantiation also.
Both classes inherit the same key setup methods from LtAmpBase
Returns the first found device (HidDevice) or None if none found.
Finds the first enumerable amp, opens it (and assigns it to self.device), and sets up _process_input_data as the amp input callback. If successful, returns True, otherwise, raises an error.
Stops the input thread and closes the self.device's HidDevice.
Sends a (potentially multi-packet) protobuf message to the amp (self.device)
Important
A heartbeat must be sent every 1 second to maintain the connection.
Sends a heartbeat request to the amp.
In order to begin receiving data from the amp, you should send the SYNC_BEGIN request shortly followed by a SYNC_END message (0.2-1 second delay will work).
Finalizes the symbolic sync process with the amp.
All current action methods (setting/pushing information to an amp) are common between synchronous/asynchronous child-classes.
Sets the active preset to the index specified.
Takes a list of integers and sets the footswitch preset quick access slots (list size must be 2!)
Takes a JSON preset string (docs coming soon!) and tells the amp to begin auditioning it.
Closes the audition state and returns to previous preset/modal state.
Send a floating point gain value between -15.0 and 15.0 dB which will be configured as the gain value used for USB connections.
N/A: All request methods are declared in LtAmp and LtAmpAsync respectively.
The LtAmp class (aka LtAmpSync.py) is based on the LtAmpBase class and implements the primary mehtods synchronously.
All instantiation arguments are optional and default to the values shown below.
amp = LtAmp(debug=False, timeout=2.0)The LtAmp (synchronous) class has no additional variables not preset in the base class.
All configuration methods are inherited from LtAmpBase.
All action methods are also inherited from LtAmpBase.
Returns True or False based on whether the current self.device is connected.
Returns the current preset index or raises an error.
Returns the self.device amp's firmware's version name or raises an error.
Returns a list (with size 2) of preset indices or raises error.
Returns a boolean reflecting whether amp is currently auditioning or an error.
Returns a dictionary with keys "stack" and "heap" containing memory values or raises error.
Returns a dictionary with keys "percent", "minPercent", and "maxPercent" floating-point values or raises an error.
Returns usb gain value between -15.0 and 15.0 or raises error.
Supported by only LT4 amps, footswitch mode is returned or error is raised.
Returns a string product name for the connected device or raises an error.
An asynchronous version of the LtAmp class.
Note that all instantiation arguments are optional and default to the values shown below.
amp = LtAmpAsync(debug=False, timeout=2.0)all ltampbase variables are inherited with the addition of:
returns and can be set to a asyncio event loop
All configuration methods are inherited from LtAmpBase.
All action methods are also inherited from LtAmpBase.
All methods are the same as in LtAmp with the modification of being asyncio wait-ed-_for and asynchronous.
A wrapped class for HID USB devices which supports Windows, Linux, and (probably) MacOS.
Note
This class is largely independent of LtAmp library and may be eventually spun-off into a separate module. However, I found it necessary because I couldn't get any pre-existing hid library to work consistently across platforms.
Creates a new HidWrapper, assigning the self.backend and self.hid_lib variables based on the detected platform's respective HID module (pywinusb for Windows and hidapi for Linux/MacOS).
hid_wrapper = HidWrapper(debug=False)String value of either "hidapi"
Actual object instance of either pywinusb.hid or hid (from hidapi).
Whether debug logs should be printed for HID device writes.
N/A: self._setup_hid_library is auto-called by self.__init__ but should ideally not be messed with.
Returns a list of hid devices found.
A unified interface for dealing with a particular HID USB device which can be opened and have data written to and read from.
device = HIDDevice(self.hid_lib.device(), backend=lib, debug=False)Set to a HID lib's device object by self.__init__.
Either "hidapi" or "pywinusb" depending on platform. Determines how data is written.
Whether or not debug messages should be printed for data received.
Callback function for when data is received from USB HID device.
Sets a function (with a data parameter) to be called when new data is read from the HID USB device.
Writes data to HID USB device.
Closes device connection, opening it to be used by other applications/services.
Warning
This method is for HidAPI Only!
Can be used to read a specified amount of data over a specified time interval from the HID device.
Tip
This wiki is quite new and WIP. To navigate it, use the right sidebar!