Пример #1
0
 internal static void CheckTrackStatus(TrackStatus status)
 {
     if (status != 0)
     {
         throw new InvalidOperationException("AudioTrack error " + status.ToString() + ".");
     }
 }
Пример #2
0
        private void SetTrackObject(Image <Bgr, byte> image)
        {
            if (_trackStatus == TrackStatus.None)
            {
                return;
            }
            CamShiftTracking trackObj = null;
            Rectangle        rect     = Rectangle.Empty;

            if (_trackStatus == TrackStatus.Left)
            {
                rect = _drawRectL;
            }
            else
            {
                rect = _drawRectR;
            }

            trackObj = new CamShiftTracking(image, rect);

            if (_trackStatus == TrackStatus.Left)
            {
                SetTrackAndRect(ref _trackingObjL, ref _drawRectL, trackObj, Rectangle.Empty);
            }
            else
            {
                SetTrackAndRect(ref _trackingObjR, ref _drawRectR, trackObj, Rectangle.Empty);
            }

            _trackStatus = TrackStatus.None;
        }
Пример #3
0
 private void ClearPlayerCache()
 {
     CurrentPlaylistGUID = Guid.Empty;
     CurrentTrack        = null;
     CurrentTrackIndex   = -1;
     CurrentTrackLength  = -1;
     CurrentTrackStatus  = TrackStatus.None;
 }
 public void Stop()
 {
     trackStatus           = TrackStatus.Off;
     SampleRate            = 0;
     synchronizationReader = null; // do not dispose
     trackReader.Dispose();
     trackReader = null;
     samplesReal = samplesImaginary = null;
     ClearSpectrumColumns();
 }
Пример #5
0
        public void checkForRepeats(ListViewItem item)
        {
            if (item.Tag != null)
            {
                TrackStatus st = (TrackStatus)item.Tag;
                if (st == TrackStatus.Repeat || st == TrackStatus.Conflict)
                {
                    //   tool.Debug(0, "track already tagged");
                    return;
                }
            }

            string name = item.SubItems[0].Text;
            string path = item.SubItems[1].Text;

            List <ListViewItem> foundItems = new List <ListViewItem>();

            //tool.Debug(0,tool.Count++);
            foreach (ListViewItem i in Items)
            {
                //check if the name matches
                if (i.SubItems[0].Text == name)
                {
                    foundItems.Add(i);
                }
            }
            if (foundItems.Count > 1)
            {
                foreach (ListViewItem i in foundItems)
                {
                    if (i.SubItems[1].Text == path)
                    {
                        i.Tag = TrackStatus.Repeat;
                    }
                    else
                    {
                        i.Tag = TrackStatus.Conflict;
                    }
                }
            }
            else if (foundItems.Count == 1)
            {
                if (foundItems[0].Tag != null && foundItems[0].Tag is TrackStatus)
                {
                    // tool.Show();
                    TrackStatus stat = (TrackStatus)foundItems[0].Tag;
                    if (stat == TrackStatus.Repeat | stat == TrackStatus.Conflict)
                    {
                        // item.BackColor = BackColor;
                        foundItems[0].Tag = TrackStatus.Exists;
                    }
                }
            }
        }
Пример #6
0
        public void GetTrackStatusTest()
        {
            TrackController target   = new TrackController(); // TODO: Initialize to an appropriate value
            string          trackId  = string.Empty;          // TODO: Initialize to an appropriate value
            TrackStatus     expected = null;                  // TODO: Initialize to an appropriate value
            TrackStatus     actual;

            actual = target.GetTrackStatus(trackId);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #7
0
 public void CheckFileConflicts()
 {
     foreach (ListViewItem li in Items)
     {
         if (li.Tag != null && li.Tag is TrackStatus)
         {
             TrackStatus stat = (TrackStatus)li.Tag;
             if (stat != TrackStatus.Conflict)
             {
                 UpdateTrackPath(li);
             }
         }
     }
 }
Пример #8
0
 public TrackInfo(string trackingNumber,
                  Carrier carrier,
                  TrackStatus status,
                  string details,
                  DateTime localTime,
                  Address?location) : this()
 {
     TrackingNumber = trackingNumber;
     Carrier        = carrier;
     Status         = status;
     Details        = details;
     LocalTime      = localTime;
     Location       = location;
 }
 public void SetRecording(bool recording)
 {
     isRecording = isTracking = recording;
     recordingStartImage.gameObject.SetActive(!isTracking);
     recordingStopImage.gameObject.SetActive(isTracking);
     if (!isTracking)
     {
         TrackerStatus = TrackStatus.Off;
         SetPlaying(false, true);
     }
     else
     {
         SetPlaying(true, false);
     }
 }
Пример #10
0
 public TrackInfo(string trackingNumber,
     Carrier carrier,
     TrackStatus status,
     string details,
     DateTime localTime,
     Address? location)
     : this()
 {
     TrackingNumber = trackingNumber;
       Carrier = carrier;
       Status = status;
       Details = details;
       LocalTime = localTime;
       Location = location;
 }
Пример #11
0
 private void _sourcePictureBox_MouseUp(object sender, MouseEventArgs e)
 {
     if (!_isMouseDown)
     {
         return;
     }
     if (e.Button == MouseButtons.Right)
     {
         _trackStatus = TrackStatus.Right;
     }
     if (e.Button == MouseButtons.Left)
     {
         _trackStatus = TrackStatus.Left;
     }
     _isMouseDown = false;
 }
        public formConfigureTrajectoryDisplay(DrawingTrack track, Metadata metadata, Bitmap image, long timestamp, Action invalidate)
        {
            InitializeComponent();

            this.track   = track;
            memoStatus   = track.Status;
            track.Status = TrackStatus.Configuration;
            track.TrackerParametersChanged += new EventHandler(track_TrackParametersChanged);
            this.invalidate = invalidate;
            this.timestamp  = timestamp;

            pnlViewport.Controls.Add(viewportController.View);
            viewportController.View.Dock = DockStyle.Fill;

            viewportController.Bitmap    = image;
            viewportController.Timestamp = timestamp;

            InitializeDisplayRectangle(image.Size, timestamp);
            metadataRenderer    = new MetadataRenderer(metadata);
            metadataManipulator = new MetadataManipulator(metadata, screenToolManager);
            metadataManipulator.SetFixedTimestamp(timestamp);
            metadataManipulator.SetFixedKeyframe(-1);

            viewportController.MetadataRenderer    = metadataRenderer;
            viewportController.MetadataManipulator = metadataManipulator;

            viewportController.Refresh();

            track.DrawingStyle.ReadValue();

            // Save the current state in case of cancel.
            track.MemorizeState();
            track.DrawingStyle.Memorize();

            InitViewCombo();
            InitMarkerCombo();
            InitExtraDataCombo();
            chkBestFitCircle.Checked = track.DisplayBestFitCircle;
            InitTrackParameters();
            SetupStyleControls();
            SetCurrentOptions();
            InitCulture();

            interactionTimer.Interval = 15;
            interactionTimer.Tick    += InteractionTimer_Tick;
            interactionTimer.Start();
        }
Пример #13
0
        private void SetTrackingStatus(TrackStatus status)
        {
            if (mStatus == TrackStatus.SelectedSurface || mStatus == status)
            {
                return;
            }

            // If the surface has been selected, we no longer need our cross hair listener.
            if (status == TrackStatus.SelectedSurface)
            {
                mViroView.SetCameraARHitTestListener(null);
            }

            mStatus = status;
            UpdateUiHud();
            Update3DarCrosshair();
            Update3DModelProduct();
        }
Пример #14
0
        // Default value of playlistName should be `null` so that music play can selected playlist automatically.
        public PlayTrackEventArgs(Guid listGUID, int trackIdx = -1, TrackInfo track = null,
                                  PlaybackMode mode           = PlaybackMode.None,
                                  TrackStatus trackStatus     = TrackStatus.None)
        {
            PlaylistGUID    = (PlaylistGUID == null) ? Properties.Settings.Default.LastSelectedPlaylistGUID : listGUID;
            PrevTrack       = null;
            CurrTrack       = track;
            PrevTrackIndex  = -1;
            CurrTrackIndex  = trackIdx;
            PrevTrackStatus = TrackStatus.None;
            CurrTrackStatus = (trackStatus == TrackStatus.None) ? TrackStatus.None : trackStatus;
            PlaybackMode    = (mode == PlaybackMode.None) ?
                              (PlaybackMode)Properties.Settings.Default.PlaybackMode : mode;

            // Use TaskPlaybackMode as a global variable to handle PlayTrackEvent whether it comes from user-clicked or scheduler-triggered.
            Properties.Settings.Default.TaskPlaybackMode = (int)PlaybackMode;
            Properties.Settings.Default.Save();
        }
 public void Start()
 {
     trackStatus = TrackStatus.On;
     SynchronizeReaderPositions();
 }
Пример #16
0
 /// <summary>
 /// Are the given bits all set in the given value.
 /// </summary>
 public static bool IsSet(this TrackStatus value, TrackStatus bits)
 {
     return((value & bits) == bits);
 }
Пример #17
0
 private async Task SyncClientToCurrentVideo()
 {
     TrackStatus currentTrackStatus = _trackStatusService.CurrentTrackStatusFor(ClientChannelIds[Context.ConnectionId]);
     await Clients.Caller.SyncVideo(currentTrackStatus.CurrentTrackId, currentTrackStatus.TimeStampSeconds);
 }
Пример #18
0
        void audiomgr_periodicUpdate(object sender, EventArgs e)
        {

            Dictionary<long, AUDIOTRACK> tracks = AudioServiceHost.audiomgr.getAllTracks();
            foreach (KeyValuePair<long, AUDIOTRACK> track in tracks.ToArray())
            {
                TrackStatus status = new TrackStatus(track);
                try
                {
                    this.callback.OnTrackInfo(status, DateTime.Now);
                }
                catch
                {
                    
                }
            }

        }
Пример #19
0
        void audiomgr_instantUpdate(object sender, EventArgs e)
        {
                EndSyncEventArgs ee = (EndSyncEventArgs)e;
                

                TrackStatus status = new TrackStatus(ee.track);
                status.playstatus = ee.status;
                   try
                   {

                       this.callback.OnTrackInfo(status, DateTime.Now);

                   }
                   catch
                   {

                   }

                   if (status.playstatus == TrackPlayStatus.PLAYED) 
                   AudioServiceHost.audiomgr.closeTrack(ee.track.Key);

        }
        private int init = 0; // 0 = init | 1 = onair sync | 2 = fill playout
        public void OnTrackInfo(TrackStatus status, DateTime delay)
        {

            try
            {
                SlotItem slot = this.AEslots[status.logid];
                UIElement uislot = this.UIslots[status.logid];
                if (status.infotype == TrackInfoType.ERROR)
                {

                    slot.status = DS.SlotStatus.ERROR;
                    ReplaceByErrorSlot(status.logid);
                    Console.WriteLine("ERROR with slot id :" + status.logid);
                }
                else if(status.infotype == TrackInfoType.INFO)
                {
                    if (status.playstatus == TrackPlayStatus.READY)
                    {
                        slot.status = DS.SlotStatus.READY;
                    }
                    else if (status.playstatus == TrackPlayStatus.XFADE)
                    {
                        Console.WriteLine("[AUDIOENGINE] "+DateTime.Now.Subtract(delay).TotalMilliseconds+" ms delay");
                        //if(slot.status == DS.SlotStatus.ONAIR)
                        this.PlayNextSlot();                     
                    }
                    else if (status.playstatus == TrackPlayStatus.CLOSING)
                    {
                        slot.status = DS.SlotStatus.CLOSING;
                    }
                    else if (status.playstatus == TrackPlayStatus.ONAIR)
                    {
                        slot.status = DS.SlotStatus.ONAIR;
                        if (slot.item.dataitemtype == DS.DataItemType.SONG)
                        {
                            DataSongItem songitem = (DataSongItem)slot.item;
                            this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
                            {
                                USlotSong uislotsong = (USlotSong)((USlot)uislot).Content;
                              /*  Console.WriteLine(songitem.timemarker.next);
                                Console.WriteLine(status.realelapsedtime);
                                Console.WriteLine(songitem.timemarker.cue);*/
                                
                                uislotsong.currenttime = songitem.timemarker.next.Subtract(status.realelapsedtime);

                            }));

                        }
                    }
                        //Clean Audioengine Tracks
                    else if (status.playstatus == TrackPlayStatus.PLAYED)
                    {
                        removeUSlot(status.logid);
                        slot.status = DS.SlotStatus.PLAYED;

                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
                        {
                                fillPlayout();
                        }));
                    }
                }
            }
            catch (KeyNotFoundException e){ 
                Console.WriteLine("NOT FROM THIS PLAYER "+status.playstatus);
                //Console.WriteLine(e.Message);
                try
                {
                    //Recover ONAIR Tracks
                    if (status.playstatus == TrackPlayStatus.ONAIR && init==0)
                    {

                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
                        {
                            try
                            {
                                SlotItem current = loglist.getSlotById(status.logid);

                                if (current != null && current.item.dataitemtype != DS.DataItemType.LOGNOTE)
                                {
                                    if (this.init==0)
                                    {
                                        

                                        CurrentSlot = current;
                                        this.nextPlay = current;
                                        this.lastLoaded = current;
                                        current =updateLastLoaded();
                                        updateNextPlay();
                                        init++;
                                                                                
                                    }                                    
                                    addUSlot(current, true);
                                    loglist.skipUntilSlot(current);
                                }
                            }
                            catch{
                                Console.WriteLine("NOT FOUND SLOT");
                            }
                        }));
                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
                        {
                            if (init == 1)
                            {
                                fillPlayout();
                                init++;
                            }
                        }));
                    }
                    else
                    {
                        this.audioconnection.service.stopTrack(status.logid);
                    }
                }
                catch { Console.WriteLine("[OnTrackInfo] error: " + e.Message);  }
            
            }
        }
Пример #21
0
    void OnGUI()
    {
        if (!isTracking)
        {
            if (ImageWidth < ImageHeight)
            {
                trackButton = GUI.Button(new Rect(0, Screen.height - Screen.width / 7, Screen.width / 8, Screen.width / 8), " ", startTrackingStyle);
            }
            else
            {
                trackButton = GUI.Button(new Rect(0, Screen.height - Screen.height / 7, Screen.height / 8, Screen.height / 8), " ", startTrackingStyle);
            }


            if (trackButton)
            {
                isTracking = true;
            }
        }

        if (isTracking)
        {
            if (ImageWidth < ImageHeight)
            {
                stopTrackButton = GUI.Button(new Rect(0, Screen.height - Screen.width / 7, Screen.width / 8, Screen.width / 8), " ", stopTrackingStyle);
            }
            else
            {
                stopTrackButton = GUI.Button(new Rect(0, Screen.height - Screen.height / 7, Screen.height / 8, Screen.height / 8), " ", stopTrackingStyle);
            }


            if (stopTrackButton)
            {
                isTracking    = false;
                TrackerStatus = TrackStatus.Off;
            }
        }



        if (ImageWidth < ImageHeight)
        {
            switchCamButton = GUI.Button(new Rect(Screen.width - Screen.width / 6, Screen.height - Screen.width / 6, Screen.width / 6, Screen.width / 6), " ", switchCamButtonStyle);
        }
        else
        {
            switchCamButton = GUI.Button(new Rect(Screen.width - Screen.height / 6, Screen.height - Screen.height / 6, Screen.height / 6, Screen.height / 6), " ", switchCamButtonStyle);
        }

        if (switchCamButton)
        {
            currentDevice = (currentDevice == 1) ? 0 : 1;
        }


        if (mask)
        {
            if (ImageWidth < ImageHeight)
            {
                normalButton = GUI.Button(new Rect(Screen.width - Screen.width / 30 - Screen.width / 3, Screen.height / 30, Screen.width / 3, Screen.height / 12), "Normal");
            }
            else
            {
                normalButton = GUI.Button(new Rect(Screen.width - Screen.height / 30 - Screen.height / 3, Screen.width / 30, Screen.height / 3, Screen.width / 12), "Normal");
            }
            if (normalButton)
            {
                VideoPreview preview = GameObject.Find("Video Preview").GetComponent <VideoPreview> ();
                preview.DesiredScreenWidth = 0.3f;
                preview.PreviewResults     = true;
                mask = false;
            }
        }
        else
        {
            if (ImageWidth < ImageHeight)
            {
                maskButton = GUI.Button(new Rect(Screen.width - Screen.width / 30 - Screen.width / 3, Screen.height / 30, Screen.width / 3, Screen.height / 12), "Mask");
            }
            else
            {
                maskButton = GUI.Button(new Rect(Screen.width - Screen.height / 30 - Screen.height / 3, Screen.width / 30, Screen.height / 3, Screen.width / 12), "Mask");
            }
            if (maskButton)
            {
                VideoPreview preview = GameObject.Find("Video Preview").GetComponent <VideoPreview> ();
                preview.DesiredScreenWidth = 1f;
                preview.PreviewResults     = false;
                mask = true;
            }
        }
    }
Пример #22
0
 /// <summary>
 /// Are the given bits all set in the given value.
 /// </summary>
 public static bool IsSet(this TrackStatus value, TrackStatus bits)
 {
     return ((value & bits) == bits);
 }
Пример #23
0
 internal static void SetAppProperties(this Properties.Settings setting, Guid listGUID, int trackIdx, TrackStatus status, PlaybackMode mode)
 {
     setting.TaskPlaylistGUID       = listGUID;
     setting.TaskPlayingTrackIndex  = trackIdx;
     setting.TaskPlayingTrackStatus = (int)status;
     setting.TaskPlaybackMode       = (int)mode;
     setting.Save();
 }
Пример #24
0
        public void UpdateTracksStatus()
        {
            string currentTrackName = null;
            string currentPath      = null;

            if (MusicPlayer.Get)
            {
                if (File.Exists(MusicPlayer.currentTrack))
                {
                    currentTrackName = Path.GetFileNameWithoutExtension(MusicPlayer.currentTrack);
                    currentPath      = MusicPlayer.currentTrack;
                }
            }

            // tool.Debug(0,tool.Count++);
            foreach (ListViewItem item in Items)
            {
                string name     = item.SubItems[0].Text;
                string path     = item.SubItems[1].Text;
                bool   searched = false;
                item.BackColor = BackColor;
                item.ForeColor = ForeColor;
                TrackStatus status = TrackStatus.Null;
                checkForRepeats(item);


                if (item.Tag != null)
                {
                    status = (TrackStatus)item.Tag;
                }

                if (status == TrackStatus.WasPlayed && previousTrack != path)
                {
                    status = TrackStatus.Exists;
                }

                if (status == TrackStatus.IsPlaying && currentPath != path)
                {
                    item.Tag      = TrackStatus.WasPlayed;
                    previousTrack = path;
                }

                //check if item is the currently playing track
                if (path == currentPath && currentPath != null)
                {
                    item.Tag = TrackStatus.IsPlaying;
                }

                if (item.SubItems[0].Tag != null)
                {
                    Color group = (Color)item.SubItems[0].Tag;
                    item.ForeColor = group;
                }

                if (item.ForeColor == Color.Black)
                {
                    item.ForeColor = this.ForeColor;
                }

                if (item.Tag != null)
                {
                    switch (status)
                    {
                    /*
                     * case TrackStatus.Duplicate:
                     *  item.BackColor = DupeColor;
                     *  break;
                     */

                    case TrackStatus.Missing:
                        item.BackColor = MissingColor;
                        break;

                    case TrackStatus.Exists:
                        item.BackColor = ExistColor;
                        break;

                    case TrackStatus.Conflict:
                        item.BackColor = ConflictColor;
                        break;

                    case TrackStatus.Repeat:
                        item.BackColor = RepeatColor;
                        break;

                    case TrackStatus.WasPlayed:
                    {
                        item.ForeColor = Color.Black;
                        item.BackColor = MusicPlayer.PreviousPlayColor;
                    }
                    break;

                    case TrackStatus.IsPlaying:
                    {
                        item.ForeColor = Color.Black;
                        item.BackColor = MusicPlayer.PlayColor;
                    }
                    break;

                    default:
                        break;
                    }
                }

                //apply search color to searched tracks
                if (!string.IsNullOrEmpty(FilteredText))
                {
                    searched = name.ToLower().Contains(FilteredText.ToLower());

                    if (searched)
                    {
                        if (FilteredText.Count() > -1)
                        {
                            if (item.BackColor != MusicPlayer.PlayColor)
                            {
                                item.BackColor = SearchColor;
                                item.ForeColor = Color.Black;
                            }
                        }
                    }
                }
            }
        }
Пример #25
0
 public void Pause()
 {
     status = TrackStatus.Paused;
 }
Пример #26
0
 public void Play()
 {
     status = TrackStatus.Playing;
 }
Пример #27
0
 public void Stop()
 {
     status = TrackStatus.Stopped;
     Position = 0;
 }
 public void Pause()
 {
     trackStatus = TrackStatus.Paused;
     SynchronizeReaderPositions();
 }
        /** This method is called every frame.
         *
         * It fetches the tracking data from the tracker and transforms controlled objects accordingly.
         * It also fetches vertex, triangle and texture coordinate data to generate 3D face model from the tracker.
         * And lastly it refreshes the video frame texture with the new frame data.
         *
         */
        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                Application.Quit();
            }
#if (UNITY_IPHONE) && UNITY_EDITOR
            // no tracking on ios while in editor
            return;
#endif
            // update tracker status, translation and rotation
            int trackStatus;

            if (isTracking)
            {
                //currentOrientation = getDeviceOrientation();

                //// check if orientation or camera device changed
                //if (currentOrientation != Orientation || currentDevice != device)
                //{
                //	OpenCamera(currentOrientation, currentDevice, defaultCameraWidth, defaultCameraHeight, isMirrored);
                //	Orientation = currentOrientation;
                //	device = currentDevice;
                //	Frame = null;
                //}

                // grab new frame and start face tracking on it
                VisageTrackerNative._grabFrame();
                trackStatus = VisageTrackerNative._track();
                VisageTrackerNative._get3DData(out Translation.x, out Translation.y, out Translation.z, out Rotation.x, out Rotation.y, out Rotation.z);

                TrackerStatus = (TrackStatus)trackStatus;
                //	isTracking = TrackerStatus != 0;
            }

            // exit if no tracking
            if (TrackerStatus == TrackStatus.Off)
            {
                return;
            }

            // set correct camera field of view
            GetCameraInfo();

#if UNITY_ANDROID && !UNITY_EDITOR
            //waiting to get information about frame width and height
            if (ImageWidth == 0 || ImageHeight == 0)
            {
                return;
            }
#endif

            // update gaze direction
            float[] gazeDirection = new float[2];
            VisageTrackerNative._getGazeDirection(gazeDirection);
            GazeDirection = new Vector2(gazeDirection[0] * Mathf.Rad2Deg, gazeDirection[1] * Mathf.Rad2Deg);

            // get image
            //RefreshImage();

            // get action units
            if (ActionUnitsEnabled)
            {
                RefreshActionUnits();
            }
        }
Пример #30
0
 public Track()
 {
     status = TrackStatus.Stopped;
     Position = 0;
 }