home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2006 April / SGP.iso / dema / Keepsake-Demo-en-li-v1.0.exe / res / bin / prime / oz'sound.tcl < prev    next >
Text File  |  2006-01-12  |  3KB  |  123 lines

  1. proc oz'sound::property {this args} {
  2.     set optstring {
  3.         {volume "1"}
  4.         {repeat "0"}
  5.         {streaming "1"}
  6.         {pos "0 0 0"}
  7.     }
  8.  
  9.     array set v [cmdline::getopt $args $optstring]
  10.  
  11.     if $v(volume?)    {oz'sound::volume    $this $v(volume)}
  12.     if $v(repeat?)    {oz'sound::repeat    $this $v(repeat)}
  13.     if $v(streaming?) {oz'sound::streaming $this $v(streaming)}
  14.     if $v(pos?)       {oz'sound::position  $this $v(pos)}
  15. }
  16.  
  17. rename oz'sound::position oz'sound::_position
  18. proc oz'sound::position {this pos} {
  19.     _position $this [lindex $pos 0] [lindex $pos 1] [lindex $pos 2]
  20. }
  21.  
  22. namespace eval wq'sound {
  23.     proc new {name args} {
  24.         set optstring {{play} {wait}}
  25.         array set v [cmdline::getopt $args $optstring]
  26.  
  27.         set sound [::new oz'sound $name]
  28.         oz'sound::volume $sound $::config::soundfx::volume
  29.         oz'sound::position_follow $sound Lydia
  30.         eval "oz'sound::property $sound $args"
  31.  
  32.         if $v(play?) {
  33.             oz'event {
  34.                 oz'sound::play $sound
  35.                 if $v(wait?) {oz'delay [oz'sound::duration $sound]}
  36.             }
  37.         }
  38.         
  39.         return $sound
  40.     }
  41.     
  42.     proc stop {this} {
  43.         oz'event {oz'sound::stop $this}
  44.     }
  45. }
  46.  
  47. namespace eval ozqSound {
  48.     proc New {filename} {
  49.         set sound [::new oz'sound $name]
  50.         oz'sound::position_follow $sound Lydia
  51.         return $sound
  52.     }
  53.  
  54.     proc New3DFX {vname filename} {
  55.         upvar $vname v
  56.         if ![info exists v] {
  57.             set v [::new oz'sound $filename]
  58.             oz'sound::position_follow $v Lydia
  59.             oz'event {
  60.                 oz'sound::volume $v $::config::soundfx::volume
  61.                 oz'sound::streaming $v 0
  62.             }
  63.         }
  64.     }
  65.  
  66.     proc NewPosFX {filename} {
  67.         set v [::new oz'sound $filename]
  68.         oz'sound::position_follow $v Lydia
  69.         oz'event {
  70.             oz'sound::volume $v $::config::soundfx::volume
  71.             oz'sound::streaming $v 0
  72.             oz'sound::reference_distance $v 12
  73.             oz'sound::position $v "[wizEntityGetPosition Lydia]"
  74.             oz'sound::play $v
  75.         }
  76.     }
  77.  
  78.     proc NewFX {filename} {
  79.         set v [::new oz'sound $filename]
  80.         oz'sound::position_follow $v Lydia
  81.         oz'event {
  82.             oz'sound::volume $v $::config::soundfx::volume
  83.             oz'sound::play $v
  84.         }
  85.         return [oz'sound::duration $v]
  86.     }
  87.  
  88.     proc NewFX2 {filename} {
  89.         set v [::new oz'sound $filename]
  90.         oz'sound::position_follow $v Lydia
  91.         oz'event {
  92.             oz'sound::volume $v $::config::soundfx::volume
  93.             oz'sound::play $v
  94.         }
  95.         return $v
  96.     }
  97.  
  98.     proc Position {this p} {
  99.         oz'event {oz'sound::position $this "$p"}
  100.     }
  101.  
  102.     proc ReferenceDistance {this d} {
  103.         oz'event {oz'sound::reference_distance $this $d}
  104.     }
  105.  
  106.     proc Volume {this v} {
  107.         oz'event {oz'sound::volume $this $v}
  108.     }
  109.  
  110.     proc Rolloff {this d} {
  111.         oz'event {oz'sound::rolloff $this $d}
  112.     }
  113.  
  114.     proc Repeat {this value} {
  115.         oz'event {oz'sound::repeat $this $value}
  116.     }
  117.  
  118.     proc Play {this} {
  119.         oz'event {oz'sound::play $this}
  120.     }
  121. }
  122.  
  123.