//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private byte[] buildRequestBody() throws IOException private sbyte[] buildRequestBody() { ByteArrayOutputStream outputBytes = new ByteArrayOutputStream(); DataOutputStream output = new DataOutputStream(outputBytes); IList <RemoteMessage> messages = new List <RemoteMessage>(); int queuedCount = queuedMessages.drainTo(messages); if (queuedCount > 0) { log.LogDebug("Including {} queued messages in the request to {}.", queuedCount, nodeAddress); } foreach (RemoteAudioTrackExecutor executor in playingTracks.values()) { java.util.concurrent.atomic.AtomicLong pendingSeek = executor.PendingSeek; AudioFrameBuffer buffer = executor.AudioBuffer; int neededFrames = pendingSeek.equals(-1) ? buffer.RemainingCapacity : buffer.FullCapacity; messages.Add(new TrackFrameRequestMessage(executor.ExecutorId, neededFrames, executor.Volume, long.Parse(pendingSeek.toString()))); } foreach (RemoteMessage message in messages) { mapper.encode(output, message); } mapper.endOutput(output); return(outputBytes.toByteArray()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void handleTrackFrameData(TrackFrameDataMessage message) throws Exception private void handleTrackFrameData(TrackFrameDataMessage message) { RemoteAudioTrackExecutor executor = playingTracks.get(message.executorId); if (executor != null) { if (message.seekedPosition >= 0) { executor.clearSeek(message.seekedPosition); } AudioFrameBuffer buffer = executor.AudioBuffer; executor.receivedData(); AudioDataFormat format = executor.Configuration.OutputFormat; foreach (AudioFrame frame in message.frames) { buffer.consume(new AudioFrame(frame.timecode, frame.data, frame.volume, format)); } if (message.finished) { buffer.setTerminateOnEmpty(); trackEnded(executor, false); } } }
/// <param name="track"> Audio track to play </param> /// <param name="configuration"> Configuration for audio processing </param> /// <param name="remoteNodeManager"> Manager of remote nodes </param> /// <param name="volumeLevel"> Mutable volume level </param> public RemoteAudioTrackExecutor(AudioTrack track, AudioConfiguration configuration, RemoteNodeManager remoteNodeManager, AtomicInteger volumeLevel) { this.track = track; this.configuration = configuration.copy(); this.remoteNodeManager = remoteNodeManager; this.volumeLevel = volumeLevel; this.executorId = nanoTime(); this.frameBuffer = new AudioFrameBuffer(BUFFER_DURATION_MS, configuration.OutputFormat, null); }