X3D Model Documentation: switchsounds.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2 
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
  3  <X3D profile='Immersive' version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
  4       <head>
  5            <meta name='titlecontent='switchsounds.x3d'/>
  6            <meta name='MovingImagecontent='switch-movie.mpg'/>
  7            <meta name='referencecontent='http://www.nist.gov/vrml.html'/>
  8            <meta name='referencecontent='http://www.itl.nist.gov/div897/ctg/vrml/vrml.html'/>
  9            <meta name='creatorcontent='http://www.itl.nist.gov/div897/ctg/vrml/members.html'/>
 10            <meta name='disclaimercontent='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. '/>
 11            <meta name='referencecontent='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'/>
 12            <meta name='infocontent='Correct definition and compliance of this conformance scene is maintained by the X3D Working Group, https://www.web3d.org/working-groups/x3d'/>
 13            <meta name='translatorcontent='Michael Kass NIST, Don Brutzman NPS'/>
 14            <meta name='translatedcontent='21 January 2001'/>
 15            <meta name='modifiedcontent='2 September 2023'/>
 16            <meta name='descriptioncontent='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.'/>
 17            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/Sound/switchsounds.x3d'/>
 18            <meta name='generatorcontent='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html'/>
 19            <meta name='generatorcontent='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/>
 20            <meta name='licensecontent='../../license.html'/>
 21       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: GOFLASH, GOMATERIAL, GOTIMER, HORNCOLOR, MYSOUND, MYSWITCH, PHONOCOLOR, PROX_SENSOR, SOUND_SCRIPT, START, START_TRANS, STOP, STOP_TRANS, STOPFLASH, STOPMATERIAL, STOPTIMER, TOUCHSTART, TOUCHSTOP

