diff options
author | raylu <raylu@cmu.edu> | 2011-04-07 00:27:27 -0400 |
---|---|---|
committer | raylu <raylu@cmu.edu> | 2011-04-07 00:27:27 -0400 |
commit | f8c9eb5220afaf2f9a62f9a176a45913240f4081 (patch) | |
tree | 99775178acfcef6e86e39184be0ac96083042f1b /sounds | |
download | pathery-f8c9eb5220afaf2f9a62f9a176a45913240f4081.tar.xz |
Initial import from Dropbox
Diffstat (limited to 'sounds')
-rw-r--r-- | sounds/beep.mp3 | bin | 0 -> 6312 bytes | |||
-rw-r--r-- | sounds/bling.mp3 | bin | 0 -> 38528 bytes | |||
-rw-r--r-- | sounds/blip.mp3 | bin | 0 -> 5686 bytes | |||
-rw-r--r-- | sounds/cap.mp3 | bin | 0 -> 3200 bytes | |||
-rw-r--r-- | sounds/charm.mp3 | bin | 0 -> 10368 bytes | |||
-rw-r--r-- | sounds/click.mp3 | bin | 0 -> 4736 bytes | |||
-rw-r--r-- | sounds/cosmic002.mp3 | bin | 0 -> 26752 bytes | |||
-rw-r--r-- | sounds/cosmic003.mp3 | bin | 0 -> 193664 bytes | |||
-rw-r--r-- | sounds/hologram.mp3 | bin | 0 -> 42112 bytes | |||
-rw-r--r-- | sounds/page.mp3 | bin | 0 -> 11119 bytes | |||
-rw-r--r-- | sounds/script/demo.js | 11 | ||||
-rw-r--r-- | sounds/script/soundmanager.js | 182 | ||||
-rw-r--r-- | sounds/select.mp3 | bin | 0 -> 7248 bytes | |||
-rw-r--r-- | sounds/transmission.mp3 | bin | 0 -> 4224 bytes | |||
-rw-r--r-- | sounds/ufoblip.mp3 | bin | 0 -> 11904 bytes |
15 files changed, 193 insertions, 0 deletions
diff --git a/sounds/beep.mp3 b/sounds/beep.mp3 Binary files differnew file mode 100644 index 0000000..54b8fba --- /dev/null +++ b/sounds/beep.mp3 diff --git a/sounds/bling.mp3 b/sounds/bling.mp3 Binary files differnew file mode 100644 index 0000000..1aec9d2 --- /dev/null +++ b/sounds/bling.mp3 diff --git a/sounds/blip.mp3 b/sounds/blip.mp3 Binary files differnew file mode 100644 index 0000000..20355bc --- /dev/null +++ b/sounds/blip.mp3 diff --git a/sounds/cap.mp3 b/sounds/cap.mp3 Binary files differnew file mode 100644 index 0000000..10c6590 --- /dev/null +++ b/sounds/cap.mp3 diff --git a/sounds/charm.mp3 b/sounds/charm.mp3 Binary files differnew file mode 100644 index 0000000..951c8d1 --- /dev/null +++ b/sounds/charm.mp3 diff --git a/sounds/click.mp3 b/sounds/click.mp3 Binary files differnew file mode 100644 index 0000000..01f73b9 --- /dev/null +++ b/sounds/click.mp3 diff --git a/sounds/cosmic002.mp3 b/sounds/cosmic002.mp3 Binary files differnew file mode 100644 index 0000000..9233dae --- /dev/null +++ b/sounds/cosmic002.mp3 diff --git a/sounds/cosmic003.mp3 b/sounds/cosmic003.mp3 Binary files differnew file mode 100644 index 0000000..83d9774 --- /dev/null +++ b/sounds/cosmic003.mp3 diff --git a/sounds/hologram.mp3 b/sounds/hologram.mp3 Binary files differnew file mode 100644 index 0000000..0f265ee --- /dev/null +++ b/sounds/hologram.mp3 diff --git a/sounds/page.mp3 b/sounds/page.mp3 Binary files differnew file mode 100644 index 0000000..e25c51d --- /dev/null +++ b/sounds/page.mp3 diff --git a/sounds/script/demo.js b/sounds/script/demo.js new file mode 100644 index 0000000..40153e4 --- /dev/null +++ b/sounds/script/demo.js @@ -0,0 +1,11 @@ +// Page-specific demo stuff - not needed for library
+
+function stressTest(sound,count) {
+ for (var i=0; i<count; i++) {
+ setTimeout("soundManager.play('"+sound+"',1,true)",(i+1)*50);
+ }
+}
+
+function ihatespam(s) {
+ return s.replace('improbablyaspammer','scott');
+}
\ No newline at end of file diff --git a/sounds/script/soundmanager.js b/sounds/script/soundmanager.js new file mode 100644 index 0000000..f886c45 --- /dev/null +++ b/sounds/script/soundmanager.js @@ -0,0 +1,182 @@ +
+var isIE = navigator.appName.toLowerCase().indexOf('internet explorer')+1;
+var isMac = navigator.appVersion.toLowerCase().indexOf('mac')+1;
+
+function SoundManager(container) {
+ // DHTML-controlled sound via Flash
+ var self = this;
+ this.movies = []; // movie references
+ this.container = container;
+ this.unsupported = 0; // assumed to be supported
+ this.defaultName = 'default'; // default movie
+
+ this.FlashObject = function(url) {
+ var me = this;
+ this.o = null;
+ this.loaded = false;
+ this.isLoaded = function() {
+ if (me.loaded) return true;
+ if (!me.o) return false;
+ me.loaded = ((typeof(me.o.readyState)!='undefined' && me.o.readyState == 4) || (typeof(me.o.PercentLoaded)!='undefined' && me.o.PercentLoaded() == 100));
+ return me.loaded;
+ }
+ this.mC = document.createElement('div');
+ this.mC.className = 'movieContainer';
+ with (this.mC.style) {
+ // "hide" flash movie
+ position = 'absolute';
+ left = '-256px';
+ width = '64px';
+ height = '64px';
+ }
+ var html = ['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"><param name="movie" value="'+url+'"><param name="quality" value="high"></object>','<embed src="'+url+'" width="1" height="1" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>'];
+ if (navigator.appName.toLowerCase().indexOf('microsoft')+1) {
+ this.mC.innerHTML = html[0];
+ this.o = this.mC.getElementsByTagName('object')[0];
+ } else {
+ this.mC.innerHTML = html[1];
+ this.o = this.mC.getElementsByTagName('embed')[0];
+ }
+ document.getElementsByTagName('div')[0].appendChild(this.mC);
+ }
+
+ this.addMovie = function(movieName,url) {
+ self.movies[movieName] = new self.FlashObject(url);
+ }
+
+ this.checkMovie = function(movieName) {
+ movieName = movieName||self.defaultName;
+ if (!self.movies[movieName]) {
+ self.errorHandler('checkMovie','Exception: Could not find movie',arguments);
+ return false;
+ } else {
+ return (self.movies[movieName].isLoaded())?self.movies[movieName]:false;
+ }
+ }
+
+ this.errorHandler = function(methodName,message,oArguments,e) {
+ writeDebug('<div class="error">soundManager.'+methodName+'('+self.getArgs(oArguments)+'): '+message+(e?' ('+e.name+' - '+(e.message||e.description||'no description'):'')+'.'+(e?')':'')+'</div>');
+ }
+
+ this.play = function(soundID,loopCount,noDebug,movieName) {
+ if (self.unsupported) return false;
+ movie = self.checkMovie(movieName);
+ if (!movie) return false;
+ if (typeof(movie.o.TCallLabel)!='undefined') {
+ try {
+ self.setVariable(soundID,'loopCount',loopCount||1,movie);
+ movie.o.TCallLabel('/'+soundID,'start');
+ if (!noDebug) writeDebug('soundManager.play('+self.getArgs(arguments)+')');
+ } catch(e) {
+ self.errorHandler('play','Failed: Flash unsupported / undefined sound ID (check XML)',arguments,e);
+ }
+ }
+ }
+
+ this.stop = function(soundID,movieName) {
+ if (self.unsupported) return false;
+ movie = self.checkMovie(movieName);
+ if (!movie) return false;
+ try {
+ movie.o.TCallLabel('/'+soundID,'stop');
+ writeDebug('soundManager.stop('+self.getArgs(arguments)+')');
+ } catch(e) {
+ // Something blew up. Not supported?
+ self.errorHandler('stop','Failed: Flash unsupported / undefined sound ID (check XML)',arguments,e);
+ }
+ }
+
+ this.getArgs = function(params) {
+ var x = params?params.length:0;
+ if (!x) return '';
+ var result = '';
+ for (var i=0; i<x; i++) {
+ result += (i&&i<x?', ':'')+(params[i].toString().toLowerCase().indexOf('object')+1?typeof(params[i]):params[i]);
+ }
+ return result
+ }
+
+ this.setVariable = function(soundID,property,value,oMovie) {
+ // set Flash variables within a specific movie clip
+ if (!oMovie) return false;
+ try {
+ oMovie.o.SetVariable('/'+soundID+':'+property,value);
+ // writeDebug('soundManager.setVariable('+self.getArgs(arguments)+')');
+ } catch(e) {
+ // d'oh
+ self.errorHandler('setVariable','Failed',arguments,e);
+ }
+ }
+
+ this.setVariableExec = function(soundID,fromMethodName,oMovie) {
+ try {
+ oMovie.o.TCallLabel('/'+soundID,'setVariable');
+ } catch(e) {
+ self.errorHandler(fromMethodName||'undefined','Failed',arguments,e);
+ }
+ }
+
+ this.callMethodExec = function(soundID,fromMethodName,oMovie) {
+ try {
+ oMovie.o.TCallLabel('/'+soundID,'callMethod');
+ } catch(e) {
+ // Something blew up. Not supported?
+ self.errorHandler(fromMethodName||'undefined','Failed',arguments,e);
+ }
+ }
+
+ this.callMethod = function(soundID,methodName,methodParam,movieName) {
+ movie = self.checkMovie(movieName||self.defaultName);
+ if (!movie) return false;
+ self.setVariable(soundID,'jsProperty',methodName,movie);
+ self.setVariable(soundID,'jsPropertyValue',methodParam,movie);
+ self.callMethodExec(soundID,methodName,movie);
+ }
+
+ this.setPan = function(soundID,pan,movieName) {
+ self.callMethod(soundID,'setPan',pan,movieName);
+ }
+
+ this.setVolume = function(soundID,volume,movieName) {
+ self.callMethod(soundID,'setVolume',volume,movieName);
+ }
+
+ // constructor - create flash objects
+
+ if (isIE && isMac) {
+ this.unsupported = 1;
+ }
+
+ if (!this.unsupported) {
+ this.addMovie(this.defaultName,'soundcontroller.swf');
+ // this.addMovie('rc','rubber-chicken-audio.swf');
+ }
+
+}
+
+function SoundManagerNull() {
+ // Null object for unsupported case
+ this.movies = []; // movie references
+ this.container = null;
+ this.unsupported = 1;
+ this.FlashObject = function(url) {}
+ this.addMovie = function(name,url) {}
+ this.play = function(movieName,soundID) {
+ return false;
+ }
+ this.defaultName = 'default';
+}
+
+function writeDebug(msg) {
+ var o = document.getElementById('debugContainer');
+ if (!o) return false;
+ var d = document.createElement('div');
+ d.innerHTML = msg;
+ o.appendChild(d);
+}
+
+var soundManager = null;
+
+function soundManagerInit() {
+ soundManager = new SoundManager();
+}
\ No newline at end of file diff --git a/sounds/select.mp3 b/sounds/select.mp3 Binary files differnew file mode 100644 index 0000000..ed10543 --- /dev/null +++ b/sounds/select.mp3 diff --git a/sounds/transmission.mp3 b/sounds/transmission.mp3 Binary files differnew file mode 100644 index 0000000..56800a0 --- /dev/null +++ b/sounds/transmission.mp3 diff --git a/sounds/ufoblip.mp3 b/sounds/ufoblip.mp3 Binary files differnew file mode 100644 index 0000000..ef9b820 --- /dev/null +++ b/sounds/ufoblip.mp3 |