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
|
@@ -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,28 @@
|
|
|
1
|
+
import { flow } from 'effect/Function'
|
|
2
|
+
|
|
3
|
+
import * as Get from '../../getPortByPortId/getPortByPortIdInContext.ts'
|
|
4
|
+
import * as Close from './closePortConnectionByPort.ts'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export const closePortConnectionByPortIdInContext = flow(
|
|
10
|
+
Get.getPortByPortIdInContext,
|
|
11
|
+
Close.closePortConnectionByPort,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export const closeInputConnectionByPortIdInContext = flow(
|
|
18
|
+
Get.getInputByPortIdInContext,
|
|
19
|
+
Close.closeInputConnectionByPort,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
export const closeOutputConnectionByPortIdInContext = flow(
|
|
26
|
+
Get.getOutputByPortIdInContext,
|
|
27
|
+
Close.closeOutputConnectionByPort,
|
|
28
|
+
)
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
|
|
6
|
+
import * as EMIDIPort from '../EMIDIPort.ts'
|
|
7
|
+
import * as Util from '../Util.ts'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export const makeMIDIPortMethodCallerFactory =
|
|
13
|
+
<TError = never>(
|
|
14
|
+
method: 'close' | 'open',
|
|
15
|
+
mapError: (id: EMIDIPort.BothId) => (err: unknown) => TError,
|
|
16
|
+
) =>
|
|
17
|
+
<THighLevelPortType extends MIDIPortType>(
|
|
18
|
+
is: (port: unknown) => port is EMIDIPort.EMIDIPort<THighLevelPortType>,
|
|
19
|
+
): TouchPort<TError, never, THighLevelPortType> =>
|
|
20
|
+
Effect.fn(`EMIDIPort.${method}`)(function* <
|
|
21
|
+
TPortType extends THighLevelPortType,
|
|
22
|
+
E = never,
|
|
23
|
+
R = never,
|
|
24
|
+
>(polymorphicPort: EMIDIPort.PolymorphicPort<E, R, TPortType>) {
|
|
25
|
+
const port = yield* Util.fromPolymorphic(
|
|
26
|
+
polymorphicPort,
|
|
27
|
+
is as unknown as (
|
|
28
|
+
port: unknown,
|
|
29
|
+
) => port is EMIDIPort.EMIDIPort<TPortType>,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
yield* Effect.annotateCurrentSpan({
|
|
33
|
+
method,
|
|
34
|
+
port: Util.getStaticMIDIPortInfo(port),
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
yield* Effect.tryPromise({
|
|
38
|
+
try: () => EMIDIPort.assumeImpl(port)._port[method](),
|
|
39
|
+
catch: mapError(port.id),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
return port
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
export interface TouchPort<
|
|
46
|
+
TAdditionalError,
|
|
47
|
+
TAdditionalRequirement,
|
|
48
|
+
THighLevelPortType extends MIDIPortType,
|
|
49
|
+
> {
|
|
50
|
+
/**
|
|
51
|
+
* @returns An effect with the same port for easier chaining of operations
|
|
52
|
+
*/
|
|
53
|
+
<
|
|
54
|
+
TPortType extends THighLevelPortType,
|
|
55
|
+
TPortGettingError = never,
|
|
56
|
+
TPortGettingRequirement = never,
|
|
57
|
+
>(
|
|
58
|
+
polymorphicPort: EMIDIPort.PolymorphicPort<
|
|
59
|
+
TPortGettingError,
|
|
60
|
+
TPortGettingRequirement,
|
|
61
|
+
TPortType
|
|
62
|
+
>,
|
|
63
|
+
): Effect.Effect<
|
|
64
|
+
EMIDIPort.EMIDIPort<TPortType>,
|
|
65
|
+
TPortGettingError | TAdditionalError,
|
|
66
|
+
TPortGettingRequirement | TAdditionalRequirement
|
|
67
|
+
>
|
|
68
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as EMIDIInput from '../../EMIDIInput.ts'
|
|
2
|
+
import * as EMIDIOutput from '../../EMIDIOutput.ts'
|
|
3
|
+
import * as EMIDIPort from '../../EMIDIPort.ts'
|
|
4
|
+
import * as MIDIErrors from '../../MIDIErrors.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
|
+
MIDIErrors.remapErrorByName(
|
|
16
|
+
{
|
|
17
|
+
NotAllowedError: MIDIErrors.CannotOpenUnavailablePortError,
|
|
18
|
+
// InvalidAccessError is kept for compatibility reason
|
|
19
|
+
// (https://github.com/WebAudio/web-midi-api/pull/278):
|
|
20
|
+
InvalidAccessError: MIDIErrors.CannotOpenUnavailablePortError,
|
|
21
|
+
|
|
22
|
+
// InvalidStateError is not mentioned in the list of possible failures
|
|
23
|
+
// of `.open()` method in the specification, but given `.send()` throws
|
|
24
|
+
// `InvalidStateError`, when the port is "disconnected", this remapping
|
|
25
|
+
// wouldn't hurt
|
|
26
|
+
InvalidStateError: MIDIErrors.CannotOpenUnavailablePortError,
|
|
27
|
+
},
|
|
28
|
+
'MIDI port open error handling absurd',
|
|
29
|
+
{ portId },
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
export const openPortConnectionByPort = makePortConnectionOpener(EMIDIPort.is)
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
export const openInputConnectionByPort = makePortConnectionOpener(EMIDIInput.is)
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
export const openOutputConnectionByPort = makePortConnectionOpener(
|
|
47
|
+
EMIDIOutput.is,
|
|
48
|
+
)
|
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,28 @@
|
|
|
1
|
+
import { flow } from 'effect/Function'
|
|
2
|
+
|
|
3
|
+
import * as Get from '../../getPortByPortId/getPortByPortIdInContext.ts'
|
|
4
|
+
import * as Open from './openPortConnectionByPort.ts'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export const openPortConnectionByPortIdInContext = flow(
|
|
10
|
+
Get.getPortByPortIdInContext,
|
|
11
|
+
Open.openPortConnectionByPort,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export const openInputConnectionByPortIdInContext = flow(
|
|
18
|
+
Get.getInputByPortIdInContext,
|
|
19
|
+
Open.openInputConnectionByPort,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
export const openOutputConnectionByPortIdInContext = flow(
|
|
26
|
+
Get.getOutputByPortIdInContext,
|
|
27
|
+
Open.openOutputConnectionByPort,
|
|
28
|
+
)
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file This module is not for general use, these are just helpers to test the
|
|
3
|
+
* MIDI API with the only MIDI device I have: nanoPAD v1
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as Stream from 'effect/Stream'
|
|
7
|
+
|
|
8
|
+
import type * as EMIDIInput from './EMIDIInput.ts'
|
|
9
|
+
|
|
10
|
+
//? NOTE: Look at the issue https://github.com/WebAudio/web-midi-api/issues/179
|
|
11
|
+
// which discusses higher-level MIDI message access
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param self
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export const withParsedDataField = <A extends MIDIMessage, E, R>(
|
|
19
|
+
self: Stream.Stream<A, E, R>,
|
|
20
|
+
): Stream.Stream<ParsedMIDIMessage, E, R> =>
|
|
21
|
+
Stream.map(self, ({ midiMessage, ...obj }) => ({
|
|
22
|
+
...obj,
|
|
23
|
+
_tag: 'ParsedMIDIMessage',
|
|
24
|
+
midiMessage: parseMIDIMessagePayload(midiMessage),
|
|
25
|
+
}))
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param self
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export const withTouchpadPositionUpdates = <
|
|
33
|
+
A extends {
|
|
34
|
+
midiMessage:
|
|
35
|
+
| ControlChangePayload
|
|
36
|
+
| TouchpadReleasePayload
|
|
37
|
+
| PitchBendChangePayload
|
|
38
|
+
| { _tag: string & {} }
|
|
39
|
+
},
|
|
40
|
+
E,
|
|
41
|
+
R,
|
|
42
|
+
>(
|
|
43
|
+
self: Stream.Stream<A, E, R>,
|
|
44
|
+
): Stream.Stream<
|
|
45
|
+
| A
|
|
46
|
+
| (Omit<A, 'midiMessage'> & {
|
|
47
|
+
readonly midiMessage: TouchpadPositionUpdatePayload
|
|
48
|
+
}),
|
|
49
|
+
E,
|
|
50
|
+
R
|
|
51
|
+
> =>
|
|
52
|
+
Stream.mapAccum(
|
|
53
|
+
self,
|
|
54
|
+
{ x: null as number | null, y: null as number | null },
|
|
55
|
+
(ctx, current) => {
|
|
56
|
+
const { midiMessage, ...rest } = current
|
|
57
|
+
const state = isControlChangePayload(midiMessage)
|
|
58
|
+
? { ...ctx, y: midiMessage.value }
|
|
59
|
+
: isPitchBendChangePayload(midiMessage)
|
|
60
|
+
? { ...ctx, x: midiMessage.value }
|
|
61
|
+
: midiMessage._tag === 'Touchpad Release'
|
|
62
|
+
? { x: null, y: null }
|
|
63
|
+
: ctx
|
|
64
|
+
|
|
65
|
+
return [
|
|
66
|
+
state,
|
|
67
|
+
state.x !== null && state.y !== null
|
|
68
|
+
? Stream.make(current, {
|
|
69
|
+
...rest,
|
|
70
|
+
midiMessage: {
|
|
71
|
+
_tag: 'Touchpad Position Update' as const,
|
|
72
|
+
x: state.x,
|
|
73
|
+
y: state.y,
|
|
74
|
+
} satisfies TouchpadPositionUpdatePayload,
|
|
75
|
+
})
|
|
76
|
+
: Stream.succeed(current),
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
).pipe(Stream.flatten())
|
|
80
|
+
|
|
81
|
+
export type DefaultParsedMIDIMessagePayload =
|
|
82
|
+
| NoteReleasePayload
|
|
83
|
+
| NotePressPayload
|
|
84
|
+
| UnknownReplyPayload
|
|
85
|
+
| ControlChangePayload
|
|
86
|
+
| ChannelPressurePayload
|
|
87
|
+
| TouchpadReleasePayload
|
|
88
|
+
| PitchBendChangePayload
|
|
89
|
+
|
|
90
|
+
export interface MIDIMessage {
|
|
91
|
+
readonly _tag: 'MIDIMessage'
|
|
92
|
+
readonly cameFrom: EMIDIInput.EMIDIInput
|
|
93
|
+
readonly capturedAt: Date
|
|
94
|
+
readonly midiMessage: Uint8Array<ArrayBuffer>
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ParsedMIDIMessage<
|
|
98
|
+
Payload extends TaggedObject = DefaultParsedMIDIMessagePayload,
|
|
99
|
+
> {
|
|
100
|
+
readonly _tag: 'ParsedMIDIMessage'
|
|
101
|
+
readonly cameFrom: EMIDIInput.EMIDIInput
|
|
102
|
+
readonly capturedAt: Date
|
|
103
|
+
readonly midiMessage: Payload
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function parseMIDIMessagePayload(
|
|
107
|
+
rawPayload: Uint8Array<ArrayBuffer>,
|
|
108
|
+
): DefaultParsedMIDIMessagePayload {
|
|
109
|
+
const unknown = () => {
|
|
110
|
+
let stack = ''
|
|
111
|
+
if (
|
|
112
|
+
'stackTraceLimit' in Error &&
|
|
113
|
+
'captureStackTrace' in Error &&
|
|
114
|
+
typeof Error.captureStackTrace === 'function'
|
|
115
|
+
) {
|
|
116
|
+
const { stackTraceLimit } = Error
|
|
117
|
+
Error.stackTraceLimit = 4
|
|
118
|
+
const stackHolder = {} as { stack: string }
|
|
119
|
+
Error.captureStackTrace(stackHolder)
|
|
120
|
+
Error.stackTraceLimit = stackTraceLimit
|
|
121
|
+
stack = stackHolder.stack ?? new Error().stack ?? ''
|
|
122
|
+
}
|
|
123
|
+
const result = {
|
|
124
|
+
_tag: 'Unknown Reply' as const,
|
|
125
|
+
unexpectedData: rawPayload.toString(),
|
|
126
|
+
stack,
|
|
127
|
+
}
|
|
128
|
+
return result
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const status = rawPayload.at(0)
|
|
132
|
+
if (status === undefined) return unknown()
|
|
133
|
+
|
|
134
|
+
const second = rawPayload.at(1)
|
|
135
|
+
if (second === undefined) return unknown()
|
|
136
|
+
|
|
137
|
+
const code = status >> 4
|
|
138
|
+
const channel = status & 0b1111
|
|
139
|
+
|
|
140
|
+
if (rawPayload.length === 2) {
|
|
141
|
+
if (code === 0xd)
|
|
142
|
+
return { _tag: 'Channel Pressure', channel, velocity: second }
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (rawPayload.length !== 3) return unknown()
|
|
146
|
+
|
|
147
|
+
const third = rawPayload.at(2)
|
|
148
|
+
if (third === undefined) return unknown()
|
|
149
|
+
|
|
150
|
+
if (code === 0x8)
|
|
151
|
+
return { _tag: 'Note Release', channel, note: second, velocity: third }
|
|
152
|
+
|
|
153
|
+
if (code === 0x9) {
|
|
154
|
+
if (third === 0)
|
|
155
|
+
return { _tag: 'Note Release', channel, note: second, velocity: 64 }
|
|
156
|
+
return { _tag: 'Note Press', channel, note: second, velocity: third }
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (code === 0xb)
|
|
160
|
+
return { _tag: 'Control Change', channel, control: second, value: third }
|
|
161
|
+
|
|
162
|
+
if (code === 0xe) {
|
|
163
|
+
if (second === 0 && third === 0x40)
|
|
164
|
+
return { _tag: 'Touchpad Release', channel }
|
|
165
|
+
|
|
166
|
+
if (second === third)
|
|
167
|
+
return { _tag: 'Pitch Bend Change', channel, value: second }
|
|
168
|
+
|
|
169
|
+
return unknown()
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return unknown()
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const isSpecificPayload =
|
|
176
|
+
<Payload extends TaggedObject>(tag: Payload['_tag']) =>
|
|
177
|
+
(e: TaggedObject): e is Payload =>
|
|
178
|
+
e._tag === tag
|
|
179
|
+
|
|
180
|
+
export interface MessagePredicate<Payload extends TaggedObject> {
|
|
181
|
+
(m: ParsedMIDIMessage<TaggedObject>): m is ParsedMIDIMessage<Payload>
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const isSpecificMessage =
|
|
185
|
+
<Payload extends TaggedObject>(
|
|
186
|
+
isSpecificPayload: (e: TaggedObject) => e is Payload,
|
|
187
|
+
): MessagePredicate<Payload> =>
|
|
188
|
+
(m): m is ParsedMIDIMessage<Payload> =>
|
|
189
|
+
isSpecificPayload(m.midiMessage)
|
|
190
|
+
|
|
191
|
+
export type TaggedObject = { readonly _tag: string }
|
|
192
|
+
|
|
193
|
+
/////////////////////////////////////////////
|
|
194
|
+
|
|
195
|
+
export interface UnknownReplyPayload
|
|
196
|
+
extends Readonly<{
|
|
197
|
+
_tag: 'Unknown Reply'
|
|
198
|
+
unexpectedData: string
|
|
199
|
+
stack: string
|
|
200
|
+
}> {}
|
|
201
|
+
|
|
202
|
+
export const isUnknownReplyPayload =
|
|
203
|
+
isSpecificPayload<UnknownReplyPayload>('Unknown Reply')
|
|
204
|
+
|
|
205
|
+
export const isUnknownReply = isSpecificMessage(isUnknownReplyPayload)
|
|
206
|
+
|
|
207
|
+
/////////////////////////////////////////////
|
|
208
|
+
|
|
209
|
+
export interface NotePressPayload
|
|
210
|
+
extends Readonly<{
|
|
211
|
+
_tag: 'Note Press'
|
|
212
|
+
channel: number
|
|
213
|
+
note: number
|
|
214
|
+
velocity: number
|
|
215
|
+
}> {}
|
|
216
|
+
|
|
217
|
+
export const isNotePressPayload =
|
|
218
|
+
isSpecificPayload<NotePressPayload>('Note Press')
|
|
219
|
+
|
|
220
|
+
export const isNotePress = isSpecificMessage(isNotePressPayload)
|
|
221
|
+
|
|
222
|
+
/////////////////////////////////////////////
|
|
223
|
+
|
|
224
|
+
export interface ChannelPressurePayload
|
|
225
|
+
extends Readonly<{
|
|
226
|
+
_tag: 'Channel Pressure'
|
|
227
|
+
channel: number
|
|
228
|
+
velocity: number
|
|
229
|
+
}> {}
|
|
230
|
+
|
|
231
|
+
export const isChannelPressurePayload =
|
|
232
|
+
isSpecificPayload<ChannelPressurePayload>('Channel Pressure')
|
|
233
|
+
|
|
234
|
+
export const isChannelPressure = isSpecificMessage(isChannelPressurePayload)
|
|
235
|
+
|
|
236
|
+
/////////////////////////////////////////////
|
|
237
|
+
|
|
238
|
+
export interface NoteReleasePayload
|
|
239
|
+
extends Readonly<{
|
|
240
|
+
_tag: 'Note Release'
|
|
241
|
+
channel: number
|
|
242
|
+
note: number
|
|
243
|
+
velocity: number
|
|
244
|
+
}> {}
|
|
245
|
+
|
|
246
|
+
export const isNoteReleasePayload =
|
|
247
|
+
isSpecificPayload<NoteReleasePayload>('Note Release')
|
|
248
|
+
|
|
249
|
+
export const isNoteRelease = isSpecificMessage(isNoteReleasePayload)
|
|
250
|
+
|
|
251
|
+
/////////////////////////////////////////////
|
|
252
|
+
|
|
253
|
+
export interface ControlChangePayload
|
|
254
|
+
extends Readonly<{
|
|
255
|
+
_tag: 'Control Change'
|
|
256
|
+
channel: number
|
|
257
|
+
control: number
|
|
258
|
+
value: number
|
|
259
|
+
}> {}
|
|
260
|
+
|
|
261
|
+
export const isControlChangePayload =
|
|
262
|
+
isSpecificPayload<ControlChangePayload>('Control Change')
|
|
263
|
+
|
|
264
|
+
export const isControlChange = isSpecificMessage(isControlChangePayload)
|
|
265
|
+
|
|
266
|
+
/////////////////////////////////////////////
|
|
267
|
+
|
|
268
|
+
export interface TouchpadReleasePayload
|
|
269
|
+
extends Readonly<{ _tag: 'Touchpad Release'; channel: number }> {}
|
|
270
|
+
|
|
271
|
+
export const isTouchpadReleasePayload =
|
|
272
|
+
isSpecificPayload<TouchpadReleasePayload>('Touchpad Release')
|
|
273
|
+
|
|
274
|
+
export const isTouchpadRelease = isSpecificMessage(isTouchpadReleasePayload)
|
|
275
|
+
|
|
276
|
+
/////////////////////////////////////////////
|
|
277
|
+
|
|
278
|
+
export interface PitchBendChangePayload
|
|
279
|
+
extends Readonly<{
|
|
280
|
+
_tag: 'Pitch Bend Change'
|
|
281
|
+
channel: number
|
|
282
|
+
value: number
|
|
283
|
+
}> {}
|
|
284
|
+
|
|
285
|
+
export const isPitchBendChangePayload =
|
|
286
|
+
isSpecificPayload<PitchBendChangePayload>('Pitch Bend Change')
|
|
287
|
+
|
|
288
|
+
export const isPitchBendChange = isSpecificMessage(isPitchBendChangePayload)
|
|
289
|
+
|
|
290
|
+
/////////////////////////////////////////////
|
|
291
|
+
|
|
292
|
+
export interface TouchpadPositionUpdatePayload
|
|
293
|
+
extends Readonly<{
|
|
294
|
+
_tag: 'Touchpad Position Update'
|
|
295
|
+
x: number
|
|
296
|
+
y: number
|
|
297
|
+
}> {}
|
|
298
|
+
|
|
299
|
+
export const isTouchpadPositionUpdatePayload =
|
|
300
|
+
isSpecificPayload<TouchpadPositionUpdatePayload>('Touchpad Position Update')
|
|
301
|
+
|
|
302
|
+
export const isTouchpadPositionUpdate = isSpecificMessage(
|
|
303
|
+
isTouchpadPositionUpdatePayload,
|
|
304
|
+
)
|