* moved "binPlayers" into libEmbedVideo (more modular folder layout)
[lhc/web/wiklou.git] / js2 / mwEmbed / libEmbedVideo / binPlayers / omtk-fx / src / as / org / omtk / vorbis / Mdct.as
1 /*
2
3 Copyright 2008 Tor-Einar Jarnbjo
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16
17 */
18
19 package org.omtk.vorbis {
20
21 import flash.events.*;
22 import flash.system.*;
23 import flash.display.*;
24 import flash.net.*;
25 import flash.utils.getTimer;
26
27 /*
28 * Wrapper for the haXe compiled class org.omtk.vorbis.MdctHX
29 */
30 public class Mdct {
31
32 public static var initialized : Boolean = false;
33 private static var hxClass : Class;
34
35 public static function initialize() : void {
36 var ldr:Loader = new Loader();
37 var swfUrl:String = "hxmdct.swf";
38 var req:URLRequest = new URLRequest(swfUrl);
39 var ldrContext:LoaderContext =
40 new LoaderContext(false, ApplicationDomain.currentDomain);
41 ldr.load(req, ldrContext);
42 ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
43
44 function swfLoaded(e:Event):void {
45 hxClass = ApplicationDomain.currentDomain.getDefinition("org.omtk.vorbis.MdctHX") as Class;
46 initialized = true;
47 }
48 }
49
50 private var delegate : Object;
51
52 public function Mdct(n:int) {
53 delegate = new hxClass(n);
54 }
55
56 public function imdct(frq:Vector.<Number>, window:Vector.<Number>, pcm:Vector.<Number>):void {
57 delegate.imdct(frq, window, pcm);
58 }
59
60 }
61
62 }