Index for Viewpoint node: Viewpoint_1
-->
 22       <Scene>
 23            <WorldInfo title='switchsounds.x3d'/>
 24            <Viewpoint description='entry viewposition='0 0 5'/>
 25 
 26 
          <!-- Switch MYSWITCH is a DEF node that has 1 USE node: USE_1 -->
          <Switch DEF='MYSWITCHwhichChoice='-1'>
 27                 <Sound>
 28 
                    <!-- ROUTE information for MYSOUND node:  [from isActive to SOUND_SCRIPT.colorPhonograph ] -->
                    <AudioClip DEF='MYSOUNDdescription='chimesloop='true'   url=' "chimes.wav" "https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav" '/>
 29                 </Sound>
 30            </Switch>
 31            <Transform scale='0.5 0.5 0.5'>
 32                 <Transform translation='0 -2 0'>
 33                      <Shape>
 34                           <Appearance>
 35 
                              <!-- Material PHONOCOLOR is a DEF node that has 1 USE node: USE_1 -->
                              <Material DEF='PHONOCOLOR'/>
 36                           </Appearance>
 37                           <Box size='3 1.5 3'/>
 38                      </Shape>
 39                 </Transform>
 40                 <Transform rotation='1 0 0 -2.5'>
 41                      <Shape>
 42                           <Appearance>
 43 
                              <!-- Material HORNCOLOR is a DEF node that has 1 USE node: USE_1 -->
                              <Material DEF='HORNCOLOR'/>
 44                           </Appearance>
 45                           <Extrusion beginCap='falsecreaseAngle='1.57crossSection='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 0endCap='falseorientation='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 0scale='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.0001solid='falsespine='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'/>
 46                      </Shape>
 47                 </Transform>
 48            </Transform>
 49 
          <!-- ROUTE information for START_TRANS node:  [from PROX_SENSOR.position_changed to set_translation ] [from PROX_SENSOR.orientation_changed to set_rotation ] -->
          <Transform DEF='START_TRANS'>
 50                 <Transform translation='-3 1.5 -5'>
 51                      <Shape>
 52                           <Appearance>
 53 
                              <!-- ROUTE information for GOMATERIAL node:  [from GOFLASH.value_changed to set_diffuseColor ] -->
                              <Material DEF='GOMATERIALambientIntensity='1diffuseColor='0 1 0'/>
 54                           </Appearance>
 55                           <Box DEF='STARTsize='1.3 1 0.1'/>
 56                      </Shape>
 57                      <Transform translation='-0.45 0 0.2'>
 58                           <Shape>
 59                                <Appearance>
 60                                     <Material ambientIntensity='1diffuseColor='0 0 0'/>
 61                                </Appearance>
 62                                <Text string='"Switch" "in"'>
 63                                     <FontStyle size='0.4'/>
 64                                </Text>
 65                           </Shape>
 66                      </Transform>
 67                 </Transform>
 68 
               <!-- ROUTE information for TOUCHSTART node:  [from touchTime to SOUND_SCRIPT.switchIn ] [from touchTime to GOTIMER.set_startTime ] -->
               <TouchSensor DEF='TOUCHSTARTdescription='touch to start'/>
 69 
               <!-- ROUTE information for GOTIMER node:  [from TOUCHSTART.touchTime to set_startTime ] [from fraction_changed to GOFLASH.set_fraction ] -->
               <TimeSensor DEF='GOTIMER'/>
 70 
               <!-- ROUTE information for GOFLASH node:  [from GOTIMER.fraction_changed to set_fraction ] [from value_changed to GOMATERIAL.set_diffuseColor ] -->
               <ColorInterpolator DEF='GOFLASHkey='0 0.5 1keyValue='0 1 0 1 1 1 0 1 0'/>
 71            </Transform>
 72 
          <!-- ROUTE information for STOP_TRANS node:  [from PROX_SENSOR.position_changed to set_translation ] [from PROX_SENSOR.orientation_changed to set_rotation ] -->
          <Transform DEF='STOP_TRANS'>
 73                 <Transform translation='3 1.5 -5'>
 74                      <Shape>
 75                           <Appearance>
 76 
                              <!-- ROUTE information for STOPMATERIAL node:  [from STOPFLASH.value_changed to set_diffuseColor ] -->
                              <Material DEF='STOPMATERIALambientIntensity='1diffuseColor='1 0 0'/>
 77                           </Appearance>
 78                           <Box DEF='STOPsize='1.3 1 0.1'/>
 79                      </Shape>
 80                      <Transform translation='-0.65 0 0.2'>
 81                           <Shape>
 82                                <Appearance>
 83                                     <Material ambientIntensity='1diffuseColor='0 0 0'/>
 84                                </Appearance>
 85                                <Text string='"Switch" "out"'>
 86                                     <FontStyle size='0.4'/>
 87                                </Text>
 88                           </Shape>
 89                      </Transform>
 90                 </Transform>
 91 
               <!-- ROUTE information for TOUCHSTOP node:  [from touchTime to SOUND_SCRIPT.switchOut ] [from touchTime to STOPTIMER.set_startTime ] -->
               <TouchSensor DEF='TOUCHSTOPdescription='touch to stop'/>
 92 
               <!-- ROUTE information for STOPTIMER node:  [from TOUCHSTOP.touchTime to set_startTime ] [from fraction_changed to STOPFLASH.set_fraction ] -->
               <TimeSensor DEF='STOPTIMER'/>
 93 
               <!-- ROUTE information for STOPFLASH node:  [from STOPTIMER.fraction_changed to set_fraction ] [from value_changed to STOPMATERIAL.set_diffuseColor ] -->
               <ColorInterpolator DEF='STOPFLASHkey='0 0.5 1keyValue='1 0 0 1 1 1 1 0 0'/>
 94            </Transform>
 95 
 96                 <field name='mySwitchtype='SFNodeaccessType='initializeOnly'>
 97                      <Switch USE='MYSWITCH'/>
 98                 </field>
 99                 <field name='phonoColortype='SFNodeaccessType='initializeOnly'>
