SuperDirtMixer Architecture:
Filter:
SuperDirtMixer/Reference (extension) | Uncategorized

SuperDirtMixer Architecture
ExtensionExtension

Mixer for SuperDirt to provide mixing presets for TidalCycles. This includes level indicators, gain, pan, reverb and eq settings for every orbit (indiviually).

Description

The design approach are describing leverages several important concepts in computer science and software engineering. Here are some key theories and principles behind it:

Design approaches

1. Event-Driven Architecture

Event-driven architecture (EDA) is a design paradigm where the flow of the program is determined by events—discrete changes in state. This approach allows for asynchronous communication between different parts of a system, improving decoupling and scalability.

Asynchronous Communication: Services can emit and respond to events without waiting for each other, leading to better performance and responsiveness. Loose Coupling: Services do not need to know about each other; they only interact through events, reducing dependencies and making the system easier to maintain and extend.

2. Observer Pattern

The observer pattern is a behavioral design pattern where an object, known as the subject, maintains a list of its dependents, called observers, and notifies them of state changes, typically by calling one of their methods.

Decoupling: Observers (services) are decoupled from the subject (handler), promoting low coupling. Reusability: Observers can be reused with different subjects without modification. Scalability: New observers can be added without changing the subject.

3. Mediator Pattern

The mediator pattern defines an object that encapsulates how a set of objects interact. This pattern promotes loose coupling by preventing objects from referring to each other explicitly and allowing their interaction to be varied independently.

Centralized Control: The handler acts as a mediator, controlling the communication between services. Simplified Communication: Services do not need to manage direct references to each other, simplifying their communication logic.

4. Publish-Subscribe (Pub-Sub) Model

The publish-subscribe pattern is a messaging pattern where senders (publishers) do not program messages to be sent directly to specific receivers (subscribers). Instead, published messages are categorized into classes without knowledge of which subscribers, if any, there may be.

Topic-Based Communication: Events are categorized by topics (event names), and subscribers register their interest in specific topics. Dynamic Subscriptions: Subscribers can dynamically subscribe or unsubscribe to events, making the system flexible.

5. Separation of Concerns

Separation of concerns is a design principle for separating a computer program into distinct sections, such that each section addresses a separate concern. A concern is a set of information that affects the code of a computer program.

Modularity: Each service handles specific types of events, making the system modular and easier to manage. Maintainability: Changes to one part of the system do not affect others, enhancing maintainability.

6. Single Responsibility Principle (SRP)

The single responsibility principle states that a class should have only one reason to change, meaning that a class should have only one job or responsibility.

Focused Classes: Each service class has a single responsibility (handling specific events), adhering to SRP.

Minimal dispatcher example

For this we need to introduce a new Class EventDispatcher and Handler. The Handler deligates the events and the event dispatcher knows, that service is subscribed to which event.

This can be called with this code: