You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cal() method seems to be at the core of StreamPlayer, and it's the one I really want to understand.
How often is it called? Can you tell me the call frequency, or the time between each call, in a typical case, given a normal sample rate of 44100 Hz or whatever your choice.
while ((nBytesRead != -1) && status != Status.STOPPED && status != Status.NOT_SPECIFIED
&& status != Status.SEEKING) {
How often does this execute? Frequency or time between iterations, in a typical case?
Yet an inner loop: I suspect it would be easier to read as a while-loop, rather than a for-loop. The most important work of the loop is actually in the for-clause, which is unusual and hard to read. I'm referring to "nBytesRead = audioInputStream.read(audioDataBuffer.array(), totalRead, toRead)".
This is executed for every iteration of the inter loop we are in. The listener operations may take a long time. Do the listeners really have to be called for each iteration of the loop? The iteration frequency is controlled by audio properties in some way I'm asking about above, but the listeners generally deal with graphics. Maybe graphics don't have to update as often.
Compare with the following from JavaFx MediaPlayer:
Regrettably, JavaFx MediaPlayer only allows listeners to spectrum events, but the principle could be applied i a more general way. There seem to be some event generator for spectrum events, that run with a different (more slow, I assume) than the audio loop frequency.
The text was updated successfully, but these errors were encountered:
The cal() method seems to be at the core of StreamPlayer, and it's the one I really want to understand.
How often is it called? Can you tell me the call frequency, or the time between each call, in a typical case, given a normal sample rate of 44100 Hz or whatever your choice.
There's an inner loop, which starts with
java-stream-player/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java
Lines 833 to 834 in d32a46a
How often does this execute? Frequency or time between iterations, in a typical case?
Yet an inner loop: I suspect it would be easier to read as a while-loop, rather than a for-loop. The most important work of the loop is actually in the for-clause, which is unusual and hard to read. I'm referring to "nBytesRead = audioInputStream.read(audioDataBuffer.array(), totalRead, toRead)".
java-stream-player/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java
Lines 846 to 852 in d32a46a
Then comes a part which I think is important for performance. In a not-so-good way.
java-stream-player/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java
Lines 872 to 882 in d32a46a
This is executed for every iteration of the inter loop we are in. The listener operations may take a long time. Do the listeners really have to be called for each iteration of the loop? The iteration frequency is controlled by audio properties in some way I'm asking about above, but the listeners generally deal with graphics. Maybe graphics don't have to update as often.
Compare with the following from JavaFx MediaPlayer:
Regrettably, JavaFx MediaPlayer only allows listeners to spectrum events, but the principle could be applied i a more general way. There seem to be some event generator for spectrum events, that run with a different (more slow, I assume) than the audio loop frequency.
The text was updated successfully, but these errors were encountered: