OK something very strange is going on. I tried the let block, and it was the same in my project.
So I created a new minimal project, lein new mies test-sound, and made a minimal test: https://github.com/retrogradeorbit/test-sound And here it works! Go back to my old project, and it doesn't. So now I have to go and gradually work through the project differences to see what's causing this. If I find anything, I'll post it. Thanks for your help Crispin On Wednesday, January 28, 2015 at 10:06:52 PM UTC+8, David Nolen wrote: > > I mentioned trying this in a `let` binding instead. What happens when you > try that? > > David > > On Wed, Jan 28, 2015 at 9:04 AM, Crispin Wellington <retrogr...@gmail.com > <javascript:>> wrote: > >> No, that's not it. So I tried: >> >> (def audio-context (js/AudioContext.)) >> (.decodeAudioData audio-context (js/ArrayBuffer. 256) #(println "ok" %) >> #(println "error" %)) >> >> and it compiled to: >> >> ;var zv = new AudioContext; >> zv.Rd(new ArrayBuffer(256), function(a) { >> return fo.c(mh(["ok", a], 0)); >> }, function(a) { >> return fo.c(mh(["error", a], 0)); >> }); >> >> This has really got me stumped. >> >> Crispin >> >> >> On Wednesday, January 28, 2015 at 6:23:29 PM UTC+8, Thomas Heller wrote: >>> >>> I just have a guess for you. >>> >>> AudioContext.decodeAudioData parameters are declared as ArrayBuffer, >>> Function, Function but you are passing "data" which is a String not an >>> ArrayBuffer. Maybe the type inference thinks you are calling a method that >>> is not defined in the externs? >>> >>> Maybe it will work if you pass an ArrayBuffer? Other than that I see no >>> reason why it would munge the name. >>> >>> /thomas >>> >>> On Wednesday, January 28, 2015 at 2:14:31 AM UTC+1, Crispin Wellington >>> wrote: >>>> >>>> Hi there, >>>> >>>> I have been trying to compile some audio code in clojurescript in >>>> advanced mode. I have setup the w3c_audio.js extern (from: >>>> http://closureplease.com/externs/) into my extern list. When I >>>> compile, it prevents the munging of "AudioContext" (without the extern, >>>> this is being munged, so the extern is 'working'). But it doesn't prevent >>>> the munging of methods on AudioContext object. >>>> >>>> A super minimal example (but not working code): >>>> >>>> (def audio-context (js/AudioContext.)) >>>> (.decodeAudioData audio-context "data" #(println "ok" %) #(println >>>> "error" %)) >>>> >>>> compiles with advanced to: >>>> >>>> ;var zv = new AudioContext; >>>> zv.Rd("data", function(a) { >>>> return fo.c(mh([a], 0)); >>>> }, function() { >>>> return(0).call(null); >>>> }); >>>> >>>> zv.Rd is wrong. It should be zv.decodeAudioData. >>>> >>>> The externs file does indeed have this function prototype. here are the >>>> excerpts: >>>> >>>> /** >>>> * @constructor >>>> */ >>>> var AudioContext = function() {}; >>>> >>>> .... >>>> >>>> /** >>>> * @param {ArrayBuffer} audioData >>>> * @param {Function} successCallback >>>> * @param {Function=} errorCallback >>>> */ >>>> AudioContext.prototype.decodeAudioData = function(audioData, >>>> successCallback, >>>> errorCallback) {}; >>>> >>>> Why would closure compiler protect the AudioContext name, but munge the >>>> decodeAudioData name? What am I doing wrong? >>>> >>>> Regards >>>> >>>> Crispin Wellington >>>> >>>> >>>> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> <javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.