effect-web-midi 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +276 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/src/EMIDIAccess.js +129 -0
- package/dist/src/EMIDIAccess.js.map +1 -0
- package/dist/src/EMIDIInput.js +226 -0
- package/dist/src/EMIDIInput.js.map +1 -0
- package/dist/src/EMIDIOutput.js +227 -0
- package/dist/src/EMIDIOutput.js.map +1 -0
- package/dist/src/EMIDIPort.js +218 -0
- package/dist/src/EMIDIPort.js.map +1 -0
- package/dist/src/MIDIErrors.js +4 -0
- package/dist/src/MIDIErrors.js.map +1 -0
- package/dist/src/MIDIEventStreams.js +2 -0
- package/dist/src/MIDIEventStreams.js.map +1 -0
- package/dist/src/Parsing.js +2 -0
- package/dist/src/Parsing.js.map +1 -0
- package/dist/src/StreamMaker.js +1 -0
- package/dist/src/StreamMaker.js.map +1 -0
- package/dist/src/Util.js +2 -0
- package/dist/src/Util.js.map +1 -0
- package/dist/src/index.js +10 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal/EMIDIAccess.js +634 -0
- package/dist/src/internal/EMIDIAccess.js.map +1 -0
- package/dist/src/internal/EMIDIInput.js +66 -0
- package/dist/src/internal/EMIDIInput.js.map +1 -0
- package/dist/src/internal/EMIDIOutput.js +120 -0
- package/dist/src/internal/EMIDIOutput.js.map +1 -0
- package/dist/src/internal/EMIDIPort.js +125 -0
- package/dist/src/internal/EMIDIPort.js.map +1 -0
- package/dist/src/internal/MIDIErrors.js +190 -0
- package/dist/src/internal/MIDIErrors.js.map +1 -0
- package/dist/src/internal/MIDIEventStreams.js +41 -0
- package/dist/src/internal/MIDIEventStreams.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.js +27 -0
- package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.js +19 -0
- package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.js +16 -0
- package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/actOnPort.js +17 -0
- package/dist/src/internal/MIDIPortMethodCalls/actOnPort.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.js +27 -0
- package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.js +18 -0
- package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.js +16 -0
- package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.js +21 -0
- package/dist/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.js +34 -0
- package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.js +18 -0
- package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.js +16 -0
- package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.js.map +1 -0
- package/dist/src/internal/Parsing.js +119 -0
- package/dist/src/internal/Parsing.js.map +1 -0
- package/dist/src/internal/StreamMaker.js +105 -0
- package/dist/src/internal/StreamMaker.js.map +1 -0
- package/dist/src/internal/Util.js +59 -0
- package/dist/src/internal/Util.js.map +1 -0
- package/dist/src/internal/getPortByPortId/getPortByPortIdAndAccess.js +53 -0
- package/dist/src/internal/getPortByPortId/getPortByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/getPortByPortId/getPortByPortIdInContext.js +18 -0
- package/dist/src/internal/getPortByPortId/getPortByPortIdInContext.js.map +1 -0
- package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.js +52 -0
- package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.js.map +1 -0
- package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.js +21 -0
- package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.js +21 -0
- package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.js +66 -0
- package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.js +61 -0
- package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.js +68 -0
- package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.js +42 -0
- package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.js +43 -0
- package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.js +33 -0
- package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.js +6 -0
- package/dist/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.js +46 -0
- package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.js +25 -0
- package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.js +31 -0
- package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.js.map +1 -0
- package/dist-types/index.d.ts +2 -0
- package/dist-types/index.d.ts.map +1 -0
- package/dist-types/src/EMIDIAccess.d.ts +18 -0
- package/dist-types/src/EMIDIAccess.d.ts.map +1 -0
- package/dist-types/src/EMIDIInput.d.ts +26 -0
- package/dist-types/src/EMIDIInput.d.ts.map +1 -0
- package/dist-types/src/EMIDIOutput.d.ts +26 -0
- package/dist-types/src/EMIDIOutput.d.ts.map +1 -0
- package/dist-types/src/EMIDIPort.d.ts +26 -0
- package/dist-types/src/EMIDIPort.d.ts.map +1 -0
- package/dist-types/src/MIDIErrors.d.ts +2 -0
- package/dist-types/src/MIDIErrors.d.ts.map +1 -0
- package/dist-types/src/MIDIEventStreams.d.ts +2 -0
- package/dist-types/src/MIDIEventStreams.d.ts.map +1 -0
- package/dist-types/src/Parsing.d.ts +2 -0
- package/dist-types/src/Parsing.d.ts.map +1 -0
- package/dist-types/src/StreamMaker.d.ts +2 -0
- package/dist-types/src/StreamMaker.d.ts.map +1 -0
- package/dist-types/src/Util.d.ts +2 -0
- package/dist-types/src/Util.d.ts.map +1 -0
- package/dist-types/src/index.d.ts +10 -0
- package/dist-types/src/index.d.ts.map +1 -0
- package/dist-types/src/internal/EMIDIAccess.d.ts +551 -0
- package/dist-types/src/internal/EMIDIAccess.d.ts.map +1 -0
- package/dist-types/src/internal/EMIDIInput.d.ts +50 -0
- package/dist-types/src/internal/EMIDIInput.d.ts.map +1 -0
- package/dist-types/src/internal/EMIDIOutput.d.ts +95 -0
- package/dist-types/src/internal/EMIDIOutput.d.ts.map +1 -0
- package/dist-types/src/internal/EMIDIPort.d.ts +90 -0
- package/dist-types/src/internal/EMIDIPort.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIErrors.d.ts +270 -0
- package/dist-types/src/internal/MIDIErrors.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIEventStreams.d.ts +74 -0
- package/dist-types/src/internal/MIDIEventStreams.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.d.ts +16 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.d.ts +15 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.d.ts +13 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/actOnPort.d.ts +11 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/actOnPort.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.d.ts +23 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.d.ts +15 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.d.ts +13 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.d.ts +15 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.d.ts +21 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.d.ts +15 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.d.ts +13 -0
- package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.d.ts.map +1 -0
- package/dist-types/src/internal/Parsing.d.ts +110 -0
- package/dist-types/src/internal/Parsing.d.ts.map +1 -0
- package/dist-types/src/internal/StreamMaker.d.ts +204 -0
- package/dist-types/src/internal/StreamMaker.d.ts.map +1 -0
- package/dist-types/src/internal/Util.d.ts +33 -0
- package/dist-types/src/internal/Util.d.ts.map +1 -0
- package/dist-types/src/internal/getPortByPortId/getPortByPortIdAndAccess.d.ts +27 -0
- package/dist-types/src/internal/getPortByPortId/getPortByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/getPortByPortId/getPortByPortIdInContext.d.ts +20 -0
- package/dist-types/src/internal/getPortByPortId/getPortByPortIdInContext.d.ts.map +1 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.d.ts +76 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.d.ts.map +1 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.d.ts +39 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.d.ts +29 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.d.ts +62 -0
- package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.d.ts +16 -0
- package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.d.ts +65 -0
- package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.d.ts +36 -0
- package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.d.ts +23 -0
- package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.d.ts +35 -0
- package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.d.ts +7 -0
- package/dist-types/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.d.ts +71 -0
- package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.d.ts +7 -0
- package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.d.ts +28 -0
- package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.d.ts.map +1 -0
- package/index.ts +1 -0
- package/package.json +87 -0
- package/src/EMIDIAccess.ts +285 -0
- package/src/EMIDIInput.ts +273 -0
- package/src/EMIDIOutput.ts +272 -0
- package/src/EMIDIPort.ts +270 -0
- package/src/MIDIErrors.ts +13 -0
- package/src/MIDIEventStreams.ts +36 -0
- package/src/Parsing.ts +32 -0
- package/src/StreamMaker.ts +12 -0
- package/src/Util.ts +19 -0
- package/src/index.ts +9 -0
- package/src/internal/EMIDIAccess.ts +1280 -0
- package/src/internal/EMIDIInput.ts +114 -0
- package/src/internal/EMIDIOutput.ts +231 -0
- package/src/internal/EMIDIPort.ts +239 -0
- package/src/internal/MIDIErrors.ts +260 -0
- package/src/internal/MIDIEventStreams.ts +255 -0
- package/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.ts +48 -0
- package/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.ts +31 -0
- package/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.ts +28 -0
- package/src/internal/MIDIPortMethodCalls/actOnPort.ts +66 -0
- package/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.ts +38 -0
- package/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.ts +38 -0
- package/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.ts +28 -0
- package/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.ts +68 -0
- package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.ts +48 -0
- package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.ts +38 -0
- package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.ts +28 -0
- package/src/internal/Parsing.ts +304 -0
- package/src/internal/StreamMaker.ts +416 -0
- package/src/internal/Util.ts +152 -0
- package/src/internal/getPortByPortId/getPortByPortIdAndAccess.ts +117 -0
- package/src/internal/getPortByPortId/getPortByPortIdInContext.ts +26 -0
- package/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.ts +148 -0
- package/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.ts +135 -0
- package/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.ts +70 -0
- package/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.ts +128 -0
- package/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.ts +74 -0
- package/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.ts +132 -0
- package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.ts +64 -0
- package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.ts +114 -0
- package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.ts +47 -0
- package/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.ts +12 -0
- package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.ts +182 -0
- package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.ts +29 -0
- package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.ts +87 -0
package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect'
|
|
2
|
+
|
|
3
|
+
import type * as EMIDIPort from '../../EMIDIPort.ts'
|
|
4
|
+
import { getValueInRawPortFieldUnsafe } from '../getValueInRawPortFieldUnsafe.ts'
|
|
5
|
+
import type * as Match from '../matchMutablePortProperty/matchMutablePortPropertyByPort.ts'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
const getMutableProperty =
|
|
11
|
+
<TMIDIPortType extends MIDIPortType>() =>
|
|
12
|
+
<const TMIDIPortMutableProperty extends Match.MIDIPortMutableProperty>(
|
|
13
|
+
property: TMIDIPortMutableProperty,
|
|
14
|
+
) =>
|
|
15
|
+
<E = never, R = never>(
|
|
16
|
+
polymorphicPort: EMIDIPort.PolymorphicPort<E, R, TMIDIPortType>,
|
|
17
|
+
) =>
|
|
18
|
+
Effect.isEffect(polymorphicPort)
|
|
19
|
+
? Effect.map(polymorphicPort, getValueInRawPortFieldUnsafe(property))
|
|
20
|
+
: Effect.sync(() =>
|
|
21
|
+
getValueInRawPortFieldUnsafe(property)(polymorphicPort),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @returns A state of the hardware connection between the OS and the device
|
|
26
|
+
* ({@linkcode MIDIPortDeviceState}). Because it can change over time, it's
|
|
27
|
+
* wrapped in effect. It's taken from the {@linkcode MIDIPort.state|state}
|
|
28
|
+
* read-only property of the {@linkcode MIDIPort} interface ([MDN
|
|
29
|
+
* Reference](https://developer.mozilla.org/docs/Web/API/MIDIPort/state)).
|
|
30
|
+
*/
|
|
31
|
+
export const getPortDeviceStateByPort = getMutableProperty()('state')
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @returns A state of the connection between the browser's tab and OS
|
|
35
|
+
* abstraction of the device ({@linkcode MIDIPortConnectionState}). Because it
|
|
36
|
+
* can change over time, it's wrapped in effect. It's taken from the
|
|
37
|
+
* {@linkcode MIDIPort.connection|connection} read-only property of the
|
|
38
|
+
* {@linkcode MIDIPort} interface ([MDN
|
|
39
|
+
* Reference](https://developer.mozilla.org/docs/Web/API/MIDIPort/connection)).
|
|
40
|
+
*/
|
|
41
|
+
export const getPortConnectionStateByPort = getMutableProperty()('connection')
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
export const getInputDeviceStateByPort = getMutableProperty<'input'>()('state')
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
export const getInputConnectionStateByPort =
|
|
52
|
+
getMutableProperty<'input'>()('connection')
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
export const getOutputDeviceStateByPort =
|
|
58
|
+
getMutableProperty<'output'>()('state')
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
export const getOutputConnectionStateByPort =
|
|
64
|
+
getMutableProperty<'output'>()('connection')
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type * as Brand from 'effect/Brand'
|
|
2
|
+
import * as Effect from 'effect/Effect'
|
|
3
|
+
import * as EFunction from 'effect/Function'
|
|
4
|
+
import * as Option from 'effect/Option'
|
|
5
|
+
import * as Record from 'effect/Record'
|
|
6
|
+
|
|
7
|
+
import * as EMIDIAccess from '../../EMIDIAccess.ts'
|
|
8
|
+
import type * as EMIDIInput from '../../EMIDIInput.ts'
|
|
9
|
+
import type * as EMIDIOutput from '../../EMIDIOutput.ts'
|
|
10
|
+
import type * as EMIDIPort from '../../EMIDIPort.ts'
|
|
11
|
+
import * as MIDIErrors from '../../MIDIErrors.ts'
|
|
12
|
+
import * as Get from './getMutablePortPropertyByPort.ts'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
const getPortByIdGeneric2 =
|
|
18
|
+
<T extends Record.ReadonlyRecord<Brand.Branded<string, 'MIDIPortId'>, any>>(
|
|
19
|
+
getPortMap: <E = never, R = never>(
|
|
20
|
+
polymorphicAccess: EMIDIAccess.PolymorphicAccessInstance<E, R>,
|
|
21
|
+
) => Effect.Effect<T, E, R>,
|
|
22
|
+
) =>
|
|
23
|
+
<A, E2, R2, E = never, R = never>(
|
|
24
|
+
polymorphicAccess: EMIDIAccess.PolymorphicAccessInstance<E, R>,
|
|
25
|
+
transformPortEffect: (
|
|
26
|
+
effect: Effect.Effect<
|
|
27
|
+
T[Extract<keyof T, Brand.Branded<string, 'MIDIPortId'>>],
|
|
28
|
+
E | MIDIErrors.PortNotFoundError,
|
|
29
|
+
R
|
|
30
|
+
>,
|
|
31
|
+
) => Effect.Effect<A, E2, R2>,
|
|
32
|
+
portId: Extract<keyof T, EMIDIPort.BothId>,
|
|
33
|
+
) =>
|
|
34
|
+
EFunction.pipe(
|
|
35
|
+
getPortMap(polymorphicAccess),
|
|
36
|
+
Effect.flatMap(
|
|
37
|
+
EFunction.flow(
|
|
38
|
+
Record.get(portId),
|
|
39
|
+
Option.match({
|
|
40
|
+
onNone: () => new MIDIErrors.PortNotFoundError({ portId }),
|
|
41
|
+
onSome: e => Effect.succeed(e),
|
|
42
|
+
}),
|
|
43
|
+
),
|
|
44
|
+
),
|
|
45
|
+
transformPortEffect,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
// TODO: Check if software synth devices access is present. Having desired
|
|
49
|
+
// port absent in the record doesn't guarantee it's disconnected
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export const getPortDeviceStateByPortIdAndAccess = <E = never, R = never>(
|
|
56
|
+
polymorphicAccess: EMIDIAccess.PolymorphicAccessInstance<E, R>,
|
|
57
|
+
id: EMIDIPort.BothId,
|
|
58
|
+
) =>
|
|
59
|
+
getPortByIdGeneric2(EMIDIAccess.getAllPortsRecord)(
|
|
60
|
+
polymorphicAccess,
|
|
61
|
+
EFunction.flow(
|
|
62
|
+
Get.getPortDeviceStateByPort,
|
|
63
|
+
Effect.catchTag('PortNotFound', () =>
|
|
64
|
+
Effect.succeed('disconnected' as const),
|
|
65
|
+
),
|
|
66
|
+
),
|
|
67
|
+
id,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
export const getPortConnectionStateByPortIdAndAccess = <E = never, R = never>(
|
|
75
|
+
polymorphicAccess: EMIDIAccess.PolymorphicAccessInstance<E, R>,
|
|
76
|
+
id: EMIDIPort.BothId,
|
|
77
|
+
) =>
|
|
78
|
+
getPortByIdGeneric2(EMIDIAccess.getAllPortsRecord)(
|
|
79
|
+
polymorphicAccess,
|
|
80
|
+
Get.getPortConnectionStateByPort,
|
|
81
|
+
id,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
// TODO: getInputConnectionStateByPortIdAndAccess
|
|
85
|
+
export const getInputConnectionStateByPortIdAndAccess = <E = never, R = never>(
|
|
86
|
+
_polymorphicAccess: EMIDIAccess.PolymorphicAccessInstance<E, R>,
|
|
87
|
+
_id: EMIDIInput.Id,
|
|
88
|
+
) => {
|
|
89
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// TODO: getInputDeviceStateByPortIdAndAccess
|
|
93
|
+
export const getInputDeviceStateByPortIdAndAccess = <E = never, R = never>(
|
|
94
|
+
_polymorphicAccess: EMIDIAccess.PolymorphicAccessInstance<E, R>,
|
|
95
|
+
_id: EMIDIInput.Id,
|
|
96
|
+
) => {
|
|
97
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// TODO: getOutputConnectionStateByPortIdAndAccess
|
|
101
|
+
export const getOutputConnectionStateByPortIdAndAccess = <E = never, R = never>(
|
|
102
|
+
_polymorphicAccess: EMIDIAccess.PolymorphicAccessInstance<E, R>,
|
|
103
|
+
_id: EMIDIOutput.Id,
|
|
104
|
+
) => {
|
|
105
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// TODO: getOutputDeviceStateByPortIdAndAccess
|
|
109
|
+
export const getOutputDeviceStateByPortIdAndAccess = <E = never, R = never>(
|
|
110
|
+
_polymorphicAccess: EMIDIAccess.PolymorphicAccessInstance<E, R>,
|
|
111
|
+
_id: EMIDIOutput.Id,
|
|
112
|
+
) => {
|
|
113
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
114
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as EMIDIAccess from '../../EMIDIAccess.ts'
|
|
2
|
+
import type * as EMIDIInput from '../../EMIDIInput.ts'
|
|
3
|
+
import type * as EMIDIOutput from '../../EMIDIOutput.ts'
|
|
4
|
+
import type * as EMIDIPort from '../../EMIDIPort.ts'
|
|
5
|
+
import * as Get from './getMutablePortPropertyByPortIdAndAccess.ts'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export const getPortDeviceStateByPortId = (id: EMIDIPort.BothId) =>
|
|
12
|
+
Get.getPortDeviceStateByPortIdAndAccess(EMIDIAccess.EMIDIAccess, id)
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export const getPortConnectionStateByPortId = (id: EMIDIPort.BothId) =>
|
|
19
|
+
Get.getPortConnectionStateByPortIdAndAccess(EMIDIAccess.EMIDIAccess, id)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
export const getInputDeviceStateByPortId = (id: EMIDIInput.Id) =>
|
|
26
|
+
Get.getInputDeviceStateByPortIdAndAccess(EMIDIAccess.EMIDIAccess, id)
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export const getInputConnectionStateByPortId = (id: EMIDIInput.Id) =>
|
|
33
|
+
Get.getInputConnectionStateByPortIdAndAccess(EMIDIAccess.EMIDIAccess, id)
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export const getOutputDeviceStateByPortId = (id: EMIDIOutput.Id) =>
|
|
40
|
+
Get.getOutputDeviceStateByPortIdAndAccess(EMIDIAccess.EMIDIAccess, id)
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
export const getOutputConnectionStateByPortId = (id: EMIDIOutput.Id) =>
|
|
47
|
+
Get.getOutputConnectionStateByPortIdAndAccess(EMIDIAccess.EMIDIAccess, id)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as EMIDIPort from '../EMIDIPort.ts'
|
|
2
|
+
import type { MIDIPortMutableProperty } from './matchMutablePortProperty/matchMutablePortPropertyByPort.ts'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export const getValueInRawPortFieldUnsafe =
|
|
8
|
+
<const TMIDIPortMutableProperty extends MIDIPortMutableProperty>(
|
|
9
|
+
property: TMIDIPortMutableProperty,
|
|
10
|
+
) =>
|
|
11
|
+
(port: EMIDIPort.EMIDIPort) =>
|
|
12
|
+
EMIDIPort.assumeImpl(port)._port[property]
|
package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.ts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/** biome-ignore-all lint/style/useShorthandFunctionType: It's a nice way to
|
|
2
|
+
* preserve JSDoc comments attached to the function signature */
|
|
3
|
+
|
|
4
|
+
import * as Effect from 'effect/Effect'
|
|
5
|
+
import * as EFunction from 'effect/Function'
|
|
6
|
+
import * as Record from 'effect/Record'
|
|
7
|
+
|
|
8
|
+
import * as EMIDIInput from '../../EMIDIInput.ts'
|
|
9
|
+
import * as EMIDIOutput from '../../EMIDIOutput.ts'
|
|
10
|
+
import * as EMIDIPort from '../../EMIDIPort.ts'
|
|
11
|
+
import * as Util from '../../Util.ts'
|
|
12
|
+
import * as Get from '../getValueInRawPortFieldUnsafe.ts'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
const matchMutableMIDIPortProperty = <
|
|
18
|
+
const TMIDIPortProperty extends MIDIPortMutableProperty,
|
|
19
|
+
THighLevelPortType extends MIDIPortType,
|
|
20
|
+
>(
|
|
21
|
+
property: TMIDIPortProperty,
|
|
22
|
+
is: (port: unknown) => port is EMIDIPort.EMIDIPort<THighLevelPortType>,
|
|
23
|
+
): DualMatchPortState<THighLevelPortType, TMIDIPortProperty> =>
|
|
24
|
+
EFunction.dual<
|
|
25
|
+
MatchStatePortLast<THighLevelPortType, TMIDIPortProperty>,
|
|
26
|
+
MatchStatePortFirst<THighLevelPortType, TMIDIPortProperty>
|
|
27
|
+
>(
|
|
28
|
+
Util.polymorphicCheckInDual(is),
|
|
29
|
+
Effect.fn(function* (polymorphicPort, config) {
|
|
30
|
+
const port = yield* Util.fromPolymorphic(
|
|
31
|
+
polymorphicPort,
|
|
32
|
+
is as (
|
|
33
|
+
port: unknown,
|
|
34
|
+
) => port is EMIDIPort.EMIDIPort<THighLevelPortType>,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
const state = Get.getValueInRawPortFieldUnsafe(property)(port)
|
|
38
|
+
|
|
39
|
+
for (const [stateCase, stateCallback] of Record.toEntries(config))
|
|
40
|
+
if (state === stateCase)
|
|
41
|
+
return (stateCallback as PortStateHandler)(port)
|
|
42
|
+
|
|
43
|
+
return yield* Effect.dieMessage(
|
|
44
|
+
`AssertionFailed: Missing handler for "${state}" state inside "${property}" property`,
|
|
45
|
+
)
|
|
46
|
+
}),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
export const matchPortConnectionStateByPort = matchMutableMIDIPortProperty(
|
|
53
|
+
'connection',
|
|
54
|
+
EMIDIPort.is,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
export const matchPortDeviceStateByPort = matchMutableMIDIPortProperty(
|
|
61
|
+
'state',
|
|
62
|
+
EMIDIPort.is,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
export const matchInputConnectionStateByPort = matchMutableMIDIPortProperty(
|
|
69
|
+
'connection',
|
|
70
|
+
EMIDIInput.is,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
export const matchInputDeviceStateByPort = matchMutableMIDIPortProperty(
|
|
77
|
+
'state',
|
|
78
|
+
EMIDIInput.is,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
export const matchOutputConnectionStateByPort = matchMutableMIDIPortProperty(
|
|
85
|
+
'connection',
|
|
86
|
+
EMIDIOutput.is,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
export const matchOutputDeviceStateByPort = matchMutableMIDIPortProperty(
|
|
93
|
+
'state',
|
|
94
|
+
EMIDIOutput.is,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
export type MIDIPortMutableProperty = 'state' | 'connection'
|
|
98
|
+
|
|
99
|
+
export interface PortStateHandler {
|
|
100
|
+
(port: EMIDIPort.EMIDIPort): any
|
|
101
|
+
}
|
|
102
|
+
export interface MatcherConfigPlain extends Record<string, PortStateHandler> {}
|
|
103
|
+
|
|
104
|
+
export interface MatchResult<TActualConf extends MatcherConfigPlain, E, R>
|
|
105
|
+
extends Effect.Effect<ReturnType<TActualConf[keyof TActualConf]>, E, R> {}
|
|
106
|
+
|
|
107
|
+
export interface DualMatchPortState<
|
|
108
|
+
THighLevelPortType extends MIDIPortType,
|
|
109
|
+
TMIDIPortProperty extends MIDIPortMutableProperty,
|
|
110
|
+
> extends MatchStatePortLast<THighLevelPortType, TMIDIPortProperty>,
|
|
111
|
+
MatchStatePortFirst<THighLevelPortType, TMIDIPortProperty> {}
|
|
112
|
+
|
|
113
|
+
export interface MatchStatePortFirst<
|
|
114
|
+
THighLevelPortType extends MIDIPortType,
|
|
115
|
+
TMIDIPortProperty extends MIDIPortMutableProperty,
|
|
116
|
+
> {
|
|
117
|
+
/**
|
|
118
|
+
* Description placeholder
|
|
119
|
+
*
|
|
120
|
+
* @param polymorphicPort
|
|
121
|
+
* @param stateCaseToHandlerMap
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
<
|
|
125
|
+
TStateCaseToHandlerMap extends StateCaseToHandlerMap<
|
|
126
|
+
TMIDIPortProperty,
|
|
127
|
+
THighLevelPortType,
|
|
128
|
+
TStateCaseToHandlerMap
|
|
129
|
+
>,
|
|
130
|
+
E = never,
|
|
131
|
+
R = never,
|
|
132
|
+
>(
|
|
133
|
+
polymorphicPort: EMIDIPort.PolymorphicPort<E, R, THighLevelPortType>,
|
|
134
|
+
stateCaseToHandlerMap: TStateCaseToHandlerMap,
|
|
135
|
+
): MatchResult<TStateCaseToHandlerMap, E, R>
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface MatchStatePortLast<
|
|
139
|
+
THighLevelPortType extends MIDIPortType,
|
|
140
|
+
TMIDIPortProperty extends MIDIPortMutableProperty,
|
|
141
|
+
> {
|
|
142
|
+
/**
|
|
143
|
+
* Description placeholder
|
|
144
|
+
*
|
|
145
|
+
* @param stateCaseToHandlerMap
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
<
|
|
149
|
+
TStateCaseToHandlerMap extends StateCaseToHandlerMap<
|
|
150
|
+
TMIDIPortProperty,
|
|
151
|
+
THighLevelPortType,
|
|
152
|
+
TStateCaseToHandlerMap
|
|
153
|
+
>,
|
|
154
|
+
>(
|
|
155
|
+
stateCaseToHandlerMap: TStateCaseToHandlerMap,
|
|
156
|
+
): {
|
|
157
|
+
/**
|
|
158
|
+
* Description placeholder
|
|
159
|
+
*
|
|
160
|
+
* @param polymorphicPort
|
|
161
|
+
* @returns
|
|
162
|
+
*/
|
|
163
|
+
<E = never, R = never>(
|
|
164
|
+
polymorphicPort: EMIDIPort.PolymorphicPort<E, R, THighLevelPortType>,
|
|
165
|
+
): MatchResult<TStateCaseToHandlerMap, E, R>
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export type StateCaseToHandlerMap<
|
|
170
|
+
TMIDIPortProperty extends MIDIPortMutableProperty,
|
|
171
|
+
TMIDIPortType extends MIDIPortType,
|
|
172
|
+
TConfigSelf,
|
|
173
|
+
> = {
|
|
174
|
+
readonly [StateCase in MIDIPort[TMIDIPortProperty]]: (
|
|
175
|
+
port: EMIDIPort.EMIDIPort<TMIDIPortType>,
|
|
176
|
+
) => any
|
|
177
|
+
} & {
|
|
178
|
+
readonly [RedundantValueCaseHandling in Exclude<
|
|
179
|
+
keyof TConfigSelf,
|
|
180
|
+
MIDIPort[TMIDIPortProperty]
|
|
181
|
+
>]: never
|
|
182
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// TODO: matchInputConnectionStateByPortIdAndAccess
|
|
2
|
+
export const matchInputConnectionStateByPortIdAndAccess = () => {
|
|
3
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// TODO: matchInputDeviceStateByPortIdAndAccess
|
|
7
|
+
export const matchInputDeviceStateByPortIdAndAccess = () => {
|
|
8
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// TODO: matchOutputConnectionStateByPortIdAndAccess
|
|
12
|
+
export const matchOutputConnectionStateByPortIdAndAccess = () => {
|
|
13
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// TODO: matchOutputDeviceStateByPortIdAndAccess
|
|
17
|
+
export const matchOutputDeviceStateByPortIdAndAccess = () => {
|
|
18
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// TODO: matchPortConnectionStateByPortIdAndAccess
|
|
22
|
+
export const matchPortConnectionStateByPortIdAndAccess = () => {
|
|
23
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// TODO: matchPortDeviceStateByPortIdAndAccess
|
|
27
|
+
export const matchPortDeviceStateByPortIdAndAccess = () => {
|
|
28
|
+
throw new Error('Not implemented 😿 YET!! 🤩')
|
|
29
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type * as Effect from 'effect/Effect'
|
|
2
|
+
|
|
3
|
+
import type * as EMIDIAccess from '../../EMIDIAccess.ts'
|
|
4
|
+
import type * as EMIDIPort from '../../EMIDIPort.ts'
|
|
5
|
+
import * as Get from '../../getPortByPortId/getPortByPortIdInContext.ts'
|
|
6
|
+
import type * as MIDIErrors from '../../MIDIErrors.ts'
|
|
7
|
+
import * as Match from './matchMutablePortPropertyByPort.ts'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
const makeMatcherTakingPortIds =
|
|
13
|
+
<
|
|
14
|
+
THighLevelPortType extends MIDIPortType,
|
|
15
|
+
TMIDIPortProperty extends Match.MIDIPortMutableProperty,
|
|
16
|
+
>(
|
|
17
|
+
match: Match.DualMatchPortState<THighLevelPortType, TMIDIPortProperty>,
|
|
18
|
+
getPort: (
|
|
19
|
+
id: EMIDIPort.Id<THighLevelPortType>,
|
|
20
|
+
) => Effect.Effect<
|
|
21
|
+
EMIDIPort.EMIDIPort<NoInfer<THighLevelPortType>>,
|
|
22
|
+
MIDIErrors.PortNotFoundError,
|
|
23
|
+
EMIDIAccess.EMIDIAccess
|
|
24
|
+
>,
|
|
25
|
+
) =>
|
|
26
|
+
<
|
|
27
|
+
TStateCaseToHandlerMap extends Match.StateCaseToHandlerMap<
|
|
28
|
+
TMIDIPortProperty,
|
|
29
|
+
THighLevelPortType,
|
|
30
|
+
TStateCaseToHandlerMap
|
|
31
|
+
>,
|
|
32
|
+
>(
|
|
33
|
+
id: EMIDIPort.Id<THighLevelPortType>,
|
|
34
|
+
stateCaseToHandlerMap: TStateCaseToHandlerMap,
|
|
35
|
+
) =>
|
|
36
|
+
match(getPort(id), stateCaseToHandlerMap)
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
export const matchPortConnectionStateByPortIdInContext =
|
|
42
|
+
makeMatcherTakingPortIds(
|
|
43
|
+
Match.matchPortConnectionStateByPort,
|
|
44
|
+
Get.getPortByPortIdInContext,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
export const matchInputConnectionStateByPortIdInContext =
|
|
51
|
+
makeMatcherTakingPortIds(
|
|
52
|
+
Match.matchInputConnectionStateByPort,
|
|
53
|
+
Get.getInputByPortIdInContext,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
export const matchOutputConnectionStateByPortIdInContext =
|
|
60
|
+
makeMatcherTakingPortIds(
|
|
61
|
+
Match.matchOutputConnectionStateByPort,
|
|
62
|
+
Get.getOutputByPortIdInContext,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
export const matchPortDeviceStateByPortIdInContext = makeMatcherTakingPortIds(
|
|
69
|
+
Match.matchPortDeviceStateByPort,
|
|
70
|
+
Get.getPortByPortIdInContext,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
export const matchInputDeviceStateByPortIdInContext = makeMatcherTakingPortIds(
|
|
77
|
+
Match.matchInputDeviceStateByPort,
|
|
78
|
+
Get.getInputByPortIdInContext,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
export const matchOutputDeviceStateByPortIdInContext = makeMatcherTakingPortIds(
|
|
85
|
+
Match.matchOutputDeviceStateByPort,
|
|
86
|
+
Get.getOutputByPortIdInContext,
|
|
87
|
+
)
|