public static void ClipRaster(string inRaster, string inClipFeature, string outTempRaster)
        {
            Clip clipTool = new Clip();

            //set clip parameters
            clipTool.in_raster = inRaster;
            clipTool.out_raster = outTempRaster;

            //clip extent
            clipTool.in_template_dataset = inClipFeature;

            Geoprocessor gp = new Geoprocessor();
            gp.OverwriteOutput = true;
            gp.AddOutputsToMap = false;

            try
            {

               IGeoProcessorResult result = (IGeoProcessorResult)gp.ExecuteAsync(clipTool);

               while(result.Status != esriJobStatus.esriJobSucceeded)
               {
                   //Console.WriteLine(result.Status.ToString());
                   System.Threading.Thread.Sleep(100);
               }

            }
            catch (Exception ex)
            {
                object level = 0;
                Console.WriteLine(gp.GetMessages(ref level));
                Console.WriteLine(" Failed to clip raster using ESRI clip tool " + ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// 两图层进行裁剪运算
        /// </summary>
        /// <param name="inputLayer">被裁剪图层</param>
        /// <param name="clipLayer">裁剪图层</param>
        /// <param name="outputFullPath">输出图层完整路径</param>
        public void ClipByLayer(ILayer inputLayer, ILayer clipLayer, string outputFullPath)
        {
            string inputPath = GetLayerPath(inputLayer);
            string clipPath = GetLayerPath(clipLayer);

            Clip clipTool = new Clip();
            clipTool.in_features = inputPath;
            clipTool.clip_features = clipPath;
            clipTool.out_feature_class = outputFullPath;

            Geoprocessor processor = new Geoprocessor();
            IGPProcess process = null;
            processor.OverwriteOutput = true;
            process = clipTool;
            processor.Validate(process, true);
            processor.Execute(process, null);

            FileInfo fi = new FileInfo(outputFullPath);
            string pathDir = fi.Directory.FullName;
            string name = fi.Name;
            IWorkspaceFactory wsf = new ShapefileWorkspaceFactoryClass();
            IFeatureWorkspace fws = wsf.OpenFromFile(pathDir, 0) as IFeatureWorkspace;
            IFeatureClass featCls = fws.OpenFeatureClass(name);
            IFeatureLayer layer = new FeatureLayerClass();
            layer.FeatureClass = featCls;
            layer.Name = featCls.AliasName;
            m_mapControl.Map.AddLayer(layer as ILayer);
        }
Example #3
0
    public void Play(Clip clip)
    {
        if (!GameControl.control.SfxOn) return;

        switch (clip)
        {
            case Clip.JUMP:
                JumpAudio.PlayOneShot(JumpAudioClip);
                break;
            case Clip.SHOT:
                ShotAudio.PlayOneShot(ShotAudioClip);
                break;
            case Clip.WALK:
                WalkAudio.PlayOneShot(WalkAudioClip);
                break;
            case Clip.DASH:
                DashAudio.PlayOneShot(DashAudioClip);
                break;
            case Clip.LOCK:
                LockAudio.PlayOneShot(LockAudioClip);
                break;
            case Clip.DEATH:
                DeathAudio.PlayOneShot(DeathAudioClip);
                break;
        }
    }
Example #4
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="clip"></param>
    /// <param name="OverrideRepeatDelay"></param>
    public void PlayClip(Clip clip, bool OverrideRepeatDelay)
    {
        //Debug.Log("requested phrase " + phrase);

        if (clip == lastClip)
        {
            //we already said that!
        }
        else
        {
            PlayClip(clip);
            lastClip = clip;
        }
    }
Example #5
0
    public void play(string clipName, bool randomStartFrame = false)
    {
        if (this.currentClipName != clipName && this.clipDictionary.ContainsKey(clipName))
        {
            this.currentClipName = clipName;
            this.currentClip = this.clipDictionary[clipName];

            this.currentFrame = this.currentClip.startFrame;
            this.nextFrameTime = 0;

            if (randomStartFrame)
            {
                this.currentFrame += UnityEngine.Random.Range(0, this.currentClip.numFrames);
            }
        }
    }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Frame"/> class.
        /// </summary>
        /// <param name="clip"></param>
        internal Frame(Clip clip)
            : this()
        {
            Contract.Requires(clip != null);

            this.clip = clip;
            this.video = new FrameData<IBitmap>(clip.VideoTracks.Count);
            this.audio = new FrameData<ISegment>(clip.AudioTracks.Count);

            for (int i = 0; i < this.video.Count; ++i)
            {
                var track = clip.VideoTracks[i];
                this.video[i] = track.Format.CreateBitmap(track.Dimensions);
            }

            for (int i = 0; i < this.audio.Count; ++i)
            {
                var track = clip.AudioTracks[i];
                this.audio[i] = null;
            }
        }
Example #7
0
 public void Stop(Clip clip)
 {
     switch (clip)
     {
         case Clip.JUMP:
             JumpAudio.Stop();
             break;
         case Clip.SHOT:
             ShotAudio.Stop();
             break;
         case Clip.WALK:
             WalkAudio.Stop();
             break;
         case Clip.DASH:
             DashAudio.Stop();
             break;
         case Clip.LOCK:
             LockAudio.Stop();
             break;
         case Clip.DEATH:
             DeathAudio.Stop();
             break;
     }
 }
Example #8
0
 public void addClip(string name, Clip clip)
 {
     this.clipDictionary[name] = clip;
 }
Example #9
0
    /// <summary>
    /// Returns a list of 3 word addresses based on user input and other parameters.
    /// </summary>
    /// <param name="key">A valid API key</param>
    /// <param name="addr">The full or partial 3 word address to obtain suggestions for. At minimum this must be the first two complete words plus at least one character from the third word.</param>
    /// <param name="multilingual">AutoSuggest is provided via 2 variant resources; single language and multilingual.</param>
    /// <param name="lang">For single language the lang parameter is required; for multilingual, the lang parameter is optional. If specified, this parameter must be a supported 3 word address language as an ISO 639-1 2 letter code.</param>
    /// <param name="focus">A location, used to refine the results. If specified, the results will be weighted to give preference to those near the specified location in addition to considering similarity to the addr string. If omitted the default behaviour is to weight results for similarity to the addr string only.</param>
    /// <param name="clip">Restricts results to those within a geographical area.</param>
    /// <param name="count">The number of AutoSuggest results to return. A maximum of 100 results can be specified, if a number greater than this is requested, this will be truncated to the maximum. The default is 3.</param>
    /// <param name="display">Display type.</param>
    /// <returns>Query instance.</returns>
    public static OnlineMapsWhat3Words AutoSuggest(string key, string addr, bool multilingual = false, string lang = "en", OnlineMapsVector2d?focus = null, Clip clip = null, int?count = null, Display display = Display.full)
    {
        StringBuilder url = new StringBuilder(endpoint).Append("autosuggest");

        if (multilingual)
        {
            url.Append("-ml");
        }
        url.Append("?format=json&key=").Append(key);
        url.Append("&addr=").Append(addr);
        if (!string.IsNullOrEmpty(lang))
        {
            url.Append("&lang=").Append(lang);
        }
        if (focus.HasValue)
        {
            url.Append("&focus=").Append(focus.Value.y).Append(",").Append(focus.Value.x);
        }
        if (clip != null)
        {
            clip.AppendURL(url);
        }
        if (count.HasValue)
        {
            url.Append("&count=").Append(count.Value);
        }
        if (display != Display.full)
        {
            if (display == Display.minimal)
            {
                throw new Exception("AutoSuggest does not support Display.minimal.");
            }
            url.Append("&display=").Append(display);
        }
        return(new OnlineMapsWhat3Words(url));
    }
 public static string GetVideoPath(string outputFolder, string courseTitle, int moduleId, string moduleTitle, Clip clip) =>
 $@"{outputFolder}\{courseTitle.RemoveInvalidCharacter()}\{moduleId}. {moduleTitle.RemoveInvalidCharacter()}\{clip.Index}. {clip.Title.RemoveInvalidCharacter()}.mp4";
Example #11
0
        public static bool IsRealPlanar(this Clip clip)
        {
            var colorInfo = clip.GetVideoInfo().pixel_type;

            return(IsRealPlanar(colorInfo));
        }
 private MyAccountPurchaseViewModel GetLessonPurchaseView(Clip clip, IEnumerable<Purchase> purchases, string nisCurrencySymbol, IEnumerable<ClipStatus> clipStatuses, PurchaseStatusDto[] purchaseStatuses, string evetId)
 {
     if (purchases == null || clip == null)
     {
         return null;
     }
     var clipPurchase = purchases.FirstOrDefault(x => x.ClipKey != null && x.ClipKey.ObjectId == clip.ObjectId && x.Event.ObjectId == evetId);
     if (clipPurchase == null) return null;
     var clipStatus = clipStatuses.Single(x => x.ObjectId == clip.Status.ObjectId);
     var purchaseStatus = purchaseStatuses.Single(x => x.StatusCode.ToLower() == clipPurchase.PurchaseStatusCode.ToLower());
     
     return new MyAccountPurchaseViewModel
     {
         Title = Language.CurrentLanguageCode == Cultures.EN_US ? clip.Name_en_us:clip.Name_he_il,
         ContentId = clip.ObjectId,
         TeacherUserName = clipPurchase.ClipKey.Teacher.Username,
         TeacherName = clipPurchase.ClipKey.Teacher.GetFullName(Language.CurrentLanguageCode),
         LessonStatus = Language.CurrentLanguageCode ==Cultures.EN_US?  clipStatus.Status_en_us : clipStatus.Status_he_il,
         Price = string.Format("{0}{1} {2}{3}", clipPurchase.OriginalItemCurrency.CurrencySymbol, clipPurchase.OriginalItemPrice, nisCurrencySymbol, clipPurchase.PriceNIS),
         SupportPrice = string.Format("{0}{1} {2}{3}", clipPurchase.OriginalItemCurrency.CurrencySymbol, clipPurchase.OriginalSupportPrice, nisCurrencySymbol, clipPurchase.SupportPriceNIS),
         PurchaseStatus =Language.CurrentLanguageCode ==Cultures.EN_US?  purchaseStatus.PurchaseStatus_en_us:purchaseStatus.PurchaseStatus_he_il,
         PurchaseStatusDate = clipPurchase.PurchaseStatusDate.ToString("dd/MM/yyyy"),
         BuyerUserName = clipPurchase.PurchasedBy != null ?clipPurchase.PurchasedBy.Username:string.Empty,
         BuyerName = clipPurchase.PurchasedBy != null ? clipPurchase.PurchasedBy.GetFullName(Language.CurrentLanguageCode):string.Empty,
         RecieverUserName = clipPurchase.UserKey.Username,
         RecieverName = clipPurchase.UserKey.GetFullName(Language.CurrentLanguageCode),
         IncludingSupport = clipPurchase.IncludingSupport ? MyMentorResources.includingSupport:MyMentorResources.notIncludingSupport,
         Event = clipPurchase.Event != null ?clipPurchase.Event.ObjectId:string.Empty,
         BundleId = clipPurchase.InBundle != null ? clipPurchase.InBundle.ObjectId : string.Empty,
         CouponId = clipPurchase.CouponKey != null ? clipPurchase.CouponKey.ObjectId : string.Empty,
         FirstDownloadDate =clipPurchase.LessonFirstDownloadDate!=DateTime.MinValue? clipPurchase.LessonFirstDownloadDate.ToString("dd/MM/yyyy"):string.Empty,
         DownloadCounter = clipPurchase.LessonDownloadCounter.ToString()
     };
 }
        /*
         * 지정된 볼륨으로 AudioClip을 플레이한다.
         */
        public void PlayOneShot(Clip audioClip, float volumeScale)
        {
            AudioSource source = sfx[(int)audioClip];

            source.PlayOneShot(source.clip, volumeScale);
        }
Example #14
0
        void CLIP(int size)
        {
            int pos = (int)Stream.Position;

            int index = ReadInt32();

            string chunk;
            int csize;
            while (Stream.Position - pos < size)
            {
                chunk = ReadString(4);
                csize = ReadInt16();

                Console.WriteLine("lwo: CLIP: " + chunk + " " + csize + ".");
                long pos2 = Stream.Position;

                switch (chunk)
                {
                    case "STIL":
                        string filename = ReadStringZero();
                        Console.WriteLine("lwo: filename: " + filename + ".");
                        Clip c = new Clip();
                        Clips.Add(c);
                        c.Filename = filename;
                        break;
                    case "XREF":
                        break;
                    case "ISEQ":
                        break;
                    case "ANIM":
                        break;
                    case "STCC":
                        break;
                }

                Stream.Seek(pos2 + (long)csize + (long)(csize % 2), SeekOrigin.Begin);
            }
            //throw new Exception();
        }
Example #15
0
 private void OnClipSelected(Clip clip)
 {
     _clipboard.SetClipboard(clip);
 }
Example #16
0
        public Layer pushPhysicalShape(Path path, float elevation, Color color, Color shadowColor, Clip clipBehavior)
        {
            var layer = new PhysicalShapeLayer(clipBehavior);

            layer.path             = path;
            layer.elevation        = elevation;
            layer.color            = color;
            layer.shadowColor      = shadowColor;
            layer.devicePixelRatio = Window.instance.devicePixelRatio;

            this._pushLayer(layer);
            return(layer);
        }
Example #17
0
    public void Stop(string name)
    {
        Clip s = Array.Find(clips, sound => sound.name == name);

        s.source.Stop();
    }
Example #18
0
    // Update is called once per frame
    public void Play(string name)
    {
        Clip s = Array.Find(clips, sound => sound.name == name);

        s.source.Play();
    }
        private static UnityEngine.AnimationClip Convert(Clip animation, FrameContainer frames,
                                                         out UVector3 rootStart, out UVector3 rootEnd)
        {
            var clip = new UnityEngine.AnimationClip();

            clip.legacy = true;

            var rotateAxes = new[] {
                new { Name = "x", Mask = new UVector4(1f, 0f, 0f, 0f) },
                new { Name = "y", Mask = new UVector4(0f, 1f, 0f, 0f) },
                new { Name = "z", Mask = new UVector4(0f, 0f, 1f, 0f) },
                new { Name = "w", Mask = new UVector4(0f, 0f, 0f, 1f) }
            };

            var translateAxes = new[] {
                new { Name = "x", Mask = new UVector3(1f, 0f, 0f) },
                new { Name = "y", Mask = new UVector3(0f, 1f, 0f) },
                new { Name = "z", Mask = new UVector3(0f, 0f, 1f) },
            };

            var root = animation.Bones.FirstOrDefault(x => x.BoneId == 0);

            if (root != null && root.FrameCount > 0)
            {
                rootStart = Types.Convert(root.Frames.First().Translation);
                rootEnd   = Types.Convert(root.Frames.Last().Translation);
            }
            else
            {
                rootStart = rootEnd = UVector3.zero;
            }

            foreach (var bone in animation.Bones)
            {
                var bFrames = bone.Frames;
                var frame   = frames.GetByBoneId(bone.BoneId);

                string bonePath = frame.Path;

                var axisAngle = bFrames.ToDictionary(x => x, x =>
                {
                    var q = Types.Convert(x.Rotation);
                    float ang; UnityEngine.Vector3 axis;
                    q.ToAngleAxis(out ang, out axis);
                    return(new UVector4(q.x, q.y, q.z, q.w));
                });

                foreach (var axis in rotateAxes)
                {
                    var keys = bFrames
                               .Select(x => new Keyframe(x.Time * TimeScale,
                                                         UVector4.Dot(axisAngle[x], axis.Mask)))
                               .ToArray();

                    clip.SetCurve(bonePath, typeof(Transform), "localRotation." + axis.Name,
                                  new UnityEngine.AnimationCurve(keys));
                }

                var converted = bFrames.Select(x => Types.Convert(x.Translation)).ToArray();

                if (!converted.Any(x => !x.Equals(UVector3.zero)))
                {
                    continue;
                }

                var anyVelocities = false;
                var deltaVals     = converted.Select((x, i) =>
                {
                    var prev = Math.Max(0, i - 1);
                    var next = Math.Min(i + 1, converted.Length - 1);

                    var prevTime = bFrames[prev].Time * TimeScale;
                    var nextTime = bFrames[next].Time * TimeScale;

                    return(prevTime == nextTime || !(anyVelocities = true) ? UVector3.zero
                        : (converted[next] - converted[prev]) / (nextTime - prevTime));
                }).ToArray();

                foreach (var translateAxis in translateAxes)
                {
                    var positions = bFrames
                                    .Select((x, i) => new Keyframe(x.Time * TimeScale,
                                                                   UVector3.Dot(frame.transform.localPosition + converted[i], translateAxis.Mask)))
                                    .ToArray();

                    var deltas = bFrames.Select((x, i) => new Keyframe(x.Time * TimeScale,
                                                                       UVector3.Dot(deltaVals[i], translateAxis.Mask))).ToArray();

                    clip.SetCurve(bonePath, typeof(Transform), "localPosition." + translateAxis.Name,
                                  new UnityEngine.AnimationCurve(positions));

                    if (!anyVelocities)
                    {
                        continue;
                    }

                    clip.SetCurve(bonePath, typeof(BFrame), "LocalVelocity." + translateAxis.Name,
                                  new UnityEngine.AnimationCurve(deltas));
                }
            }

            clip.wrapMode = WrapMode.Loop;
            clip.EnsureQuaternionContinuity();

            return(clip);
        }
Example #20
0
        public bool Run(DrakeBot bot, OnChatCommandReceivedArgs e)
        {
            BroadcasterInfo broadcaster = bot.ChannelBroadcaster[e.Command.ChatMessage.Channel];

            if (!bot.HasPermission(e.Command.ChatMessage.UserId, e.Command.ChatMessage.Channel, perms[0]))
            {
                return(false);
            }
            Clip retrieved = null;

            if (e.Command.ArgumentsAsList.Count > 0)
            {
                string arg = e.Command.ArgumentsAsList[0];
                if (arg.StartsWith("https://clips.twitch.tv/"))
                {
                    arg = arg.Substring(24);
                }
                var split = arg.Split('/');

                for (int i = 0; i < split.Length; i++)
                {
                    if (split[i] != string.Empty)
                    {
                        arg = split[i];
                        break;
                    }
                }

                var getClip = bot.Service.Helix.Clips.GetClipAsync(arg);
                getClip.Wait();

                if (getClip.Result.Clips.Length == 0)
                {
                    bot.Client.SendMessage(e.Command.ChatMessage.Channel, "@" + e.Command.ChatMessage.Username + " your clip had an invalid id/url");
                    return(true);
                }

                retrieved = getClip.Result.Clips[0];
                bot.Client.SendMessage(e.Command.ChatMessage.Channel, "@" + e.Command.ChatMessage.Username + " your clip was retrieved ( " + "https://clips.twitch.tv/" + arg + " )");
            }
            else
            {
                var task = bot.Service.Helix.Clips.CreateClipAsync(broadcaster.ID, broadcaster.AccessToken);
                task.Wait();
                var result = task.Result;
                var clip   = result.CreatedClips[0];

                bot.Client.SendMessage(e.Command.ChatMessage.Channel, "@" + e.Command.ChatMessage.Username + " your clip was created and is available at https://clips.twitch.tv/" + result.CreatedClips[0].Id);

                var getClip = bot.Service.Helix.Clips.GetClipAsync(result.CreatedClips[0].Id);
                getClip.Wait();

                while (getClip.Result.Clips.Length == 0)
                {
                    Thread.Sleep(1000);
                    getClip = bot.Service.Helix.Clips.GetClipAsync(result.CreatedClips[0].Id);
                    getClip.Wait();
                }
                retrieved = getClip.Result.Clips[0];
            }

            var getGame = bot.Service.Helix.Games.GetGamesAsync(new List <string>(new[] { retrieved.GameId }));

            getGame.Wait();
            string game = getGame.Result.Games[0].Name;

            //TODO: SAVE to database

            return(true);
        }
Example #21
0
        protected Clip CreateClipFromChildNode(XmlNode childNode)
        {
            Clip loRssItem = new Clip("", "");

            for (int i = 0; i < childNode.ChildNodes.Count; i++)
            {
                XmlNode n = childNode.ChildNodes[i];

                switch (n.Name)
                {
                case "title":
                    loRssItem.Title = n.InnerText;
                    break;

                case "link":
                    PutLinkOnItem(loRssItem, n);
                    break;

                case "guid":
                    PutGuidOnItem(loRssItem, n);
                    break;

                case "pubDate":
                    PutPublicationDateOnItem(loRssItem, n);
                    break;

                case "description":
                    loRssItem.Description = n.InnerText;
                    break;

                case "summary":
                    PutSummaryOnItem(loRssItem, n);
                    break;

                case "author":

                    break;

                case "exInfo:image":

                    break;

                case "exInfo:gameID":

                    break;

                case "feedburner:origLink":

                    break;

                case "media:group":

                    for (int j = 0; j < n.ChildNodes.Count; j++)
                    {
                        XmlNode nin = n.ChildNodes[j];
                        switch (nin.Name)
                        {
                        case "media:content":
                            //                                        loMediaContent = new MediaContent();
                            try
                            {
                                //                                            loMediaContent.url = nin.Attributes["url"].Value;
                                //                                            loMediaContent.type = nin.Attributes["type"].Value;
                                //                                            loMediaContent.medium = nin.Attributes["medium"].Value;
                                //                                            loMediaContent.duration = nin.Attributes["duration"].Value;
                                //                                            loMediaContent.height = nin.Attributes["height"].Value;
                                //                                            loMediaContent.width = nin.Attributes["width"].Value;
                            }
                            catch (Exception e)
                            {
                                //Log.Error("catccccccccccched exception: " + e.Message);
                                Console.Error.WriteLine(e.StackTrace);
                            }
                            ;
                            break;

                        case "media:description":

                            break;

                        case "media:thumbnail":

                            break;

                        case "media:title":

                            break;
                        }
                    }
                    break;

                case "itunes:duration":
                    PutDurationOnItem(loRssItem, n);
                    break;

                case "media:description":
                    //                            loRssItem.mediaDescription = n.InnerText;
                    break;

                case "media:thumbnail":
                    //                            loRssItem.mediaThumbnail = n.Attributes["url"].Value;
                    break;

                case "media:title":
                    //                            loRssItem.mediaTitle = n.InnerText;
                    break;

                case "enclosure":
                    PutEnclosureOnItem(loRssItem, n);
                    break;

                case "media:category":
                    //  loRssItem.mediaCategory = n.InnerText;
                    break;

                default:
                    break;
                }
            }
            return(loRssItem);
        }
    public static void DownloadClip(WebClient client, Clip clip)
    {
        // Request Header
        // Content-Type: application/json;charset=utf-8
        // Cookie: PSM=ABCDE.....
        //
        // Request Body
        // {a:"scott-allen", m:"mvc-ajax", course:"aspdotnet-mvc-advanced-topics", cn:1, mt:"mp4", q:"1024x768", cap:false, lc:"en"}

        client.Headers.Add("Content-Type", "application/json");
        var request = String.Format(
            @"{{a:""{0}"", m:""{1}"", course:""{2}"", cn:{3}, mt:""mp4"", q:""1024x768"", cap:false, lc:""en""}}",
            clip.Author, clip.Name, clip.Course, clip.Num);

        Logger.LogToConsoleEnabled = false;
        Logger.Log("Request: " + request);
        var response = client.UploadString(ClipRequestUrl, request);
        Logger.Log("Response: " + response);
        Logger.LogToConsoleEnabled = true;

        client.DownloadFile(response, clip.Course + "/" + clip.FileName);
    }
Example #23
0
 private void OnClipReceived(Clip clip)
 {
     throw new NotImplementedException();
 }
Example #24
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="phrase"></param>
    private void PlayClip(Clip phrase)
    {
        switch (phrase)
        {
            case Clip.HeyTaxi:
                audHeyTaxi.Play();
                break;
            case Clip.Thanks:
                audThanks.Play();
                break;
            case Clip.Hey:
                audHey.Play();
                break;
            case Clip.Pad_1_Please:
                aud1.Play();
                break;
            case Clip.Pad_2_Please:
                aud2.Play();
                break;
            case Clip.Pad_3_Please:
                aud3.Play();
                break;
            case Clip.Pad_4_Please:
                aud4.Play();
                break;
            case Clip.Pad_5_Please:
                aud5.Play();
                break;
            case Clip.Pad_6_Please:
                aud6.Play();
                break;
            case Clip.Pad_7_Please:
                aud7.Play();
                break;
            case Clip.Pad_8_Please:
                aud8.Play();
                break;
            case Clip.Pad_9_Please:
                aud9.Play();
                break;
            case Clip.Up_Please:
                audUp.Play();
                break;
            case Clip.Warp:
                audWarp.Play();
                break;
            case Clip.WarpBang:
                audWarpBang.Play();
                break;
            case Clip.ThemeMusic:
                audThemeMusic.Play();
                break;

            default:
                break;
        }

        //record the last phrase we spoke and when we spoke it
        lastClip = phrase;
        //fltLastTimeSpoken = Time.realtimeSinceStartup;
    }
Example #25
0
        private void button3_Click(object sender, EventArgs e)
        {
            ESRI.ArcGIS.DataManagementTools.Clip clp = new Clip();
            clp.in_raster  = getlayer(comboBox1.Text.ToString());
            clp.out_raster = textBoxsave.Text;
            if (checkBox1.Checked == true)
            {
                IGPUtilities gputilities = new GPUtilitiesClass();
                IEnvelope    penvelope   = 遥感数据管理系统.Form1.envelope.penv;
                clp.rectangle = string.Format("{0} {1} {2} {3} ", penvelope.XMin, penvelope.YMin, penvelope.XMax, penvelope.YMax);
            }
            else
            {
                IGPUtilities gputilities = new GPUtilitiesClass();
                IGeoDataset  pgeodataset = gputilities.OpenRasterDatasetFromString(getlayer(comboBox2.Text.ToString())) as IGeoDataset;
                IEnvelope    penvelope   = pgeodataset.Extent;
                clp.in_template_dataset = getlayer(comboBox2.Text.ToString());
                clp.rectangle           = string.Format("{0} {1} {2} {3} ", penvelope.XMin, penvelope.YMin, penvelope.XMax, penvelope.YMax);
            }
            clp.clipping_geometry = "true";
            Geoprocessor gp = new Geoprocessor();

            gp.OverwriteOutput = true;
            IGeoProcessorResult gpresult = gp.Execute(clp, null) as IGeoProcessorResult;

            if (gpresult.Status == esriJobStatus.esriJobSucceeded)
            {
                DialogResult dl = MessageBox.Show("裁剪成功");
                if (dl == DialogResult.OK)
                {
                    if (checkBox3.Checked == true)
                    {
                        string fileFullName = textBoxsave.Text;
                        if (fileFullName == "")
                        {
                            return;
                        }
                        string            filePathName      = System.IO.Path.GetDirectoryName(fileFullName);
                        string            fileName          = System.IO.Path.GetFileName(fileFullName);
                        IWorkspaceFactory pWorkspaceFactory = new RasterWorkspaceFactory();                    //创建工作空间工厂
                        IWorkspace        pWorkspace        = pWorkspaceFactory.OpenFromFile(filePathName, 0); //打开工作空间
                        IRasterWorkspace  pRasterWorkspace  = pWorkspace as IRasterWorkspace;                  //创建栅格工作空间
                        IRasterDataset    pRasterDataset    = pRasterWorkspace.OpenRasterDataset(fileName);    //创建Dataset
                        //影像金字塔创建与判断
                        IRasterPyramid2 pRasPymid = pRasterDataset as IRasterPyramid2;
                        if (pRasPymid != null)
                        {
                            if (!(pRasPymid.Present))
                            {
                                pRasPymid.Create();//创建金字塔
                            }
                        }
                        IRaster      pRaster      = pRasterDataset.CreateDefaultRaster();
                        IRasterLayer pRasterLayer = new RasterLayer();
                        pRasterLayer.CreateFromRaster(pRaster);
                        ILayer pLayer = pRasterLayer as ILayer;
                        axmapcontrol.AddLayer(pLayer, 0);
                    }
                }
            }
            else
            {
                MessageBox.Show("裁剪失败");
            }
        }
Example #26
0
        public async Task <SpeechResponse?> ParseAudioStream(Clip clip, CancellationToken cancellationToken)
        {
            var timerToken = cancellationToken;

            try
            {
                var buffer       = new byte[3840];
                var hasReadBlock = false;

                using var memoryStream = new MemoryStream();
                try
                {
                    while (!timerToken.IsCancellationRequested)
                    {
                        //Console.WriteLine("Loop Start");
                        CancellationToken newTimerToken = timerToken;
                        if (!hasReadBlock)
                        {
                            //Console.WriteLine("Init Timer");
                            // Start a longer timer once the audio has come in so that we don't process more than 10 seconds of audio at a time.
                            var ctsTimer = new CancellationTokenSource(TimeSpan.FromSeconds(10));
                            var cts      = CancellationTokenSource.CreateLinkedTokenSource(ctsTimer.Token, cancellationToken);
                            newTimerToken = cts.Token;
                        }

                        var shortToken = timerToken;
                        if (hasReadBlock)
                        {
                            // If we've already read data, cancel after 0.5 seconds (hopefully they're done speaking) to allow processing of the message immediately
                            var shortCts    = new CancellationTokenSource(TimeSpan.FromSeconds(0.5));
                            var combinedCts = CancellationTokenSource.CreateLinkedTokenSource(shortCts.Token, timerToken);
                            shortToken = combinedCts.Token;
                        }

                        //Console.WriteLine("ReadAsync");
                        //shortToken.Register(() => Console.WriteLine("Short Token Expired"));

                        var byteCount = await clip.ReadAsync(buffer, 0, buffer.Length, shortToken);

                        if (byteCount == 0)
                        {
                            continue;
                        }

                        //Console.WriteLine("ReadAsync Ended");
                        hasReadBlock = true;
                        timerToken   = newTimerToken;
                        await memoryStream.WriteAsync(buffer, 0, buffer.Length);

                        await memoryStream.FlushAsync();

                        //Console.WriteLine("Loop End");
                    }
                }
                catch (OperationCanceledException)
                {
                    //Console.WriteLine("Big Cancelled");
                    // ignore
                }

                //Console.WriteLine("Reading Completed");
                memoryStream.Seek(0, SeekOrigin.Begin);
                if (memoryStream.Length == 0)
                {
                    return(null);
                }

                if (cancellationToken.IsCancellationRequested)
                {
                    return(null);
                }

                //Console.WriteLine("Sending to Api");
                var uri = _generateUri("speech", new Dictionary <string, string>());

                var content = new StreamContent(memoryStream);
                content.Headers.TryAddWithoutValidation("Content-Type", "audio/raw;encoding=signed-integer;bits=16;rate=48000;endian=little");
                content.Headers.TryAddWithoutValidation("Transfer-Encoding", "chunked");
                var response = await _httpClient.PostAsync(uri, content, cancellationToken);

                var responseText = await response.Content.ReadAsStringAsync();

                if (!response.IsSuccessStatusCode)
                {
                    throw new Exception(responseText);
                }

                return(JsonConvert.DeserializeObject <SpeechResponse>(responseText));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(null);
        }
Example #27
0
 Playable GetPlayable(Clip clip)
 {
     return(mixer.GetInput((int)clip));
 }
Example #28
0
 public static dynamic Dynamic(this Clip clip)
 {
     return(new DynamicEnvironment(clip));
 }
Example #29
0
 void SetWeight(Clip clip, float weight)
 {
     mixer.SetInputWeight((int)clip, weight);
 }
Example #30
0
        public static Size GetSize(this Clip clip)
        {
            var info = clip.GetVideoInfo();

            return(info.GetSize());
        }
Example #31
0
    public static ProcessResult <Clip[]> Apply(InterleaveOptions options, ClipMetaData metadata, params Clip[] clips)
    {
        if (clips.Length < 2)
        {
            clips = new[] { clips[0], clips[0] };
        }
        decimal position     = 0;
        int     repeatsIndex = 0;
        Clip    resultClip   = new Clip(4, true);

        switch (options.Mode)
        {
        case Event:
            if (options.ChunkChords)
            {
                foreach (var clip in clips)
                {
                    clip.GroupSimultaneousNotes();
                }
            }
            var noteCounters = clips.Select(c => new IntCounter(c.Notes.Count)).ToArray();
            position = clips[0].Notes[0].Start;

            while (noteCounters.Any(nc => !nc.Overflow))
            {
                for (var clipIndex = 0; clipIndex < clips.Length; clipIndex++)
                {
                    var clip = clips[clipIndex];
                    var currentNoteCounter = noteCounters[clipIndex];

                    for (var repeats = 0; repeats < options.Repeats[repeatsIndex % options.Repeats.Length]; repeats++)
                    {
                        var note = clip.Notes[currentNoteCounter.Value];

                        if (!options.Solo || clip.ClipReference.Track == metadata.TrackNumber)
                        {
                            var newNote = note with {
                            };
                            newNote.Start = position;
                            resultClip.Notes.Add(newNote);
                        }
                        position += clip.DurationUntilNextNote(currentNoteCounter.Value);
                    }
                    if (options.Skip)
                    {
                        foreach (var noteCounter in noteCounters)
                        {
                            noteCounter.Inc();
                        }
                    }
                    else
                    {
                        currentNoteCounter.Inc();
                    }
                    repeatsIndex++;
                }
            }
            if (options.ChunkChords)
            {
                resultClip.Flatten();
            }
            break;

        case Time:
            var srcPositions   = clips.Select(c => new DecimalCounter(c.Length)).ToArray();
            int timeRangeIndex = 0;

            while (srcPositions.Any(c => !c.Overflow))
            {
                for (var clipIndex = 0; clipIndex < clips.Length; clipIndex++)
                {
                    var clip             = clips[clipIndex];
                    var currentTimeRange = options.Ranges[timeRangeIndex];
                    for (var repeats = 0; repeats < options.Repeats[repeatsIndex % options.Repeats.Length]; repeats++)
                    {
                        if (!options.Solo || clip.ClipReference.Track == metadata.TrackNumber)
                        {
                            resultClip.Notes.AddRange(
                                ClipUtilities.GetSplitNotesInRangeAtPosition(
                                    srcPositions[clipIndex].Value,
                                    srcPositions[clipIndex].Value + currentTimeRange,
                                    clips[clipIndex].Notes,
                                    position
                                    )
                                );
                        }
                        position += currentTimeRange;
                    }
                    if (options.Skip)
                    {
                        foreach (var srcPosition in srcPositions)
                        {
                            srcPosition.Inc(currentTimeRange);
                        }
                    }
                    else
                    {
                        srcPositions[clipIndex].Inc(currentTimeRange);
                    }
                    repeatsIndex++;
                    timeRangeIndex = (timeRangeIndex + 1) % options.Ranges.Length;     // this means that you cannot use the Counts parameter to have varying time ranges for each repeat
                }
            }
            break;
        }
        resultClip.Length = position;
        return(new ProcessResult <Clip[]>(new[] { resultClip }));
    }
Example #32
0
 private string GetFullFileNameWithoutExtension(int clipCounter, string moduleDirectory, Clip clip)
 {
     return($@"{moduleDirectory}\{clipCounter:00}.{Utils.GetValidPath(clip.Title)}");
 }
 private static void SetClipViewModelInBunde(BundleUpdateViewModel model, Clip clipDetails, CurrencyDto sourceCurrency, CurrencyDto targetCurrency)
 {
     model.BundleClips.Add(new ClipMinimalData
     {
         Id = clipDetails.ObjectId,
         ClipNamePart1 = clipDetails.GetLocalizedField("portalNamePart1"),
         ClipNamePart2 = clipDetails.GetLocalizedField("portalNamePart2"),
         Price = CurrencyConverter.Convert(clipDetails.Price, sourceCurrency, targetCurrency).ToString("0.00"),
         Status = clipDetails.Status.GetLocalizedField("status"),
         Category3 = clipDetails.Category3.GetLocalizedField("value"),                
         Currency = clipDetails.Currency.ConvertToCurrencyDto()
     });
 }
 public ComponentClipper(Box2D clipFrame, Box2D frame, Clip clip)
 {
     this.ClipFrame = clipFrame;
     this.Frame = frame;
     this.OnClip = clip;
 }
        public void AddProperty(RuntimeAnimationProperty property)
        {
            if (property.ComponentTypeName == RuntimeAnimationProperty.k_SpecialAddButton)
            {
                IWindowManager wm = IOC.Resolve <IWindowManager>();
                IAnimationSelectPropertiesDialog selectPropertiesDialog = null;
                Transform dialogTransform = IOC.Resolve <IWindowManager>().CreateDialogWindow(RuntimeWindowType.SelectAnimationProperties.ToString(), "Select Properties",
                                                                                              (sender, args) => { }, (sender, args) => { }, 250, 250, 400, 400);
                selectPropertiesDialog        = IOC.Resolve <IAnimationSelectPropertiesDialog>();
                selectPropertiesDialog.View   = this;
                selectPropertiesDialog.Target = Target.gameObject;
            }
            else
            {
                if (BeforePropertiesAdded != null)
                {
                    BeforePropertiesAdded(this, EventArgs.Empty);
                }

                List <RuntimeAnimationProperty> addedProperties = new List <RuntimeAnimationProperty>();
                List <int> addedIndexes = new List <int>();

                if (m_propertiesTreeView.ItemsCount == 1)
                {
                    m_propertiesTreeView.Insert(0, m_emptyTop);
                    m_props.Insert(0, m_emptyTop);
                    addedProperties.Add(m_emptyTop);
                    addedIndexes.Add(0);
                }

                property          = new RuntimeAnimationProperty(property);
                property.Parent   = null;
                property.Children = null;
                if (!property.TryToCreateChildren())
                {
                    if (Reflection.IsPrimitive(property.Value.GetType()))
                    {
                        property.Curve = new AnimationCurve();
                    }
                }
                Clip.Add(property);

                m_propertiesTreeView.Insert(m_propertiesTreeView.ItemsCount - 1, property);

                addedProperties.Add(property);
                addedIndexes.Add(m_props.Count - 1);
                m_props.Insert(m_props.Count - 1, property);
                if (property.Children != null)
                {
                    for (int i = 0; i < property.Children.Count; i++)
                    {
                        addedProperties.Add(property.Children[i]);
                        addedIndexes.Add(m_props.Count - 1);
                        m_props.Insert(m_props.Count - 1, property.Children[i]);
                        Subscribe(property.Children[i]);
                    }
                }
                else
                {
                    Subscribe(property);
                }

                if (PropertiesAdded != null)
                {
                    PropertiesAdded(new ItemsArg {
                        Items = addedProperties.ToArray(), Rows = addedIndexes.ToArray()
                    });
                }
            }
        }
 private Animation(Clip anim, FrameContainer frames)
 {
     _clip = Convert(anim, frames, out _rootStart, out _rootEnd);
 }
        private void OnPropertiesRemoved(object sender, ItemsRemovedArgs e)
        {
            m_propertiesTreeView.ItemsRemoved -= OnPropertiesRemoved;

            List <Tuple <int, RuntimeAnimationProperty> > removedProperties = new List <Tuple <int, RuntimeAnimationProperty> >();

            HashSet <int> removedHs = new HashSet <int>();

            foreach (RuntimeAnimationProperty item in e.Items)
            {
                if (item.Parent != null)
                {
                    int row = IndexOf(item.Parent);
                    if (!removedHs.Contains(row))
                    {
                        removedHs.Add(row);
                        removedProperties.Add(new Tuple <int, RuntimeAnimationProperty>(row, item.Parent));

                        m_propertiesTreeView.RemoveChild(null, item.Parent);

                        for (int i = 0; i < item.Parent.Children.Count; ++i)
                        {
                            row = IndexOf(item.Parent.Children[i]);
                            if (!removedHs.Contains(row))
                            {
                                removedHs.Add(row);
                                removedProperties.Add(new Tuple <int, RuntimeAnimationProperty>(row, item.Parent.Children[i]));
                            }
                        }
                    }
                }

                else
                {
                    int row = IndexOf(item);
                    if (!removedHs.Contains(row))
                    {
                        removedHs.Add(row);
                        removedProperties.Add(new Tuple <int, RuntimeAnimationProperty>(row, item));

                        if (item.Children != null)
                        {
                            for (int i = 0; i < item.Children.Count; ++i)
                            {
                                row = IndexOf(item.Children[i]);
                                if (!removedHs.Contains(row))
                                {
                                    removedHs.Add(row);
                                    removedProperties.Add(new Tuple <int, RuntimeAnimationProperty>(row, item.Children[i]));
                                }
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < removedProperties.Count; ++i)
            {
                RuntimeAnimationProperty property = removedProperties[i].Item2;
                Unsubscribe(property);
                m_props.Remove(property);
                Clip.Remove(property);
            }

            if (m_propertiesTreeView.ItemsCount == 2)
            {
                m_props.Remove(m_emptyTop);
                m_propertiesTreeView.RemoveChild(null, m_emptyTop);
                removedProperties.Insert(0, new Tuple <int, RuntimeAnimationProperty>(0, m_emptyTop));
            }

            IEnumerable <Tuple <int, RuntimeAnimationProperty> > orderedItems = removedProperties.OrderBy(t => t.Item1);

            if (PropertiesRemoved != null)
            {
                PropertiesRemoved(new ItemsArg {
                    Items = orderedItems.Select(t => t.Item2).ToArray(), Rows = orderedItems.Select(t => t.Item1).ToArray()
                });
            }

            m_propertiesTreeView.ItemsRemoved += OnPropertiesRemoved;
        }
    public bool SampleAnimation(UnityEngine.Animation animation)
    {
        if(animation == null)
        {
            return false;
        }

        SkinnedMeshRenderer skinnedMeshRenderer = animation.GetComponentInChildren<SkinnedMeshRenderer>();
        if(skinnedMeshRenderer == null)
        {
            return false;
        }

        Mesh mesh = skinnedMeshRenderer.sharedMesh;
        if(mesh == null)
        {
            return false;
        }

        this.animation = new MeshAnimation();
        this.animation.triangles = mesh.triangles;
        this.animation.normals = mesh.normals;
        this.animation.uv = mesh.uv;

        List<string> clipNames = new List<string>();
        foreach(AnimationState animationState in animation)
        {
            clipNames.Add(animationState.name);
        }

        Mesh bakedMesh = new Mesh();
        int numClips = clipNames.Count;
        for(int i = 0; i < numClips; ++i)
        {
            string clipName = clipNames[i];
            if(this.animation.clips.ContainsKey(clipName))
            {
                Debug.LogError("Repeated name of AnimationClip:" + clipName);
                continue;
            }

            animation.Play(clipName);
            {
                AnimationState animationState = animation[clipName];

                Clip clip = new Clip();
                clip.wrapMode = animationState.wrapMode;
                this.animation.clips.Add(clipName, clip);

                float length = animationState.length;
                float step = 1.0f / fps;
                for(float time = 0; time < length; time += step)
                {
                    Keyframe keyframe = new Keyframe();
                    clip.keyframes.Add(keyframe);

                    animationState.time = time;
                    animation.Sample();

                    skinnedMeshRenderer.BakeMesh(bakedMesh);
                    keyframe.vertices = bakedMesh.vertices;
                }
            }
            animation.Stop(clipName);
        }

        return true;
    }
Example #39
0
 virtual protected void PutLinkOnItem(Clip clip, XmlNode node)
 {
 }
Example #40
0
 public ClipWrapper(Clip value)
 {
     ClipToWrap = value;
 }
Example #41
0
 public PhysicalShapeLayer(Clip clip_behavior)
 {
     this.isRect_        = false;
     this.clip_behavior_ = clip_behavior;
 }
Example #42
0
 virtual protected void PutSummaryOnItem(Clip clip, XmlNode node)
 {
 }
Example #43
0
    public static ProcessResult <Clip[]> Apply(TakeOptions options, params Clip[] clips)
    {
        var resultClips = new Clip[clips.Length];

        // Normalize take values (typical input range: 1 - N, while 0 - N is used internally)
        for (var ix = 0; ix < options.TakeCounts.Length; ix++)
        {
            options.TakeCounts[ix]--;
        }

        var(lowVelocity, highVelocity) = (options.LowVelocity, options.HighVelocity);
        if (lowVelocity > highVelocity)
        {
            (lowVelocity, highVelocity) = (highVelocity, lowVelocity);
        }
        var(lowPitch, highPitch) = (options.LowPitch, options.HighPitch);
        if (lowPitch > highPitch)
        {
            (lowPitch, highPitch) = (highPitch, lowPitch);
        }

        var i = 0;

        foreach (var clip in clips)
        {
            var filteredNotes = clip.Notes.Where(x =>
                                                 x.Velocity >= lowVelocity && x.Velocity <= highVelocity && x.Pitch >= lowPitch && x.Pitch <= highPitch).ToList();

            var     resultClip  = new Clip(clips[i].Length, clips[i].IsLooping);
            decimal currentPos  = 0;
            var     noteIx      = 0;
            var     currentTake = options.TakeCounts[0];
            var     takeIx      = 0;
            // We want to keep the length of the newly created clip approximately equal to the original, therefore we keep
            // going until we have filled at least the same length as the original clip
            while (currentPos < resultClip.Length)
            {
                if (currentTake == 0)
                {
                    if (noteIx >= clip.Count)
                    {
                        noteIx %= clip.Count;
                    }
                    var note = filteredNotes[noteIx] with {
                        Start = currentPos
                    };
                    currentPos += clip.DurationUntilNextNote(noteIx);
                    resultClip.Add(note);
                    currentTake = options.TakeCounts[++takeIx % options.TakeCounts.Length];
                }
                else
                {
                    if (options.Thin)
                    {
                        currentPos += clip.DurationUntilNextNote(noteIx);
                    }
                    currentTake--;
                }
                noteIx++;
            }
            resultClips[i] = resultClip;
            i++;
        }
        return(new ProcessResult <Clip[]>(resultClips));
    }
Example #44
0
 public void PlaySFX(Clip audioClip)
 {
     sfx[(int)audioClip].Play();
 }
 public void PlayOneShot(Clip audioClip)
 {
     sfx[(int)audioClip].Play();
 }
Example #46
0
        public override Clip GetClip()
        {
            Clip clip = new Clip();

            return clip;
        }
Example #47
0
 public void StopSFX(Clip audioClip)
 {
     sfx[(int)audioClip].Stop();
 }