Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Initialize bufferDuration outside of process() in ABSN algorithm.
  • Loading branch information
joeberkovitz committed Jun 28, 2018
commit 992eda2fc24df6425c327eac46c5d07d900e4593
2 changes: 1 addition & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4822,6 +4822,7 @@ let stop = Infinity; // Set by stop()

// Variables for tracking node's playback state
let bufferTime = 0, started = false, enteredLoop = false;
let bufferDuration = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this? Maybe playbackDuration or something? I find it confusing because there's duration, buffer.duration, and now bufferDuration.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I am now remembering that I called it bufferDuration because it is duration in terms of the buffer frame rate, not the audible playback duration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what should it be? I think that it's now really the audible playback duration, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is changing duration from a measurement in the audible timeline to a measurement across the buffer. i.e. the same units as offset.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I'm thoroughly confused. I thought if start(when, offset,1) were called and the playback rate is 1/10, the audio would be heard for 10 sec and not 1 sec. (Assuming there's at least 1 sec of audio in the buffer, or we're looping.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for hearing the 10s. playback would end when bufferDuration is 1.

Perhaps bufferTimeElapsed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rtoy we agree on the meaning. I'll let you modify the branch as heading out of touch for 2 weeks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joeberkovitz I'll take over this PR. Thanks for your work on this and see in a few weeks.

I think there's just a couple of minor things that need to be fixed:

  • Rename bufferDuration
  • Set bufferTime probably to just offset.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed bufferDuration and initialized bufferTime to offset.

let dt = 1 / context.sampleRate;

// Handle invocation of start method call
Expand Down Expand Up @@ -4868,7 +4869,6 @@ function playbackSignal(position) {
// of |numberOfFrames| sample frames to be output.
function process(numberOfFrames) {
let currentTime = context.currentTime; // context time of next rendered frame
let bufferDuration = 0; // cumulative duration in "buffer time" (not adjusted for playback rate)
let output = []; // accumulates rendered sample frames

// Combine the two k-rate parameters affecting playback rate
Expand Down
Loading