-
Notifications
You must be signed in to change notification settings - Fork 155
add progress event #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
add progress event #107
Changes from 2 commits
bd1de0e
8c20c19
b2b8935
ef0e8de
8d24922
61af96d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,8 +196,12 @@ class Speaker extends Writable { | |
| binding.write(handle, b, b.length, onwrite) | ||
| } | ||
|
|
||
| var THIS = this; //preserve "this" for onwrite call-back | ||
|
||
| const onwrite = (r) => { | ||
| debug('wrote %o bytes', r) | ||
| debug('wrote %o bytes', r); | ||
| if (isNaN(++THIS.numwr)) THIS.numwr = 1; //track #writes; is this == #frames? | ||
| if (isNaN(THIS.wrtotal += r)) THIS.wrtotal = r; //track total data written | ||
| THIS.emit('progress', {numwr: THIS.numwr, wrlen: r, wrtotal: THIS.wrtotal, buflen: (left || []).length}); //give caller some progress info | ||
| if (r !== b.length) { | ||
| done(new Error(`write() failed: ${r}`)) | ||
| } else if (left) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "speaker", | ||
| "version": "0.4.0", | ||
| "version": "0.4.1", | ||
|
||
| "license": "MIT", | ||
| "description": "Output PCM audio data to the speakers", | ||
| "author": "Nathan Rajlich <[email protected]> (http://tootallnate.net)", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we try and name these something more human friendly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it would be a kind of acknowledgement or ack .