Exemple #1
0
        static ControlService()
        {
            string appdir = ConfigurationManager.AppSettings["ProWriteFontFile"];

            if (appdir.IndexOf(@":") == -1)
            {
                appdir = Application.StartupPath + @"\" + appdir;
            }
            else
            {
                appdir = ConfigurationManager.AppSettings["ProWriteFontFile"];
            }

            FontManager.Initialize(appdir);

            _libraryTree      = new LibraryTree();
            _signCombo        = new SignRepositoryItemLookUpEdit();
            _propertyGrid     = new PropertyGridControl();
            _effectTree       = new EffectTreeControl();
            _toolBox          = new ToolBoxControl();
            _timeSliceControl = new TimeSliceGroupControl();
            _signImage        = new SignImage();
            _signStatus       = new SignStatus();

            _barButtonPosition = new BarButtonItem();
            //_barButtonPosition.CategoryGuid = new System.Guid("77795bb7-9bc5-4dd2-a297-cc758682e23d");
            //_barButtonPosition.Id = 0;
            //_barButtonPosition.Name = "siPosition";

            _statusBar            = new RibbonStatusBar();
            _currentClip          = new CurrentClip();
            _spellChecker         = new DevExpress.XtraSpellChecker.SpellChecker();
            _signStorageIndicator = new SignStorageIndicator();

            _pictureBox = new PictureEdit();
            _pictureBox.Properties.ShowMenu = false;
            _pictureBox.Properties.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Zoom;

            if (_libraryTree != null)
            {
                _libraryTree.Controller.RemoveLibraryItemEvent += new EventHandler <RemoveLibraryEventArgs>(Controller_RemoveLibraryItemEvent);
            }
            _fonts         = new List <PWFont>();
            _fontsBitMap   = new List <PWFont>();
            _fontsTrueType = new List <PWFont>();

            spellCheckTask = Task.Create((p) =>
            {
                CultureInfo engCulture = new CultureInfo("En-us");
                dictionary             = new SpellCheckerISpellDictionary(DemoUtils.GetRelativePath("american.xlg"), DemoUtils.GetRelativePath("english.aff"), engCulture);

                dictionary.AlphabetPath = DemoUtils.GetRelativePath("EnglishAlphabet.txt");
                customDictorary         = new SpellCheckerCustomDictionary();
                customDictorary.Culture = engCulture;

                SpellCheckerList.Load();
                customDictorary.AddWords(ServiceManager.Get <SpellCheckerList>());
            });
        }
 public virtual TNode AddNode(Vector2 pos)
 {
     return(CurrentClip.AddNode(pos));
 }
 public virtual void DeleTransition(Node targetNode, NodeTransition targetTransition)
 {
     CurrentClip.DeleTransition(targetNode, targetTransition);
 }
 public virtual void AddTransition(Node fromNode, Node toNode)
 {
     CurrentClip.AddTransition(fromNode, toNode);
 }
 public int StringToHash(string name)
 {
     return(CurrentClip.StringToHash(name));
 }
 public TNode FindState(string path)
 {
     return(CurrentClip.FindState(path));
 }
 public TNode FindNodeWithPath(string path)
 {
     return(CurrentClip.FindNodeWithPath(path));
 }
 public TNode FindNodeWithHash(int hash)
 {
     return(CurrentClip.FindNodeWithHash(hash));
 }
 public virtual void SetDefaultState(Node node)
 {
     CurrentClip.SetDefaultState(node);
 }
 public virtual void RemoveNode(TNode node)
 {
     CurrentClip.RemoveNode(node);
 }
Exemple #11
0
        /// <summary>
        /// Updates the channel, buffer addition audio if needed.  This method
        /// needs to be called frequently to maintain real-time performance.
        /// </summary>
        public void Update()
        {
            if (CurrentClip != null)
            {
                int buffersQueued;
                AL.GetSource(Source, ALGetSourcei.BuffersQueued, out buffersQueued);

                int processedBuffers;
                AL.GetSource(Source, ALGetSourcei.BuffersProcessed, out processedBuffers);

                if (eof)
                {
                    // Clip is done being buffered
                    if (buffersQueued <= processedBuffers)
                    {
                        // Clip has finished
                        AL.SourceStop(Source);
                        CurrentClip = null;

                        DequeuUsedBuffers();

                        return;
                    }
                }
                else
                {
                    // Still some buffering to do
                    if (buffersQueued - processedBuffers > 0 && AL.GetError() == ALError.NoError)
                    {
                        // Make sure we're playing (not sure why we would've stopped)
                        if (AL.GetSourceState(Source) != ALSourceState.Playing)
                        {
                            //AL.SourcePlay(Source);
                            CurrentClip = null;
                            DequeuUsedBuffers();
                            return;
                        }
                    }

                    // Detect buffer under-runs
                    bool underRun = (processedBuffers >= BufferCount);

                    // Remove processed buffers
                    while (processedBuffers > 0)
                    {
                        int removedBuffer = 0;

                        // TODO: Can remove more than one buffer here.  Can also
                        // add the buffers back to the queue.
                        AL.SourceUnqueueBuffers(Source, 1, ref removedBuffer);

                        // Just remove the buffer and don't do anything else if
                        // we're at the end of the clip.
                        if (eof)
                        {
                            processedBuffers--;
                            continue;
                        }

                        // Buffer the next chunk
                        int bytesRead = CurrentClip.read(SegmentBuffer, SegmentBuffer.Length,
                                                         _BIGENDIANREADMODE, _WORDREADMODE, _SGNEDREADMODE, null);

                        if (bytesRead > 0)
                        {
                            // TOOD: Queue multiple buffers here
                            AL.BufferData(removedBuffer, CurrentFormat, SegmentBuffer, bytesRead,
                                          CurrentRate);
                            AL.SourceQueueBuffer(Source, removedBuffer);
                        }
                        else if (bytesRead == 0)
                        {
                            // Reached the end of the file
                            eof = true;
                        }
                        else
                        {
                            // A file read error has occurred, stop playing
                            AL.SourceStop(Source);
                            CurrentClip = null;
                            break;
                        }

                        // Check for OpenAL errors
                        if (AL.GetError() != ALError.NoError)
                        {
                            AL.SourceStop(Source);
                            CurrentClip = null;
                            break;
                        }

                        processedBuffers--;
                    }
                }
            }
        }