Skip to content

Commit

Permalink
Merge pull request #4 from aaronfranke/KHR_audio_emitter_shape_type
Browse files Browse the repository at this point in the history
Update KHR_audio_emitter with new shapeType property
  • Loading branch information
aaronfranke authored Nov 29, 2024
2 parents 53c75fa + c55849a commit b485301
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 96 deletions.
112 changes: 71 additions & 41 deletions extensions/2.0/Khronos/KHR_audio_emitter/README.md

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_audio_emitter.audio.schema.json",
"title": "KHR_audio_emitter Audio Data",
"type": "object",
"description": "Audio data objects define where audio data is located and what format the data is in. The data is either accessed via a bufferView or uri. `mimeType` is required when `bufferView` is used.",
"allOf": [{ "$ref": "glTFProperty.schema.json" }],
"allOf": [{ "$ref": "glTFChildOfRootProperty.schema.json" }],
"properties": {
"uri": {
"type": "string",
Expand All @@ -17,10 +18,10 @@
"description": "The audio's MIME type. Required if `bufferView` is defined. Unless specified by another extension, the only supported mimeTypes are `audio/mpeg` and `audio/wav`.",
"anyOf": [
{
"enum": ["audio/mpeg"]
"const": "audio/mpeg"
},
{
"enum": ["audio/wav"]
"const": "audio/wav"
},
{
"type": "string"
Expand All @@ -35,7 +36,7 @@
"extensions": {},
"extras": {}
},
"dependencies": {
"dependentRequired": {
"bufferView": ["mimeType"]
},
"oneOf": [{ "required": ["uri"] }, { "required": ["bufferView"] }]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,46 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_audio_emitter.emitter.positional.schema.json",
"title": "KHR_audio_emitter Positional Audio Emitter",
"type": "object",
"description": "Positional audio emitter properties.",
"allOf": [{ "$ref": "glTFProperty.schema.json" }],
"properties": {
"shapeType": {
"type": "string",
"description": "Shape in which emitter emits audio (omnidirectional, cone, custom).",
"anyOf": [
{
"const": "omnidirectional",
"description": "Emitter emits audio in all directions."
},
{
"const": "cone",
"description": "Emitter emits audio in a cone defined by coneInnerAngle, coneOuterAngle, and coneOuterGain."
},
{
"type": "string"
}
],
"default": "omnidirectional"
},
"coneInnerAngle": {
"description": "The angle, in radians, of a cone inside of which there will be no volume reduction. This angle represents the angular diameter of the cone, from side to side. If not specified, the angle of Tau radians (360 degrees) is used, which means the audio emits in all directions (not in a cone).",
"type": "number",
"description": "The angle, in radians, of a cone inside of which there will be no volume reduction. This angle represents the angular diameter of the cone, from side to side. If not specified, the angle of Tau radians (360 degrees) is used, which means the audio emits in all directions (not in a cone).",
"minimum": 0.0,
"maximum": 6.2831853071795864,
"default": 6.2831853071795864
},
"coneOuterAngle": {
"description": "The angle, in radians, of a cone outside of which the volume will be reduced to a constant value of `coneOuterGain`. This angle represents the angular diameter of the cone, from side to side. If not specified, the angle of Tau radians (360 degrees) is used, which means some audio will emit in all directions.",
"type": "number",
"description": "The angle, in radians, of a cone outside of which the volume will be reduced to a constant value of `coneOuterGain`. This angle represents the angular diameter of the cone, from side to side. If not specified, the angle of Tau radians (360 degrees) is used, which means some audio will emit in all directions.",
"minimum": 0.0,
"maximum": 6.2831853071795864,
"default": 6.2831853071795864
},
"coneOuterGain": {
"description": "The linear volume gain of the audio emitter set when outside the cone defined by the `coneOuterAngle` property. It is a linear value (not dB). If not specified, the cone outer gain is `0.0`, meaning the audio will be silent outside of the cone.",
"type": "number",
"description": "The linear volume gain of the audio emitter set when outside the cone defined by the `coneOuterAngle` property. It is a linear value (not dB). If not specified, the cone outer gain is `0.0`, meaning the audio will be silent outside of the cone.",
"minimum": 0.0,
"default": 0.0
},
Expand All @@ -30,31 +49,30 @@
"description": "Specifies the distance model for the audio emitter.",
"anyOf": [
{
"enum": ["linear"],
"const": "linear",
"description": "A linear distance model calculating the gain induced by the distance according to: 1.0 - rolloffFactor * (distance - refDistance) / (maxDistance - refDistance)"
},
{
"enum": ["inverse"],
"const": "inverse",
"description": "An inverse distance model calculating the gain induced by the distance according to: refDistance / (refDistance + rolloffFactor * (Math.max(distance, refDistance) - refDistance))"
},
{
"enum": ["exponential"],
"const": "exponential",
"description": "An exponential distance model calculating the gain induced by the distance according to: pow((Math.max(distance, refDistance) / refDistance, -rolloffFactor))"
}
],
"default": "inverse"
},
"maxDistance": {
"description": "The maximum distance between the emitter and listener, after which the volume will not be reduced any further. If zero or not specified, the audio emitter does not have a maximum distance, and it can be heard from any distance.",
"type": "number",
"description": "The maximum distance between the emitter and listener, after which the volume will not be reduced any further. If zero or not specified, the audio emitter does not have a maximum distance, and it can be heard from any distance.",
"minimum": 0.0,
"default": 0.0
},
"refDistance": {
"description": "A reference distance for reducing volume as the emitter moves further from the listener. For distances less than this, the volume is not reduced. This value cannot be zero or a negative number. If not specified, the default value is `1.0`.",
"type": "number",
"minimum": 0.0,
"exclusiveMinimum": true,
"description": "A reference distance for reducing volume as the emitter moves further from the listener. For distances less than this, the volume is not reduced. This value cannot be zero or a negative number. If not specified, the default value is `1.0`.",
"exclusiveMinimum": 0.0,
"default": 1.0
},
"rolloffFactor": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_audio_emitter.emitter.schema.json",
"title": "KHR_audio_emitter Audio Emitter",
"type": "object",
"description": "Audio emitters define how audio sources are played back. Emitter properties are defined at the document level and are references by nodes. Audio may be played globally or positionally. Positional audio has further properties that define how audio volume scales with distance and angle.",
"allOf": [{ "$ref": "glTFProperty.schema.json" }],
"allOf": [{ "$ref": "glTFChildOfRootProperty.schema.json" }],
"properties": {
"type": {
"type": "string",
"description": "Specifies the audio emitter type.",
"anyOf": [
{
"enum": ["global"],
"const": "global",
"description": "Global audio emitters are not affected by the position of audio listeners. All `positional` properties may not be defined on global audio emitters."
},
{
"enum": ["positional"],
"const": "positional",
"description": "Positional audio emitters play audio at a position in the scene. The properties are defined in the `positional` object."
},
{
Expand All @@ -23,23 +24,21 @@
]
},
"gain": {
"description": "Unitless linear multiplier against original source volume for determining emitter loudness.",
"type": "number",
"description": "Unitless linear multiplier against original source volume for determining emitter loudness.",
"minimum": 0.0,
"default": 1.0
},
"sources": {
"description": "An array of audio source indices used by the audio emitter. This array may be empty.",
"type": "array",
"allOf": [
{
"$ref": "glTFid.schema.json"
}
]
"description": "An array of audio source indices used by the audio emitter. This array may be empty.",
"items": {
"allOf": [ { "$ref": "glTFid.schema.json" } ]
}
},
"positional": {
"type": "object",
"$ref": "emitter.positional.schema.json"
"$ref": "glTF.KHR_audio_emitter.emitter.positional.schema.json"
},
"name": {},
"extensions": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_audio_emitter.schema.json",
"title": "KHR_audio_emitter glTF Document Extension",
"type": "object",
"description": "Top level audio properties and resources.",
"allOf": [{ "$ref": "glTFProperty.schema.json" }],
"properties": {
"sources": {
"description": "An array of audio sources to be used in audio emitters.",
"type": "array",
"description": "An array of audio sources to be used in audio emitters.",
"items": {
"type": "object",
"$ref": "source.schema.json"
"$ref": "glTF.KHR_audio_emitter.source.schema.json"
},
"minItems": 1
},
"emitters": {
"description": "An array of positional or global audio emitters that can be referenced by nodes or scenes.",
"type": "array",
"description": "An array of positional or global audio emitters that can be referenced by nodes or scenes.",
"items": {
"type": "object",
"$ref": "emitter.schema.json"
"$ref": "glTF.KHR_audio_emitter.emitter.schema.json"
},
"minItems": 1
},
"audio": {
"description": "An array of audio that can be referenced by nodes.",
"type": "array",
"description": "An array of audio that can be referenced by nodes.",
"items": {
"type": "object",
"$ref": "audio.schema.json"
"$ref": "glTF.KHR_audio_emitter.audio.schema.json"
},
"minItems": 1
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_audio_emitter.source.schema.json",
"title": "KHR_audio_emitter Audio Source",
"type": "object",
"description": "Audio sources reference audio data and define playback properties for it. Audio sources may be used by zero to many audio emitters.",
"allOf": [{ "$ref": "glTFProperty.schema.json" }],
"allOf": [{ "$ref": "glTFChildOfRootProperty.schema.json" }],
"properties": {
"autoPlay": {
"description": "Whether or not to play the specified audio when the glTF is loaded.",
"type": "boolean",
"description": "Whether or not to play the specified audio when the glTF is loaded.",
"default": false
},
"gain": {
"description": "Unitless multiplier against original audio file volume for determining audio source loudness.",
"type": "number",
"description": "Unitless multiplier against original audio file volume for determining audio source loudness.",
"minimum": 0.0,
"default": 1.0
},
"loop": {
"description": "Whether or not to loop the specified audio when finished.",
"type": "boolean",
"description": "Whether or not to loop the specified audio when finished.",
"default": false
},
"audio": {
"description": "The index of the audio data assigned to this clip.",
"allOf": [
{
"$ref": "glTFid.schema.json"
}
]
"allOf": [ { "$ref": "glTFid.schema.json" } ],
"description": "The index of the audio data assigned to this clip."
},
"name": {},
"extensions": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "node.KHR_audio_emitter.schema.json",
"title": "KHR_audio_emitter glTF Node Extension",
"type": "object",
"description": "Node extension that references an audio emitter.",
"allOf": [{ "$ref": "glTFProperty.schema.json" }],
"properties": {
"emitter": {
"description": "The id of the positional audio emitter referenced by this node.",
"allOf": [
{
"$ref": "glTFid.schema.json"
}
]
"allOf": [ { "$ref": "glTFid.schema.json" } ],
"description": "The id of the audio emitter referenced by this node."
},
"extensions": {},
"extras": {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "scene.KHR_audio_emitter.schema.json",
"title": "KHR_audio_emitter glTF Scene Extension",
"type": "object",
"description": "Scene extension that references global audio emitters.",
"allOf": [{ "$ref": "glTFProperty.schema.json" }],
"properties": {
"emitters": {
"type": "array",
"description": "The indices of each global audio emitter. Positional audio emitters may not be added to the scene node.",
"items": {
"$ref": "glTFid.schema.json"
"allOf": [ { "$ref": "glTFid.schema.json" } ]
},
"uniqueItems": true,
"minItems": 1
Expand Down

0 comments on commit b485301

Please sign in to comment.