topical media & game development

talk show tell print

mobile-query-three-tips-tquery-webaudio-01-adding-a-sound-track-index-dst.htm / htm



  <!doctype html><title>Minimal tQuery Page</title>
  <script src="../../../build/tquery-bundle-require.js"></script>
  <body><script>
  require(['tquery.webaudio'], function(){
          var world        = tQuery.createWorld().boilerplate().start();
          var object	= tQuery.createTorus().addTo(world);
  
          // test if web audio API is available in this browser
          if( WebAudio.isAvailable ){
                  // enable the web audio in our world
                  world.enableWebAudio();
                  // create a sound object, download it and start playing
                  var url        = '../assets/sound.mp3';
                  tQuery.createSound().load(url, function(sound){
                          sound.loop(true).play();
                  });
          }
  });
  </script></body>


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.