diff --git a/src/shared/hardware-config/adapter-device-config.ts b/src/shared/hardware-config/adapter-device-config.ts index b2286fa2..fbfeb858 100644 --- a/src/shared/hardware-config/adapter-device-config.ts +++ b/src/shared/hardware-config/adapter-device-config.ts @@ -4,6 +4,8 @@ import { MessageProcessorMeta } from '../message-processor'; import { MessageTransport } from '../message-transport'; import { BaseDevicePlugin } from '../../plugins/core/base-device-plugin'; import { BasePlugin } from '../../plugins/core/base-plugin'; +import { getQualifiedInputId } from '../util'; +import { idForMsg } from '../midi-util'; export class AdapterDeviceConfig extends DeviceConfig { child?: SupportedDeviceConfig; @@ -34,8 +36,24 @@ export class AdapterDeviceConfig extends DeviceConfig { this.child = config; } + /** + * Interestingly, at this point, we're not event calling the child for anything here. + * Makes one wonder what the relationship between adapters and children is, and + * whether or not DeviceConfigs need to be aware of their own inputs at runtime. + */ public process(msg: NumberArrayWithStatus, meta: MessageProcessorMeta) { - return this.child?.process(msg, meta); + if (this.child) { + const message = super.process(msg, meta)!; + const messageIdentifier = idForMsg(msg, false); + + const input = meta.inputProvider.get( + getQualifiedInputId(this.id, messageIdentifier), + ); + + return input ? input.process(message, meta) : message; + } + + return msg; } public init(loopbackTransport: MessageTransport) { diff --git a/src/shared/hardware-config/supported-device-config.ts b/src/shared/hardware-config/supported-device-config.ts index 9e2aa9b5..9b11119b 100755 --- a/src/shared/hardware-config/supported-device-config.ts +++ b/src/shared/hardware-config/supported-device-config.ts @@ -31,6 +31,7 @@ export class SupportedDeviceConfig extends DeviceConfig