@solidrt/flux-types 0.0.73 → 0.0.74
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/gui/microphone.d.ts +27 -7
- package/package.json +1 -1
package/gui/microphone.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Microphone capture (gui-enabled runtime only). The imperative primitive;
|
|
2
2
|
// @solidrt/core's createMicrophone wraps it with SolidJS reactivity. `open`
|
|
3
|
-
//
|
|
3
|
+
// resolves to a bound session object: its methods are bound, and its `id` is
|
|
4
|
+
// what a runtime module takes a reader of its own by.
|
|
4
5
|
|
|
5
6
|
declare module "flux:microphone" {
|
|
6
7
|
/** A microphone device from {@link listMicrophones}. */
|
|
@@ -21,19 +22,38 @@ declare module "flux:microphone" {
|
|
|
21
22
|
|
|
22
23
|
/** An opened microphone session with controls bound to it. */
|
|
23
24
|
type MicrophoneSession = {
|
|
25
|
+
/**
|
|
26
|
+
* The session's id: what the app hands a runtime module that reads this
|
|
27
|
+
* microphone on a thread of its own (`microphone_tap` in the runtime).
|
|
28
|
+
*/
|
|
29
|
+
id: number
|
|
24
30
|
/** The actual capture sample rate in Hz. */
|
|
25
31
|
sampleRate: number
|
|
26
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Drain the mono float samples captured since the last read. The session
|
|
34
|
+
* keeps a 10 s window of audio, so there is no obligation to poll: a read
|
|
35
|
+
* later than that gets the last 10 s and the older samples are lost (the
|
|
36
|
+
* runtime logs it). A runtime module reading the session hears every
|
|
37
|
+
* sample too; reads do not take from each other.
|
|
38
|
+
*/
|
|
27
39
|
read(): Float32Array
|
|
28
|
-
/** Release the device. */
|
|
40
|
+
/** Release the device. Every reader of the session, a module's included, ends. */
|
|
29
41
|
close(): void
|
|
30
42
|
}
|
|
31
43
|
|
|
32
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* List the available microphone devices. Under a test that installed a
|
|
46
|
+
* clip as the microphone (`app.microphone` of `@solidrt/test`) the list is
|
|
47
|
+
* that one microphone, id 0.
|
|
48
|
+
*/
|
|
33
49
|
export function listMicrophones(): MicrophoneDevice[]
|
|
34
50
|
/**
|
|
35
|
-
* Open a microphone.
|
|
36
|
-
* prompt
|
|
51
|
+
* Open a microphone. Opening is the permission request: on Android the
|
|
52
|
+
* RECORD_AUDIO prompt comes up and the app keeps running behind it; the
|
|
53
|
+
* other platforms show none. Resolves once capture runs. Rejects when the
|
|
54
|
+
* user denies the permission ("microphone permission denied"), when the
|
|
55
|
+
* device cannot be opened, and under a test when the sample rate differs
|
|
56
|
+
* from the installed clip's.
|
|
37
57
|
*/
|
|
38
|
-
export function open(options?: MicrophoneOpenOptions): MicrophoneSession
|
|
58
|
+
export function open(options?: MicrophoneOpenOptions): Promise<MicrophoneSession>
|
|
39
59
|
}
|