Debian Codegraph @

wasm/browser/src/constants.js

raw
1 export const DEFAULT_BUFFER_LEN = 128;
2 export const MAX_CHANNELS = 32;
3 export const RING_BUFFER_SIZE = 16384;
4 export const MIDI_BUFFER_SIZE = 1024;
5 export const MIDI_BUFFER_PAYLOAD_SIZE = 3;
6 export const CALLBACK_DATA_BUFFER_SIZE = 16384;
7
8 export const initialSharedState = [
9 0, // 1 = csound worker is locked
10 4096, // n = framesRequested (4096 is only initial and will thereafter be max'd to 2048)
11 0, // 1 = Csound is currently performing
12 0, // 1 = Csound is currently rendering
13 0, // 1 = Csound is currently paused
14 0, // 1 = STOP
15 -1, // n = sample rate
16 -1, // n = ksmps
17 -1, // n = nchnls
18 -1, // n = ncnls_i
19 0, // n = if 1 then it's requesting microphone
20 DEFAULT_BUFFER_LEN, // number of samples per process
21 0, // n = buffer read index of output buffer
22 0, // n = buffer write index of output buffer
23 0, // n = number of input buffers available
24 0, // n = number of output buffers available
25 0, // n = if 1 then is requesting rtmidi
26 0, // n = rtmidi buffer index
27 0, // n = available rtmidi events in buffer
28 0, // n = has pending callbacks
29 ];
30
31 // Enum helper for SAB
32 export const AUDIO_STATE = {
33 CSOUND_LOCK: 0,
34 FRAMES_REQUESTED: 1,
35 IS_PERFORMING: 2,
36 IS_RENDERING: 3,
37 IS_PAUSED: 4,
38 STOP: 5,
39 SAMPLE_RATE: 6,
40 KSMPS: 7,
41 NCHNLS: 8,
42 NCHNLS_I: 9,
43 IS_REQUESTING_MIC: 10,
44 BUFFER_LEN: 11,
45 OUTPUT_READ_INDEX: 12,
46 OUTPUT_WRITE_INDEX: 13,
47 AVAIL_IN_BUFS: 14,
48 AVAIL_OUT_BUFS: 15,
49 IS_REQUESTING_RTMIDI: 16,
50 RTMIDI_INDEX: 17,
51 AVAIL_RTMIDI_EVENTS: 18,
52 HAS_PENDING_CALLBACKS: 19,
53 };
54
55 export const DATA_TYPE = {
56 NUMBER: 0,
57 STRING: 1,
58 FLOAT_32: 2,
59 FLOAT_64: 3,
60 };