100                      <Material USE='PHONOCOLOR'/>
101                 </field>
102                 <field name='hornColortype='SFNodeaccessType='initializeOnly'>
103                      <Material USE='HORNCOLOR'/>
104                 </field>
105                 <field name='yellowtype='SFColorvalue='0.75 0.75 0.00accessType='initializeOnly'/>
106                 <field name='whitetype='SFColorvalue='0.80 0.80 0.80accessType='initializeOnly'/>
107                 <field name='colorPhonographtype='SFBoolaccessType='inputOnly'/>
108                 <field name='switchIntype='SFTimeaccessType='inputOnly'/>
109                 <field name='switchOuttype='SFTimeaccessType='inputOnly'/>
110            </Script>
111            < ROUTE  fromNode='TOUCHSTART' fromField='touchTime' toNode='SOUND_SCRIPT' toField='switchIn'/>
112            < ROUTE  fromNode='TOUCHSTOP' fromField='touchTime' toNode='SOUND_SCRIPT' toField='switchOut'/>
113            < ROUTE  fromNode='PROX_SENSOR' fromField='position_changed' toNode='START_TRANS' toField='set_translation'/>
114            < ROUTE  fromNode='PROX_SENSOR' fromField='orientation_changed' toNode='START_TRANS' toField='set_rotation'/>
115            < ROUTE  fromNode='PROX_SENSOR' fromField='position_changed' toNode='STOP_TRANS' toField='set_translation'/>
116            < ROUTE  fromNode='PROX_SENSOR' fromField='orientation_changed' toNode='STOP_TRANS' toField='set_rotation'/>
117            < ROUTE  fromNode='MYSOUND' fromField='isActive' toNode='SOUND_SCRIPT' toField='colorPhonograph'/>
118            < ROUTE  fromNode='TOUCHSTART' fromField='touchTime' toNode='GOTIMER' toField='set_startTime'/>
119            < ROUTE  fromNode='GOTIMER' fromField='fraction_changed' toNode='GOFLASH' toField='set_fraction'/>
120            < ROUTE  fromNode='GOFLASH' fromField='value_changed' toNode='GOMATERIAL' toField='set_diffuseColor'/>
121            < ROUTE  fromNode='TOUCHSTOP' fromField='touchTime' toNode='STOPTIMER' toField='set_startTime'/>
122            < ROUTE  fromNode='STOPTIMER' fromField='fraction_changed' toNode='STOPFLASH' toField='set_fraction'/>
123            < ROUTE  fromNode='STOPFLASH' fromField='value_changed' toNode='STOPMATERIAL' toField='set_diffuseColor'/>
124       </Scene>
125  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: GOFLASH, GOMATERIAL, GOTIMER, HORNCOLOR, MYSOUND, MYSWITCH, PHONOCOLOR, PROX_SENSOR, SOUND_SCRIPT, START, START_TRANS, STOP, STOP_TRANS, STOPFLASH, STOPMATERIAL, STOPTIMER, TOUCHSTART, TOUCHSTOP

Index for Viewpoint node: Viewpoint_1
-->
X3D Tooltips element index: Appearance, AudioClip, Box, ColorInterpolator, Extrusion, field, FontStyle, head, Material, meta, ProximitySensor, ROUTE, Scene, Script, Shape, Sound, Switch, Text, TimeSensor, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

Event Graph ROUTE Table entries with 13 ROUTE connections total, showing X3D event-model relationships for this scene.

Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.

TOUCHSTART
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
SOUND_SCRIPT
Script
switchIn
SFTime
TOUCHSTART
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
GOTIMER
TimeSensor
set_startTime
SFTime
then
 
 
 
GOTIMER
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
GOFLASH
ColorInterpolator
set_fraction
SFFloat
then
 
 
 
GOFLASH
ColorInterpolator
value_changed
SFColor

ROUTE
event to
(3)
GOMATERIAL
Material
set_diffuseColor
SFColor

TOUCHSTOP
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
SOUND_SCRIPT
Script
switchOut
SFTime
TOUCHSTOP
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
STOPTIMER
TimeSensor
set_startTime
SFTime
then
 
 
 
STOPTIMER
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(2)
STOPFLASH
ColorInterpolator
set_fraction
SFFloat
then
 
 
 
STOPFLASH
ColorInterpolator
value_changed
SFColor

ROUTE
event to
(3)
STOPMATERIAL
Material
set_diffuseColor
SFColor

PROX_SENSOR
ProximitySensor
position_changed
SFVec3f

ROUTE
event to
(1)
START_TRANS
Transform
set_translation
SFVec3f
PROX_SENSOR
ProximitySensor
orientation_changed
SFRotation

ROUTE
event to
(1)
START_TRANS
Transform
set_rotation
SFRotation
PROX_SENSOR
ProximitySensor
position_changed
SFVec3f

ROUTE
event to
(1)
STOP_TRANS
Transform
set_translation
SFVec3f
PROX_SENSOR
ProximitySensor
orientation_changed
SFRotation

ROUTE
event to
(1)
STOP_TRANS
Transform
set_rotation
SFRotation

MYSOUND
AudioClip
isActive
SFBool

ROUTE
event to
(1)
SOUND_SCRIPT
Script
colorPhonograph
SFBool
Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/Sound/switchsoundsIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/Sound/switchsounds.x3d -->

<!-- Color legend: X3D terminology <X3dNode DEF='idName' field='value'/> matches XML terminology <XmlElement DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
-->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->