<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' https://www.web3d.org/specifications/x3d-3.3.xsd '>
<head>
<meta name='titlecontent='SoundLoadSensorTest.x3d'/>
<meta name='descriptioncontent='UsingLoadSensor to test when AudioClip loading is complete'/>
<meta name='createdcontent='19 July 2008'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='creatorcontent='Leonard Daly and Don Brutzman'/>
<meta name='referencecontent=' https://X3dGraphics.com '/>
<meta name='referencecontent=' https://www.web3d.org/x3d/content/examples/X3dResources.html '/>
<meta name='rightscontent='Copyright 2006, Daly Realism and Don Brutzman'/>
<meta name='subjectcontent=' X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com '/>
<meta name='identifiercontent=' https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter12EnvironmentSensorSound/SoundLoadSensorTest.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../license.html'/>
</head>
<!-- -->
<Scene>
<!-- Sound location y-value is 1.6 in order to match typical avatar height (in meters) -->
<WorldInfo title='SoundLoadSensorTest.x3d'/>
<Sound DEF='SomeSoundlocation='0 1.6 0maxBack='100maxFront='100minBack='10minFront='10'>
<!-- ROUTE information for WaterSounds node:  [from ReportWhenLoaded.loadTime to startTime ] -->
<AudioClip DEF='WaterSoundsdescription='Running Water'
  url=' "aqua.wav" "https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter12EnvironmentSensorSound/aqua.wav" '/>
</Sound>
<!-- ROUTE information for ReportWhenLoaded node:  [from loadTime to WaterSounds.startTime ] [from isLoaded to ConsoleReport.loadComplete ] [from loadTime to ConsoleReport.loadTime ] [from loadTime to SignRotationClock.startTime ] -->
<LoadSensor DEF='ReportWhenLoaded'>
<AudioClip USE='WaterSoundscontainerField='watchList'/>
</LoadSensor>
<ROUTE fromNode='ReportWhenLoadedfromField='loadTimetoNode='WaterSoundstoField='startTime'/>
<!-- send completion report to console -->
<!-- ROUTE information for ConsoleReport node:  [from ReportWhenLoaded.isLoaded to loadComplete ] [from ReportWhenLoaded.loadTime to loadTime ] -->
<Script DEF='ConsoleReport'>
<field name='loadCompletetype='SFBoolaccessType='inputOnly'/>
<field name='loadTimetype='SFTimeaccessType='inputOnly'/>
<![CDATA[
      
ecmascript:
function initialize ()
{
	Browser.println ('Script initialize() complete');
}
function loadComplete (value)
{
	Browser.println ('LoadSensor AudioClip isLoaded=' + value);
}
function loadTime (value)
{
	Browser.println ('LoadSensor AudioClip loadTime=' + value);
}

    
]]>
</Script>
<ROUTE fromNode='ReportWhenLoadedfromField='isLoadedtoNode='ConsoleReporttoField='loadComplete'/>
<ROUTE fromNode='ReportWhenLoadedfromField='loadTimetoNode='ConsoleReporttoField='loadTime'/>
<!-- show visible indication of load waiting, complete -->
<!-- ROUTE information for PivotTextSigns node:  [from SignRotationInterpolator.value_changed to rotation ] -->
<Transform DEF='PivotTextSigns'>
<!-- First sign indicates waiting... -->
<Shape>
<Text string='"LoadSensor waiting for AudioClip..."'>
<FontStyle justify='"MIDDLE" "MIDDLE"size='0.7style='ITALIC'/>
</Text>
<Appearance>
<Material emissiveColor='0.878431 0.262745 0'/>
</Appearance>
</Shape>
<!-- Second sign indicates completed, initially rotated 90 degrees out of view -->
<Transform rotation='0 1 0 1.57'>
<Shape>
<Text string='"LoadSensor reports AudioClip loading complete."'>
<FontStyle justify='"MIDDLE" "MIDDLE"size='0.7style='ITALIC'/>
</Text>
<Appearance>
<Material emissiveColor='0 0.278431 0.027451'/>
</Appearance>
</Shape>
</Transform>
</Transform>
<!-- ROUTE information for SignRotationInterpolator node:  [from SignRotationClock.fraction_changed to set_fraction ] [from value_changed to PivotTextSigns.rotation ] -->
<OrientationInterpolator DEF='SignRotationInterpolatorkey='0 1keyValue='0 1 0 0 0 1 0 -1.57'/>
<!-- ROUTE information for SignRotationClock node:  [from ReportWhenLoaded.loadTime to startTime ] [from fraction_changed to SignRotationInterpolator.set_fraction ] -->
<TimeSensor DEF='SignRotationClockcycleInterval='0.8'/>
<ROUTE fromNode='ReportWhenLoadedfromField='loadTimetoNode='SignRotationClocktoField='startTime'/>
<ROUTE fromNode='SignRotationClockfromField='fraction_changedtoNode='SignRotationInterpolatortoField='set_fraction'/>
<ROUTE fromNode='SignRotationInterpolatorfromField='value_changedtoNode='PivotTextSignstoField='rotation'/>
</Scene>
</X3D>
<!--

Index for DEF nodes : ConsoleReport, PivotTextSigns, ReportWhenLoaded, SignRotationClock, SignRotationInterpolator, SomeSound, WaterSounds
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D Extensibility)
-->

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