public static AvalonSoundChannel ToSound(this string asset)
        {
            var a = new IHTMLAudio { src = asset, autobuffer = true };


            a.AttachToDocument();
            //a.style.display = IStyle.DisplayEnum.none;

            // we can now use HTML5 audio element
            var x = new AvalonSoundChannel
            {

                Start =
                    delegate
                    {
                        a.play();
                    },

                Stop =
                    delegate
                    {
                        a.pause();

                    }
            };

            a.onended +=
                delegate
                {
                    x.RaisePlaybackComplete();
                };


            return x;
        }
		public static AvalonSoundChannel ToSound(this string asset)
		{
			var x = KnownEmbeddedResources.Default[asset].ToSoundAsset();
			double v = 1;
			var y = default(SoundChannel);
		
			var c = new AvalonSoundChannel();

			c.SetVolume =
				value =>
				{
					v = value;

					if (y != null)
					{
						var t = y.soundTransform;
						t.volume = v;
						y.soundTransform = t;
					}
				};

			c.Start =
				delegate
				{
					if (y != null)
					{
						y.stop();
					}

					y = x.play(0, 0, new SoundTransform(v));

					y.soundComplete +=
						delegate
						{
							c.RaisePlaybackComplete();
						};

					
				};

			c.Stop =
				delegate
				{
					if (y != null)
					{
						y.stop();
						y = null;
					}
				};


		

			return c;
		}
		public static AvalonSoundChannel PlaySound(this string asset)
		{
			var x = KnownEmbeddedResources.Default[asset].ToSoundAsset().play();

			var c = new AvalonSoundChannel
			{
				Stop = x.stop,
			};

			c.SetVolume = value => x.soundTransform = new SoundTransform(value);


			x.soundComplete +=
				delegate
				{
					c.RaisePlaybackComplete();
				};

			return c;
		}