/// <returns> A copy of this configuration. </returns>
        public virtual AudioConfiguration copy()
        {
            AudioConfiguration copy = new AudioConfiguration();

            copy.setResamplingQuality(resamplingQuality);
            copy.OpusEncodingQuality = opusEncodingQuality;
            copy.OutputFormat        = outputFormat;
            return(copy);
        }
Ejemplo n.º 2
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));
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new instance
        /// </summary>
        //JAVA TO C# CONVERTER WARNING: The following constructor is declared outside of its associated class:
        //ORIGINAL LINE: public DefaultAudioPlayerManager()
        public DefaultAudioPlayerManager()
        {
            sourceManagers = new List <>();

            // Executors
            trackPlaybackExecutorService = new ThreadPoolExecutor(1, int.MaxValue, 10, TimeUnit.SECONDS, new SynchronousQueue(), new DaemonThreadFactory("playback"));
            trackInfoExecutorService     = ExecutorTools.createEagerlyScalingExecutor(1, DEFAULT_LOADER_POOL_SIZE, TimeUnit.SECONDS.toMillis(30), LOADER_QUEUE_CAPACITY, new DaemonThreadFactory("info-loader"));
            scheduledExecutorService     = Executors.newScheduledThreadPool(1, new DaemonThreadFactory("manager"));
            orderedInfoExecutor          = new OrderedExecutor(trackInfoExecutorService);

            // Configuration
            trackStuckThreshold = TimeUnit.MILLISECONDS.toNanos(10000);
            configuration       = new AudioConfiguration();
            cleanupThreshold    = new AtomicLong(DEFAULT_CLEANUP_THRESHOLD);
            frameBufferDuration = DEFAULT_FRAME_BUFFER_DURATION;
            useSeekGhosting     = true;
            outputHookFactory   = null;

            // Additional services
            remoteNodeManager        = new RemoteNodeManager(this);
            garbageCollectionMonitor = new GarbageCollectionMonitor(scheduledExecutorService);
            lifecycleManager         = new AudioPlayerLifecycleManager(scheduledExecutorService, cleanupThreshold);
            lifecycleManager.initialise();
        }
Ejemplo n.º 4
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));
        }