{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.0",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-3.0.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"switchsounds.x3d"
          },
          {
            "@name":"MovingImage",
            "@content":"switch-movie.mpg"
          },
          {
            "@name":"reference",
            "@content":"http://www.nist.gov/vrml.html"
          },
          {
            "@name":"reference",
            "@content":"http://www.itl.nist.gov/div897/ctg/vrml/vrml.html"
          },
          {
            "@name":"creator",
            "@content":"http://www.itl.nist.gov/div897/ctg/vrml/members.html"
          },
          {
            "@name":"disclaimer",
            "@content":"This file was provided by the National Institute of Standards and Technology, and is part of the X3D Conformance Test Suite, available at http://www.nist.gov/vrml.html The information contained within this file is provided for use in establishing conformance to the ISO VRML97 Specification. Conformance to this test does not imply recommendation or endorsement by the National Institute of Standards and Technology (NIST). This software can be redistributed and/or modified freely provided that any derivative works bear some notice that they are derived from it, and any modified versions bear some notice that they have been modified."
          },
          {
            "@name":"reference",
            "@content":"Interactive Conformance Testing for VRML, Mary Brady and Lynn Rosenthal, NIST, created 8 September 2010 and updated 25 August 2016, https://www.nist.gov/itl/ssd/information-systems-group/interactive-conformance-testing-vrml"
          },
          {
            "@name":"info",
            "@content":"Correct definition and compliance of this conformance scene is maintained by the X3D Working Group, https://www.web3d.org/working-groups/x3d"
          },
          {
            "@name":"creator",
            "@content":"Michael Kass NIST"
          },
          {
            "@name":"translator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"translated",
            "@content":"21 January 2001"
          },
          {
            "@name":"modified",
            "@content":"2 September 2023"
          },
          {
            "@name":"description",
            "@content":"Test Switching of sounds. A \"chime\" sounding Sound node is initially a \"switched out\" child of a Switch node in this world. If the viewer clicks on the \"Switch in\" button in this world, the Sound child is switched in as a child of the Switch node, and should begin to play. If the viewer clicks on the \"Switch out\" button while the Sound is playing, the sound should cease. However, the Sound node should continue to send and receive events, and as a result, the \"phonograph\" geometry continue to remain a yellow color, indicating that the Sound node isActive field is still true, even though the Sound is no longer audible."
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/Sound/switchsounds.x3d"
          },
          {
            "@name":"generator",
            "@content":"Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../../license.html"
          },
          {
            "@name":"translated",
            "@content":"25 March 2026"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, https://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"reference",
            "@content":"X3D JSON encoding: https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "WorldInfo":
            {
              "@title":"switchsounds.x3d"
            }
          },
          { "Viewpoint":
            {
              "@description":"entry view",
              "@position":[0,0,5]
            }
          },
          { "ProximitySensor":
            {
              "@DEF":"PROX_SENSOR",
              "@size":[1000,1000,1000]
            }
          },
          { "Switch":
            {
              "@DEF":"MYSWITCH",
              "@whichChoice":-1,
              "-children":[
                { "Sound":
                  {
                    "-source":
                      { "AudioClip":
                        {
                          "@DEF":"MYSOUND",
                          "@description":"chimes",
                          "@loop":true,
                          "@url":["chimes.wav","https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav"]
                        }
                      }
                  }
                }
              ]
            }
          },
          { "Transform":
            {
              "@scale":[0.5,0.5,0.5],
              "-children":[
                { "Transform":
                  {
                    "@translation":[0,-2,0],
                    "-children":[
                      { "Shape":
                        {
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@DEF":"PHONOCOLOR"
                                    }
                                  }
                              }
                            },
                          "-geometry":
                            { "Box":
                              {
                                "@size":[3,1.5,3]
                              }
                            }
                        }
                      }
                    ]
                  }
                },
                { "Transform":
                  {
                    "@rotation":[1,0,0,-2.5],
                    "-children":[
                      { "Shape":
                        {
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@DEF":"HORNCOLOR"
                                    }
                                  }
                              }
                            },
                          "-geometry":
                            { "Extrusion":
                              {
                                "@beginCap":false,
                                "@creaseAngle":1.57,
                                "@crossSection":[1,0,0.92388,0.382683,0.707107,0.707106,0.382684,0.923879,1.26759e-006,1,-0.382682,0.92388,-0.707105,0.707108,-0.923879,0.382685,-1,2.53518e-006,-0.923881,-0.382681,-0.707109,-0.707105,-0.382687,-0.923878,-3.80277e-006,-1,0.38268,-0.923881,0.707104,-0.70711,0.923878,-0.382688,1,0],
                                "@endCap":false,
                                "@orientation":[0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0],
                                "@scale":[2.2,2.2,1.8,1.8,1.4,1.4,1.2,1.2,1,1,0.8,0.8,0.6,0.6,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.2,0.2,0.0001,0.0001],
                                "@solid":false,
                                "@spine":[0,-1.4,0,0,-1.22137,0,0,-1.01245,0,0,-0.819601,0,0,-0.626754,0,0,-0.401765,0,0,-0.204459,0,0,-0.0164327,0,0,0.176777,0,0,0.380511,0,0,0.578542,0,0,0.819601,0,0,0.996378,0,0,1.8,0,0,1.2,0]
                              }
                            }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          { "Transform":
            {
              "@DEF":"START_TRANS",
              "-children":[
                { "Transform":
                  {
                    "@translation":[-3,1.5,-5],
                    "-children":[
                      { "Shape":
                        {
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@DEF":"GOMATERIAL",
                                      "@ambientIntensity":1,
                                      "@diffuseColor":[0,1,0]
                                    }
                                  }
                              }
                            },
                          "-geometry":
                            { "Box":
                              {
                                "@DEF":"START",
                                "@size":[1.3,1,0.1]
                              }
                            }
                        }
                      },
                      { "Transform":
                        {
                          "@translation":[-0.45,0,0.2],
                          "-children":[
                            { "Shape":
                              {
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "-material":
                                        { "Material":
                                          {
                                            "@ambientIntensity":1,
                                            "@diffuseColor":[0,0,0]
                                          }
                                        }
                                    }
                                  },
                                "-geometry":
                                  { "Text":
                                    {
                                      "@string":["Switch","in"],
                                      "-fontStyle":
                                        { "FontStyle":
                                          {
                                            "@size":0.4
                                          }
                                        }
                                    }
                                  }
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                { "TouchSensor":
                  {
                    "@DEF":"TOUCHSTART",
                    "@description":"touch to start"
                  }
                },
                { "TimeSensor":
                  {
                    "@DEF":"GOTIMER"
                  }
                },
                { "ColorInterpolator":
                  {
                    "@DEF":"GOFLASH",
                    "@key":[0,0.5,1],
                    "@keyValue":[0,1,0,1,1,1,0,1,0]
                  }
                }
              ]
            }
          },
          { "Transform":
            {
              "@DEF":"STOP_TRANS",
              "-children":[
                { "Transform":
                  {
                    "@translation":[3,1.5,-5],
                    "-children":[
                      { "Shape":
                        {
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@DEF":"STOPMATERIAL",
                                      "@ambientIntensity":1,
                                      "@diffuseColor":[1,0,0]
                                    }
                                  }
                              }
                            },
                          "-geometry":
                            { "Box":
                              {
                                "@DEF":"STOP",
                                "@size":[1.3,1,0.1]
                              }
                            }
                        }
                      },
                      { "Transform":
                        {
                          "@translation":[-0.65,0,0.2],
                          "-children":[
                            { "Shape":
                              {
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "-material":
                                        { "Material":
                                          {
                                            "@ambientIntensity":1,
                                            "@diffuseColor":[0,0,0]
                                          }
                                        }
                                    }
                                  },
                                "-geometry":
                                  { "Text":
                                    {
                                      "@string":["Switch","out"],
                                      "-fontStyle":
                                        { "FontStyle":
                                          {
                                            "@size":0.4
                                          }
                                        }
                                    }
                                  }
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                { "TouchSensor":
                  {
                    "@DEF":"TOUCHSTOP",
                    "@description":"touch to stop"
                  }
                },
                { "TimeSensor":
                  {
                    "@DEF":"STOPTIMER"
                  }
                },
                { "ColorInterpolator":
                  {
                    "@DEF":"STOPFLASH",
                    "@key":[0,0.5,1],
                    "@keyValue":[1,0,0,1,1,1,1,0,0]
                  }
                }
              ]
            }
          },
          { "Script":
            {
              "@DEF":"SOUND_SCRIPT",
              "@directOutput":true,
              "@url":["switch.js","https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/Sound/switch.js"],
              "field": [
                {
                  "@name":"mySwitch",
                  "@accessType":"initializeOnly",
                  "@type":"SFNode",
                  "-children":[
                    { "Switch":
                      {
                        "@USE":"MYSWITCH"
                      }
                    }
                  ]
                },
                {
                  "@name":"phonoColor",
                  "@accessType":"initializeOnly",
                  "@type":"SFNode",
                  "-children":[
                    { "Material":
                      {
                        "@USE":"PHONOCOLOR"
                      }
                    }
                  ]
                },
                {
                  "@name":"hornColor",
                  "@accessType":"initializeOnly",
                  "@type":"SFNode",
                  "-children":[
                    { "Material":
                      {
                        "@USE":"HORNCOLOR"
                      }
                    }
                  ]
                },
                {
                  "@name":"yellow",
                  "@accessType":"initializeOnly",
                  "@type":"SFColor",
                  "@value":[0.75,0.75,0.00]
                },
                {
                  "@name":"white",
                  "@accessType":"initializeOnly",
                  "@type":"SFColor",
                  "@value":[0.80,0.80,0.80]
                },
                {
                  "@name":"colorPhonograph",
                  "@accessType":"inputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"switchIn",
                  "@accessType":"inputOnly",
                  "@type":"SFTime"
                },
                {
                  "@name":"switchOut",
                  "@accessType":"inputOnly",
                  "@type":"SFTime"
                }
              ]
            }
          },
          { "ROUTE":
            {
              "@fromField":"touchTime",
              "@fromNode":"TOUCHSTART",
              "@toField":"switchIn",
              "@toNode":"SOUND_SCRIPT"
            }
          },
          { "ROUTE":
            {
              "@fromField":"touchTime",
              "@fromNode":"TOUCHSTOP",
              "@toField":"switchOut",
              "@toNode":"SOUND_SCRIPT"
            }
          },
          { "ROUTE":
            {
              "@fromField":"position_changed",
              "@fromNode":"PROX_SENSOR",
              "@toField":"set_translation",
              "@toNode":"START_TRANS"
            }
          },
          { "ROUTE":
            {
              "@fromField":"orientation_changed",
              "@fromNode":"PROX_SENSOR",
              "@toField":"set_rotation",
              "@toNode":"START_TRANS"
            }
          },
          { "ROUTE":
            {
              "@fromField":"position_changed",
              "@fromNode":"PROX_SENSOR",
              "@toField":"set_translation",
              "@toNode":"STOP_TRANS"
            }
          },
          { "ROUTE":
            {
              "@fromField":"orientation_changed",
              "@fromNode":"PROX_SENSOR",
              "@toField":"set_rotation",
              "@toNode":"STOP_TRANS"
            }
          },
          { "ROUTE":
            {
              "@fromField":"isActive",
              "@fromNode":"MYSOUND",
              "@toField":"colorPhonograph",
              "@toNode":"SOUND_SCRIPT"
            }
          },
          { "ROUTE":
            {
              "@fromField":"touchTime",
              "@fromNode":"TOUCHSTART",
              "@toField":"set_startTime",
              "@toNode":"GOTIMER"
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"GOTIMER",
              "@toField":"set_fraction",
              "@toNode":"GOFLASH"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"GOFLASH",
              "@toField":"set_diffuseColor",
              "@toNode":"GOMATERIAL"
            }
          },
          { "ROUTE":
            {
              "@fromField":"touchTime",
              "@fromNode":"TOUCHSTOP",
              "@toField":"set_startTime",
              "@toNode":"STOPTIMER"
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"STOPTIMER",
              "@toField":"set_fraction",
              "@toNode":"STOPFLASH"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"STOPFLASH",
              "@toField":"set_diffuseColor",
              "@toNode":"STOPMATERIAL"
            }
          }
        ]
    }
  }
}