@hytopia.com/server-protocol 1.2.5 → 1.2.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/schemas/Audio.ts +16 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hytopia.com/server-protocol",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/schemas/Audio.ts CHANGED
@@ -3,24 +3,35 @@ import type { JSONSchemaType } from 'ajv';
3
3
  import type { VectorSchema } from './Vector';
4
4
 
5
5
  export type AudioSchema = {
6
- a: string; // audio uri
6
+ a?: string; // audio uri
7
7
  c?: VectorSchema; // coordinate of spatial audio origin
8
+ d?: number; // duration
9
+ de?: number; // detune
10
+ g?: number; // gain (0 to 1, or 1+ for distortion)
8
11
  l?: boolean; // loop
9
12
  o?: boolean; // one shot
13
+ of?: number; // offset
14
+ p?: number; // playback rate (0+)
15
+ r?: boolean; // restart
10
16
  s?: boolean; // stop
11
- v?: number; // volume
17
+ v?: number; // volume (0 to 1)
12
18
  }
13
19
 
14
20
  export const audioSchema: JSONSchemaType<AudioSchema> = {
15
21
  type: 'object',
16
22
  properties: {
17
- a: { type: 'string' },
23
+ a: { type: 'string', nullable: true },
18
24
  c: { ...vectorSchema, nullable: true },
25
+ d: { type: 'number', nullable: true },
26
+ de: { type: 'number', nullable: true },
27
+ g: { type: 'number', minimum: 0, nullable: true },
19
28
  l: { type: 'boolean', nullable: true },
20
29
  o: { type: 'boolean', nullable: true },
30
+ of: { type: 'number', nullable: true },
31
+ p: { type: 'number', minimum: 0, nullable: true },
32
+ r: { type: 'boolean', nullable: true },
21
33
  s: { type: 'boolean', nullable: true },
22
- v: { type: 'number', nullable: true },
34
+ v: { type: 'number', minimum: 0, maximum: 1, nullable: true },
23
35
  },
24
- required: [ 'a' ],
25
36
  additionalProperties: false,
26
37
  }