/// <param name="audioTrack"> The audio track that this executor executes </param>
        /// <param name="configuration"> Configuration to use for audio processing </param>
        /// <param name="volumeLevel"> Mutable volume level to use when executing the track </param>
        /// <param name="useSeekGhosting"> Whether to keep providing old frames continuing from the previous position during a seek
        ///                        until frames from the new position arrive. </param>
        /// <param name="bufferDuration"> The size of the frame buffer in milliseconds </param>
        public LocalAudioTrackExecutor(InternalAudioTrack audioTrack, AudioConfiguration configuration, AtomicInteger volumeLevel, bool useSeekGhosting, int bufferDuration)
        {
            this.audioTrack = audioTrack;
            AudioDataFormat currentFormat = configuration.OutputFormat;

            this.frameBuffer       = new AudioFrameBuffer(bufferDuration, currentFormat, isStopping);
            this.processingContext = new AudioProcessingContext(configuration, frameBuffer, volumeLevel, currentFormat);
            this.useSeekGhosting   = useSeekGhosting;
        }
示例#2
0
        /// <summary>
        /// Executes an audio track with the given player and volume. </summary>
        /// <param name="listener"> A listener for track state events </param>
        /// <param name="track"> The audio track to execute </param>
        /// <param name="configuration"> The audio configuration to use for executing </param>
        /// <param name="volumeLevel"> The mutable volume level to use </param>
        //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        //ORIGINAL LINE: public void executeTrack(final TrackStateListener listener, InternalAudioTrack track, AudioConfiguration configuration, AtomicInteger volumeLevel)
        public virtual void executeTrack(TrackStateListener listener, InternalAudioTrack track, AudioConfiguration configuration, AtomicInteger volumeLevel)
        {
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final AudioTrackExecutor executor = createExecutorForTrack(track, configuration, volumeLevel);
            AudioTrackExecutor executor = createExecutorForTrack(track, configuration, volumeLevel);

            track.assignExecutor(executor, true);

            trackPlaybackExecutorService.execute(() => executor.execute(listener));
        }
示例#3
0
        private AudioTrackExecutor createExecutorForTrack(InternalAudioTrack track, AudioConfiguration configuration, AtomicInteger volumeLevel)
        {
            AudioSourceManager sourceManager = track.SourceManager;

            if (remoteNodeManager.Enabled && sourceManager != null && sourceManager.isTrackEncodable(track))
            {
                return(new RemoteAudioTrackExecutor(track, configuration, remoteNodeManager, volumeLevel));
            }
            else
            {
                AudioTrackExecutor customExecutor = track.createLocalExecutor(this);

                if (customExecutor != null)
                {
                    return(customExecutor);
                }
                else
                {
                    return(new LocalAudioTrackExecutor(track, configuration, volumeLevel, useSeekGhosting, frameBufferDuration));
                }
            }
        }