~holger-seelig/cobweb.js/trunk

« back to all changes in this revision

Viewing changes to tests/Components/Sound/AudioClip.wrl

  • Committer: Holger Seelig
  • Date: 2017-08-22 04:53:24 UTC
  • Revision ID: holger.seelig@yahoo.de-20170822045324-4of4xxgt79669gbt
Switched to npm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#VRML V2.0 utf8
 
2
 
 
3
Sound {
 
4
  source DEF Song AudioClip {
 
5
    url "04. Like A Virgin.mp3"
 
6
  }
 
7
}
 
8
 
 
9
DEF Max Transform {
 
10
  scale 10 10 10
 
11
  children [
 
12
    Shape {
 
13
      appearance Appearance {
 
14
        material Material {
 
15
          transparency 0.3
 
16
        }
 
17
      }
 
18
      geometry Sphere { }
 
19
    }
 
20
  ]
 
21
}
 
22
 
 
23
DEF Min Transform {
 
24
  children [
 
25
    Shape {
 
26
      appearance Appearance {
 
27
        material Material {
 
28
          transparency 0.3
 
29
        }
 
30
      }
 
31
      geometry Sphere { }
 
32
    }
 
33
  ]
 
34
}
 
35
 
 
36
Transform {
 
37
  translation 0 2 0
 
38
  children [
 
39
    Shape {
 
40
      appearance Appearance {
 
41
        material Material { }
 
42
      }
 
43
      geometry DEF ElapsedTime Text { string "0" }
 
44
    }
 
45
  ]
 
46
}
 
47
 
 
48
Transform {
 
49
  translation -2 0 0
 
50
  children [
 
51
    DEF Play TouchSensor { }
 
52
    Shape {
 
53
      appearance Appearance {
 
54
        material Material {
 
55
          diffuseColor 0 1 0
 
56
        }
 
57
      }
 
58
      geometry Box { }
 
59
    }
 
60
  ]
 
61
}
 
62
 
 
63
Transform {
 
64
  translation 2 0 0
 
65
  children [
 
66
    DEF Stop TouchSensor { }
 
67
    Shape {
 
68
      appearance Appearance {
 
69
        material Material {
 
70
          diffuseColor 1 0 0
 
71
        }
 
72
      }
 
73
      geometry Box { }
 
74
    }
 
75
  ]
 
76
}
 
77
 
 
78
DEF Debug Script {
 
79
  eventIn  SFTime set_startTime
 
80
  eventIn  SFTime set_stopTime
 
81
  eventIn  SFBool set_active
 
82
  eventIn  SFTime set_elapsedTime
 
83
  eventIn  SFTime set_duration
 
84
  eventOut MFString string_changed
 
85
 
 
86
  url "vrmlscript:
 
87
 
 
88
function set_startTime (value, time)
 
89
{
 
90
        print ('Play: ', time)
 
91
}
 
92
 
 
93
function set_stopTime (value, time)
 
94
{
 
95
        print ('Stop: ', time)
 
96
}
 
97
 
 
98
function set_active (value, time)
 
99
{
 
100
        print ('isActive: ', value)
 
101
}
 
102
 
 
103
function set_elapsedTime (value, time)
 
104
{
 
105
        string_changed = new MFString (Math .round (value * 10) / 10);
 
106
}
 
107
 
 
108
function set_duration (value, time)
 
109
{
 
110
        print ('Duration: ', value)
 
111
}
 
112
  "
 
113
}
 
114
 
 
115
ROUTE Play.touchTime TO Song.set_startTime
 
116
ROUTE Stop.touchTime TO Song.set_stopTime
 
117
ROUTE Play.touchTime TO Debug.set_startTime
 
118
ROUTE Stop.touchTime TO Debug.set_stopTime
 
119
ROUTE Song.isActive TO Debug.set_active
 
120
ROUTE Song.elapsedTime TO Debug.set_elapsedTime
 
121
ROUTE Song.duration_changed TO Debug.set_duration
 
122
ROUTE Debug.string_changed TO ElapsedTime.set_string
 
123