effect-web-midi 0.1.0
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 +7 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/src/EMIDIAccess.js +68 -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 +225 -0
- package/dist/src/EMIDIOutput.js.map +1 -0
- package/dist/src/EMIDIPort.js +213 -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/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 +4 -0
- package/dist/src/Util.js.map +1 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal/EMIDIAccess.js +409 -0
- package/dist/src/internal/EMIDIAccess.js.map +1 -0
- package/dist/src/internal/EMIDIInput.js +69 -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/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 +18 -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 +30 -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/StreamMaker.js +101 -0
- package/dist/src/internal/StreamMaker.js.map +1 -0
- package/dist/src/internal/errors.js +161 -0
- package/dist/src/internal/errors.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 +13 -0
- package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.js +18 -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 +61 -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 +42 -0
- package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.js.map +1 -0
- package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.js +29 -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/src/internal/parsing.js +117 -0
- package/dist/src/internal/parsing.js.map +1 -0
- package/dist/src/internal/util.js +59 -0
- package/dist/src/internal/util.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 +27 -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/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 +9 -0
- package/dist-types/src/index.d.ts.map +1 -0
- package/dist-types/src/internal/EMIDIAccess.d.ts +339 -0
- package/dist-types/src/internal/EMIDIAccess.d.ts.map +1 -0
- package/dist-types/src/internal/EMIDIInput.d.ts +48 -0
- package/dist-types/src/internal/EMIDIInput.d.ts.map +1 -0
- package/dist-types/src/internal/EMIDIOutput.d.ts +93 -0
- package/dist-types/src/internal/EMIDIOutput.d.ts.map +1 -0
- package/dist-types/src/internal/EMIDIPort.d.ts +87 -0
- package/dist-types/src/internal/EMIDIPort.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/StreamMaker.d.ts +202 -0
- package/dist-types/src/internal/StreamMaker.d.ts.map +1 -0
- package/dist-types/src/internal/errors.d.ts +260 -0
- package/dist-types/src/internal/errors.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 +71 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.d.ts.map +1 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.d.ts +4 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.d.ts +20 -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 +16 -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 +22 -0
- package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.d.ts.map +1 -0
- package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.d.ts +17 -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/dist-types/src/internal/parsing.d.ts +72 -0
- package/dist-types/src/internal/parsing.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/index.ts +1 -0
- package/package.json +83 -0
- package/src/EMIDIAccess.ts +271 -0
- package/src/EMIDIInput.ts +270 -0
- package/src/EMIDIOutput.ts +269 -0
- package/src/EMIDIPort.ts +267 -0
- package/src/MIDIErrors.ts +13 -0
- package/src/Parsing.ts +12 -0
- package/src/StreamMaker.ts +12 -0
- package/src/Util.ts +19 -0
- package/src/index.ts +8 -0
- package/src/internal/EMIDIAccess.ts +893 -0
- package/src/internal/EMIDIInput.ts +114 -0
- package/src/internal/EMIDIOutput.ts +228 -0
- package/src/internal/EMIDIPort.ts +233 -0
- package/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.ts +43 -0
- package/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.ts +39 -0
- package/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.ts +27 -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 +27 -0
- package/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.ts +73 -0
- package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.ts +44 -0
- package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.ts +38 -0
- package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.ts +27 -0
- package/src/internal/StreamMaker.ts +414 -0
- package/src/internal/errors.ts +220 -0
- package/src/internal/getPortByPortId/getPortByPortIdAndAccess.ts +116 -0
- package/src/internal/getPortByPortId/getPortByPortIdInContext.ts +26 -0
- package/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.ts +148 -0
- package/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.ts +14 -0
- package/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.ts +51 -0
- package/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.ts +127 -0
- package/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.ts +74 -0
- package/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.ts +74 -0
- package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.ts +63 -0
- package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.ts +110 -0
- package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.ts +37 -0
- package/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.ts +12 -0
- package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.ts +183 -0
- package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.ts +29 -0
- package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.ts +86 -0
- package/src/internal/parsing.ts +219 -0
- package/src/internal/util.ts +152 -0
|
@@ -0,0 +1,66 @@
|
|
|
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 EMIDIAccess from '../EMIDIAccess.ts'
|
|
7
|
+
import type * as EMIDIPort from '../EMIDIPort.ts'
|
|
8
|
+
import type * as Get from '../getPortByPortId/getPortByPortIdAndAccess.ts'
|
|
9
|
+
import type * as Make from './makeMIDIPortMethodCallerFactory.ts'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export const actOnPort = <
|
|
16
|
+
TTypeOfPortId extends MIDIPortType,
|
|
17
|
+
TPortTypeReturnedFromAccess extends TPortTypeSupportedInActing &
|
|
18
|
+
TTypeOfPortId,
|
|
19
|
+
TPortTypeSupportedInActing extends MIDIPortType,
|
|
20
|
+
TPortGettingError = never,
|
|
21
|
+
TPortGettingRequirement = never,
|
|
22
|
+
TPortActingError = never,
|
|
23
|
+
TPortActingRequirement = never,
|
|
24
|
+
>(
|
|
25
|
+
portGetterFromAccessAndPortId: Get.GetPortById<
|
|
26
|
+
TPortTypeReturnedFromAccess,
|
|
27
|
+
TTypeOfPortId,
|
|
28
|
+
never,
|
|
29
|
+
never,
|
|
30
|
+
TPortGettingError,
|
|
31
|
+
TPortGettingRequirement
|
|
32
|
+
>,
|
|
33
|
+
act: Make.TouchPort<
|
|
34
|
+
TPortActingError,
|
|
35
|
+
TPortActingRequirement,
|
|
36
|
+
TPortTypeSupportedInActing
|
|
37
|
+
>,
|
|
38
|
+
): EMIDIAccess.GetThingByPortId<
|
|
39
|
+
EMIDIAccess.EMIDIAccessInstance,
|
|
40
|
+
TPortTypeReturnedFromAccess,
|
|
41
|
+
never,
|
|
42
|
+
never,
|
|
43
|
+
TPortGettingError | TPortActingError,
|
|
44
|
+
TPortGettingRequirement | TPortActingRequirement
|
|
45
|
+
> =>
|
|
46
|
+
EFunction.dual(
|
|
47
|
+
2,
|
|
48
|
+
(polymorphicAccess, portId) =>
|
|
49
|
+
Effect.gen(function* () {
|
|
50
|
+
const access = yield* EMIDIAccess.resolve(polymorphicAccess)
|
|
51
|
+
|
|
52
|
+
const port = yield* portGetterFromAccessAndPortId(
|
|
53
|
+
access,
|
|
54
|
+
portId as unknown as EMIDIPort.Id<TTypeOfPortId>,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
const actEffect = act(
|
|
58
|
+
port as unknown as EMIDIPort.EMIDIPort<TPortTypeSupportedInActing>,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
yield* actEffect
|
|
62
|
+
|
|
63
|
+
return access
|
|
64
|
+
// biome-ignore lint/suspicious/noExplicitAny: FallbackOnUnknownOrAny backfired a bit, but I don't care about it anymore
|
|
65
|
+
}) as any,
|
|
66
|
+
)
|
|
@@ -0,0 +1,38 @@
|
|
|
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 EMIDIInput from '../../EMIDIInput.ts'
|
|
5
|
+
import * as EMIDIOutput from '../../EMIDIOutput.ts'
|
|
6
|
+
import * as EMIDIPort from '../../EMIDIPort.ts'
|
|
7
|
+
import * as F from '../makeMIDIPortMethodCallerFactory.ts'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*
|
|
12
|
+
* exported for acquire-release
|
|
13
|
+
*/
|
|
14
|
+
export const makePortConnectionCloser = F.makeMIDIPortMethodCallerFactory(
|
|
15
|
+
'close',
|
|
16
|
+
() => err => {
|
|
17
|
+
throw err
|
|
18
|
+
},
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
export const closePortConnectionByPort = makePortConnectionCloser(EMIDIPort.is)
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export const closeInputConnectionByPort = makePortConnectionCloser(
|
|
30
|
+
EMIDIInput.is,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
export const closeOutputConnectionByPort = makePortConnectionCloser(
|
|
37
|
+
EMIDIOutput.is,
|
|
38
|
+
)
|
package/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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 {
|
|
5
|
+
getInputByPortIdAndAccess,
|
|
6
|
+
getOutputByPortIdAndAccess,
|
|
7
|
+
getPortByPortIdAndAccess,
|
|
8
|
+
} from '../../getPortByPortId/getPortByPortIdAndAccess.ts'
|
|
9
|
+
import { actOnPort } from '../actOnPort.ts'
|
|
10
|
+
import {
|
|
11
|
+
closeInputConnectionByPort,
|
|
12
|
+
closeOutputConnectionByPort,
|
|
13
|
+
closePortConnectionByPort,
|
|
14
|
+
} from './closePortConnectionByPort.ts'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
export const closePortConnectionByPortIdAndAccess = actOnPort(
|
|
20
|
+
getPortByPortIdAndAccess,
|
|
21
|
+
closePortConnectionByPort,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export const closeInputConnectionByPortIdAndAccess = actOnPort(
|
|
28
|
+
getInputByPortIdAndAccess,
|
|
29
|
+
closeInputConnectionByPort,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
export const closeOutputConnectionByPortIdAndAccess = actOnPort(
|
|
36
|
+
getOutputByPortIdAndAccess,
|
|
37
|
+
closeOutputConnectionByPort,
|
|
38
|
+
)
|
package/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { flow } from 'effect/Function'
|
|
2
|
+
import * as Get from '../../getPortByPortId/getPortByPortIdInContext.ts'
|
|
3
|
+
import * as Close from './closePortConnectionByPort.ts'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export const closePortConnectionByPortIdInContext = flow(
|
|
9
|
+
Get.getPortByPortIdInContext,
|
|
10
|
+
Close.closePortConnectionByPort,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export const closeInputConnectionByPortIdInContext = flow(
|
|
17
|
+
Get.getInputByPortIdInContext,
|
|
18
|
+
Close.closeInputConnectionByPort,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
export const closeOutputConnectionByPortIdInContext = flow(
|
|
25
|
+
Get.getOutputByPortIdInContext,
|
|
26
|
+
Close.closeOutputConnectionByPort,
|
|
27
|
+
)
|
|
@@ -0,0 +1,73 @@
|
|
|
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 EMIDIPort from '../EMIDIPort.ts'
|
|
6
|
+
import * as Util from '../util.ts'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export const makeMIDIPortMethodCallerFactory =
|
|
12
|
+
<TError = never>(
|
|
13
|
+
method: 'close' | 'open',
|
|
14
|
+
mapError: (id: EMIDIPort.BothId) => (err: unknown) => TError,
|
|
15
|
+
) =>
|
|
16
|
+
<THighLevelPortType extends MIDIPortType>(
|
|
17
|
+
is: (port: unknown) => port is EMIDIPort.EMIDIPort<THighLevelPortType>,
|
|
18
|
+
): TouchPort<TError, never, THighLevelPortType> =>
|
|
19
|
+
Effect.fn(`EMIDIPort.${method}`)(function* <
|
|
20
|
+
TPortType extends THighLevelPortType,
|
|
21
|
+
TPortGettingError = never,
|
|
22
|
+
TPortGettingRequirement = never,
|
|
23
|
+
>(
|
|
24
|
+
polymorphicPort: EMIDIPort.PolymorphicPort<
|
|
25
|
+
TPortGettingError,
|
|
26
|
+
TPortGettingRequirement,
|
|
27
|
+
TPortType
|
|
28
|
+
>,
|
|
29
|
+
) {
|
|
30
|
+
const port = yield* Util.fromPolymorphic(
|
|
31
|
+
polymorphicPort,
|
|
32
|
+
is as unknown as (
|
|
33
|
+
port: unknown,
|
|
34
|
+
) => port is EMIDIPort.EMIDIPort<TPortType>,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
yield* Effect.annotateCurrentSpan({
|
|
38
|
+
method,
|
|
39
|
+
port: Util.getStaticMIDIPortInfo(port),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
yield* Effect.tryPromise({
|
|
43
|
+
try: () => EMIDIPort.assumeImpl(port)._port[method](),
|
|
44
|
+
catch: mapError(port.id),
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return port
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
export interface TouchPort<
|
|
51
|
+
TAdditionalError,
|
|
52
|
+
TAdditionalRequirement,
|
|
53
|
+
THighLevelPortType extends MIDIPortType,
|
|
54
|
+
> {
|
|
55
|
+
/**
|
|
56
|
+
* @returns An effect with the same port for easier chaining of operations
|
|
57
|
+
*/
|
|
58
|
+
<
|
|
59
|
+
TPortType extends THighLevelPortType,
|
|
60
|
+
TPortGettingError = never,
|
|
61
|
+
TPortGettingRequirement = never,
|
|
62
|
+
>(
|
|
63
|
+
polymorphicPort: EMIDIPort.PolymorphicPort<
|
|
64
|
+
TPortGettingError,
|
|
65
|
+
TPortGettingRequirement,
|
|
66
|
+
TPortType
|
|
67
|
+
>,
|
|
68
|
+
): Effect.Effect<
|
|
69
|
+
EMIDIPort.EMIDIPort<TPortType>,
|
|
70
|
+
TPortGettingError | TAdditionalError,
|
|
71
|
+
TPortGettingRequirement | TAdditionalRequirement
|
|
72
|
+
>
|
|
73
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as EMIDIInput from '../../EMIDIInput.ts'
|
|
2
|
+
import * as EMIDIOutput from '../../EMIDIOutput.ts'
|
|
3
|
+
import * as EMIDIPort from '../../EMIDIPort.ts'
|
|
4
|
+
import { remapErrorByName, UnavailablePortError } from '../../errors.ts'
|
|
5
|
+
import { makeMIDIPortMethodCallerFactory } from '../makeMIDIPortMethodCallerFactory.ts'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*
|
|
10
|
+
* exported for acquire-release
|
|
11
|
+
*/
|
|
12
|
+
export const makePortConnectionOpener = makeMIDIPortMethodCallerFactory(
|
|
13
|
+
'open',
|
|
14
|
+
portId =>
|
|
15
|
+
remapErrorByName(
|
|
16
|
+
{
|
|
17
|
+
NotAllowedError: UnavailablePortError,
|
|
18
|
+
// InvalidAccessError is kept for compatibility reason
|
|
19
|
+
// (https://github.com/WebAudio/web-midi-api/pull/278):
|
|
20
|
+
InvalidAccessError: UnavailablePortError,
|
|
21
|
+
|
|
22
|
+
InvalidStateError: UnavailablePortError,
|
|
23
|
+
},
|
|
24
|
+
'MIDI port open error handling absurd',
|
|
25
|
+
{ portId },
|
|
26
|
+
),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export const openPortConnectionByPort = makePortConnectionOpener(EMIDIPort.is)
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
export const openInputConnectionByPort = makePortConnectionOpener(EMIDIInput.is)
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
export const openOutputConnectionByPort = makePortConnectionOpener(
|
|
43
|
+
EMIDIOutput.is,
|
|
44
|
+
)
|
package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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 {
|
|
5
|
+
getInputByPortIdAndAccess,
|
|
6
|
+
getOutputByPortIdAndAccess,
|
|
7
|
+
getPortByPortIdAndAccess,
|
|
8
|
+
} from '../../getPortByPortId/getPortByPortIdAndAccess.ts'
|
|
9
|
+
import { actOnPort } from '../actOnPort.ts'
|
|
10
|
+
import {
|
|
11
|
+
openInputConnectionByPort,
|
|
12
|
+
openOutputConnectionByPort,
|
|
13
|
+
openPortConnectionByPort,
|
|
14
|
+
} from './openPortConnectionByPort.ts'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
export const openPortConnectionByPortIdAndAccess = actOnPort(
|
|
20
|
+
getPortByPortIdAndAccess,
|
|
21
|
+
openPortConnectionByPort,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export const openInputConnectionByPortIdAndAccess = actOnPort(
|
|
28
|
+
getInputByPortIdAndAccess,
|
|
29
|
+
openInputConnectionByPort,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
export const openOutputConnectionByPortIdAndAccess = actOnPort(
|
|
36
|
+
getOutputByPortIdAndAccess,
|
|
37
|
+
openOutputConnectionByPort,
|
|
38
|
+
)
|
package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { flow } from 'effect/Function'
|
|
2
|
+
import * as Get from '../../getPortByPortId/getPortByPortIdInContext.ts'
|
|
3
|
+
import * as Open from './openPortConnectionByPort.ts'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export const openPortConnectionByPortIdInContext = flow(
|
|
9
|
+
Get.getPortByPortIdInContext,
|
|
10
|
+
Open.openPortConnectionByPort,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export const openInputConnectionByPortIdInContext = flow(
|
|
17
|
+
Get.getInputByPortIdInContext,
|
|
18
|
+
Open.openInputConnectionByPort,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
export const openOutputConnectionByPortIdInContext = flow(
|
|
25
|
+
Get.getOutputByPortIdInContext,
|
|
26
|
+
Open.openOutputConnectionByPort,
|
|
27
|
+
)
|