strmctrl

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2025 License: MIT Imports: 8 Imported by: 0

README

strmctrl

A Go library to control your soomfon Stream Controller SE on linux.

Dependencies

The library uses gousb under the hood. You must install libusb-1.0 in order to use the strmctrl.

Usage

See cmd/main.go for an example how to use the strmctrl library.

License

This software is published under the MIT License.

Copyright Florian Thienel

Documentation

Index

Constants

View Source
const (
	// ImageSize is the width and height of the quadratic images for the display buttons in pixels.
	ImageSize = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action uint8
const (
	Released Action = iota
	Pressed
	TurnedCW
	TurnedCCW
)

func (Action) IsPress

func (a Action) IsPress() bool

func (Action) IsRotation

func (a Action) IsRotation() bool

type Control

type Control uint8
const (
	DisplayTopLeft Control = iota + 1
	DisplayTopCenter
	DisplayTopRight
	DisplayBottomLeft
	DisplayBottomCenter
	DisplayBottomRight
	ButtonLeft
	ButtonCenter
	ButtonRight
	KnobTop
	KnobBottomLeft
	KnobBottomRight
)

func (Control) IsButton

func (c Control) IsButton() bool

func (Control) IsDisplay

func (c Control) IsDisplay() bool

func (Control) IsKnob

func (c Control) IsKnob() bool

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device represents one Stream Controller SE that is connected via USB.

func Open

func Open(serial string) (*Device, error)

Open the Stream Controller SE device with the given serial number. If the serial number is empty, the first available device is opened.

func (*Device) Clear

func (d *Device) Clear(ctx context.Context) error

Clear the display buttons.

func (*Device) Close

func (d *Device) Close()

Close the device and clean up the used system resources.

func (*Device) Descriptor

func (d *Device) Descriptor() string

func (*Device) ReadEvents

func (d *Device) ReadEvents(ctx context.Context) (<-chan Event, error)

ReadEvents returns a channel that provides the incoming events. This function starts a goroutine and must only be called once.

func (*Device) SetBrightness

func (d *Device) SetBrightness(ctx context.Context, percent uint8) error

SetBrightness in percent (0-100).

func (*Device) SetImage

func (d *Device) SetImage(ctx context.Context, display Control, img image.Image) error

SetImage sets the image of a specific display button.

func (*Device) SetImages

func (d *Device) SetImages(ctx context.Context, imgs [6]image.Image) error

SetImages sets the images of all six display buttons at once.

type DeviceInfo

type DeviceInfo struct {
	Bus     int
	Address int
	Serial  string
}

func List

func List() ([]DeviceInfo, error)

List the available Stream Controller SE devices with their serial number.

func (DeviceInfo) String

func (i DeviceInfo) String() string

type Event

type Event struct {
	Control Control
	Action  Action
}

func (Event) Is

func (e Event) Is(control Control, action Action) bool

func (Event) IsPress

func (e Event) IsPress(control Control) bool

func (Event) IsRotation

func (e Event) IsRotation(control Control) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL