Пример #1
0
        /// <summary>
        /// Set forward in the project.
        /// </summary>
        /// <returns>Next ensemble in the project.</returns>
        public PlaybackArgs StepForward()
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();

            args.TotalEnsembles = TotalEnsembles;

            // If looping, start over
            if (PlaybackIndex + 1 <= TotalEnsembles && IsLooping)
            {
                PlaybackIndex = MIN_INDEX;
            }
            // If a good index
            else if (PlaybackIndex + 1 <= TotalEnsembles)
            {
                args.Ensemble = GetEnsemble(++PlaybackIndex);
            }

            // Get the next ensemble
            args.Ensemble = GetEnsemble(PlaybackIndex);

            // Set the index
            args.Index          = PlaybackIndex;
            args.OrigDataFormat = AdcpCodec.CodecEnum.Binary;           // ****BAD, NEED TO DETERMINE CORRECT FORMAT

            return(args);
        }
Пример #2
0
        /// <summary>
        /// Jump to a specific location in the file to get the indexed ensemble.
        /// If the index is outside the range, then null will be returned.
        /// </summary>
        /// <param name="index">Index to jump to in the file.</param>
        /// <returns>Ensemble based off the index given.</returns>
        public PlaybackArgs Jump(long index)
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();

            // Get the first ensemble number
            // Determine how far forward to jump based off index
            // Then add the jump to the first ensemble number and find the next
            // ensemble number near that jump
            if (index < _ensembleDict.Count)
            {
                // Set new index
                PlaybackIndex = index;

                // Set new current ensemble
                // Zero based, so subtract 1
                _currEnsNum = _firstEnsNum + (int)index;

                // Find the next good ensemble
                FindEns(_currEnsNum);

                // Set the values
                args.Index          = PlaybackIndex;
                args.Ensemble       = _ensembleDict[_currEnsNum].Ensemble;
                args.TotalEnsembles = TotalEnsembles;
                args.OrigDataFormat = _ensembleDict[_currEnsNum].OrigDataFormat;
            }

            return(args);
        }
Пример #3
0
        /// <summary>
        /// Step backwards in the file.
        /// </summary>
        /// <returns>Previous ensemble in the file.</returns>
        public PlaybackArgs StepBackward()
        {
            // Verify the playback index
            if (_currEnsNum - 1 <= 0)
            {
                PlaybackIndex = 0;
                _currEnsNum   = 0;
                return(null);
            }

            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();

            if (PlaybackIndex < _ensembleDict.Count)
            {
                PlaybackIndex--;
                if (PlaybackIndex < 0)
                {
                    PlaybackIndex = 0;
                }

                _currEnsNum--;

                // Find the next good ensemble
                FindEns(_currEnsNum);

                // Set the values
                args.Index          = PlaybackIndex;
                args.Ensemble       = _ensembleDict[_currEnsNum].Ensemble;
                args.TotalEnsembles = TotalEnsembles;
                args.OrigDataFormat = _ensembleDict[_currEnsNum].OrigDataFormat;
            }

            return(args);
        }
        /// <summary>
        /// Set the ensemble based off the argument given.
        /// </summary>
        /// <param name="args">Arguments based off the ensemble to playback.</param>
        private void SetEnsemble(PlaybackArgs args)
        {
            _buffer.Enqueue(args);

            // Execute async
            if (!_isProcessingBuffer)
            {
                SetEnsembleExecute();
            }
        }
Пример #5
0
        /// <summary>
        /// Jump to a specific location in the project.
        /// If the index is outside the range, then null will be returned.
        /// </summary>
        /// <param name="index">Index to jump to in the project.</param>
        /// <returns>Ensemble based off the index given.</returns>
        public PlaybackArgs Jump(long index)
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();

            args.TotalEnsembles = TotalEnsembles;
            args.Index          = index;
            args.Ensemble       = GetEnsemble(index);
            args.OrigDataFormat = AdcpCodec.CodecEnum.Binary;           // ****BAD, NEED TO DETERMINE CORRECT FORMAT

            // Set the new playback index
            PlaybackIndex = index;

            return(args);
        }
        /// <summary>
        /// Dequeue all the data from the buffer.  Then
        /// </summary>
        private void SetEnsembleExecute()
        {
            lock (_isProcessingBufferLock)
            {
                _isProcessingBuffer = true;
            }

            while (_buffer.Count > 0)
            {
                PlaybackArgs args = null;
                if (_buffer.TryDequeue(out args))
                {
                    if (args != null)
                    {
                        // Set new index
                        _PlaybackIndex = args.Index;
                        this.NotifyOfPropertyChange(() => this.PlaybackIndex);

                        // Set new Total ensembles
                        _TotalEnsembles = args.TotalEnsembles;
                        this.NotifyOfPropertyChange(() => this.TotalEnsembles);

                        // Check if we hit the end of playback
                        if (_PlaybackIndex > TotalEnsembles)
                        {
                            // Stop the playback
                            StopTimer();
                        }
                        else
                        {
                            // Display the ensemble
                            ProcessEnsemble(args.Ensemble, args.OrigDataFormat);
                        }
                    }
                }
            }

            lock (_isProcessingBufferLock)
            {
                _isProcessingBuffer = false;
            }
        }
Пример #7
0
        /// <summary>
        /// Set forward in the file.
        /// </summary>
        /// <returns>Next ensemble in the file.</returns>
        public PlaybackArgs StepForward()
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();

            // Increment the playback index
            PlaybackIndex++;

            if (PlaybackIndex < _ensembleDict.Count)
            {
                // Find the first ensemble
                if (_currEnsNum == 0)
                {
                    while (!_ensembleDict.ContainsKey(_currEnsNum))
                    {
                        _currEnsNum++;
                    }
                }

                // Find the next good ensemble
                FindEns(_currEnsNum);

                // Set the values
                args.Index          = PlaybackIndex;
                args.Ensemble       = _ensembleDict[_currEnsNum].Ensemble;
                args.TotalEnsembles = TotalEnsembles;
                args.OrigDataFormat = _ensembleDict[_currEnsNum].OrigDataFormat;

                _currEnsNum++;
            }
            else
            {
                return(null);
            }

            return(args);
        }
Пример #8
0
        /// <summary>
        /// Step backwards in the project.
        /// </summary>
        /// <returns>Previous ensemble in the project.</returns>
        public PlaybackArgs StepBackward()
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();

            args.TotalEnsembles = TotalEnsembles;

            // Check if can step
            if (PlaybackIndex - 1 >= MIN_INDEX)
            {
                args.Ensemble = GetEnsemble(--PlaybackIndex);
            }
            else
            {
                // Return the previous value
                args.Ensemble = GetEnsemble(PlaybackIndex);
            }

            // Set the index
            args.Index          = PlaybackIndex;
            args.OrigDataFormat = AdcpCodec.CodecEnum.Binary;           // ****BAD, NEED TO DETERMINE CORRECT FORMAT

            return(args);
        }
Пример #9
0
        /// <summary>
        /// Set forward in the file.
        /// </summary>
        /// <returns>Next ensemble in the file.</returns>
        public PlaybackArgs StepForward()
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();

            // Increment the playback index
            PlaybackIndex++;

            if (PlaybackIndex < _ensembleList.Count)
            {
                // Set the values
                args.Index = PlaybackIndex;
                args.Ensemble = _ensembleList[(int)PlaybackIndex].Ensemble;
                args.TotalEnsembles = TotalEnsembles;
            }
            else
            {
                return null;
            }

            return args;
        }
Пример #10
0
        /// <summary>
        /// Step backwards in the file.
        /// </summary>
        /// <returns>Previous ensemble in the file.</returns>
        public PlaybackArgs StepBackward()
        {
            // Verify the playback index
            if(PlaybackIndex - 1 < 0)
            {
                return null;
            }

            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();

            if ( PlaybackIndex < _ensembleList.Count)
            {
                // Set the values
                args.Index = PlaybackIndex--;
                args.Ensemble = _ensembleList[(int)PlaybackIndex].Ensemble;
                args.TotalEnsembles = TotalEnsembles;
            }

            return args;
        }
Пример #11
0
        /// <summary>
        /// Jump to a specific location in the file to get the indexed ensemble.
        /// If the index is outside the range, then null will be returned.
        /// </summary>
        /// <param name="index">Index to jump to in the file.</param>
        /// <returns>Ensemble based off the index given.</returns>
        public PlaybackArgs Jump(long index)
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();

            if (index < _ensembleList.Count)
            {
                // Set new index
                PlaybackIndex = index;

                // Set the values
                args.Index = index;
                args.Ensemble = _ensembleList[(int)PlaybackIndex].Ensemble;
                args.TotalEnsembles = TotalEnsembles;
            }

            return args;
        }
Пример #12
0
        /// <summary>
        /// Set forward in the project.
        /// </summary>
        /// <returns>Next ensemble in the project.</returns>
        public PlaybackArgs StepForward()
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();
            args.TotalEnsembles = TotalEnsembles;

            // If looping, start over
            if (PlaybackIndex + 1 <= TotalEnsembles && IsLooping)
            {
                PlaybackIndex = MIN_INDEX;
            }
            // If a good index
            else if (PlaybackIndex + 1 <= TotalEnsembles)
            {
                args.Ensemble = GetEnsemble(++PlaybackIndex);
            }

            // Get the next ensemble
            args.Ensemble = GetEnsemble(PlaybackIndex);

            // Set the index
            args.Index = PlaybackIndex;

            return args;
        }
Пример #13
0
        /// <summary>
        /// Step backwards in the project.
        /// </summary>
        /// <returns>Previous ensemble in the project.</returns>
        public PlaybackArgs StepBackward()
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();
            args.TotalEnsembles = TotalEnsembles;

            // Check if can step
            if (PlaybackIndex - 1 >= MIN_INDEX)
            {
                args.Ensemble = GetEnsemble(--PlaybackIndex);
            }
            else
            {
                // Return the previous value
                args.Ensemble = GetEnsemble(PlaybackIndex);
            }

            // Set the index
            args.Index = PlaybackIndex;

            return args;
        }
Пример #14
0
        /// <summary>
        /// Jump to a specific location in the project.
        /// If the index is outside the range, then null will be returned.
        /// </summary>
        /// <param name="index">Index to jump to in the project.</param>
        /// <returns>Ensemble based off the index given.</returns>
        public PlaybackArgs Jump(long index)
        {
            // Create the args and set the total number of ensembles
            PlaybackArgs args = new PlaybackArgs();
            args.TotalEnsembles = TotalEnsembles;
            args.Index = index;
            args.Ensemble = GetEnsemble(index);

            // Set the new playback index
            PlaybackIndex = index;

            return args;
        }