New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

speaker

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speaker - npm Package Compare versions

Comparing version 0.4.2 to 0.5.0

.github/workflows/test.yml

38

index.d.ts
import { Writable, WritableOptions } from 'stream';
export interface Options extends WritableOptions {
readonly channels?: number;
readonly bitDepth?: number;
readonly sampleRate?: number;
readonly lowWaterMark?: number;
readonly highWaterMark?: number;
}
namespace Speaker {
interface Options extends WritableOptions {
readonly channels?: number;
readonly bitDepth?: number;
readonly sampleRate?: number;
readonly lowWaterMark?: number;
readonly highWaterMark?: number;
}
export interface Format {
readonly float?: boolean;
readonly signed?: boolean;
readonly bitDepth?: number;
readonly channels?: number;
readonly sampleRate?: number;
readonly samplesPerFrame?: number;
interface Format {
readonly float?: boolean;
readonly signed?: boolean;
readonly bitDepth?: number;
readonly channels?: number;
readonly sampleRate?: number;
readonly samplesPerFrame?: number;
}
}

@@ -26,4 +28,4 @@

*/
export default class Speaker extends Writable {
constructor(opts?: Options);
class Speaker extends Writable {
constructor(opts?: Speaker.Options);

@@ -46,3 +48,3 @@ /**

*/
public getFormat(format: Format): number | null;
public getFormat(format: Speaker.Format): number | null;

@@ -58,1 +60,3 @@ /**

}
exports = Speaker

@@ -10,4 +10,3 @@ 'use strict'

const binding = require('bindings')('binding')
const bufferAlloc = require('buffer-alloc')
const Writable = require('readable-stream/writable')
const { Writable } = require('stream')

@@ -104,7 +103,3 @@ // determine the native host endianness, the only supported playback endianness

// TODO: open async?
this.audio_handle = bufferAlloc(binding.sizeof_audio_output_t)
const r = binding.open(this.audio_handle, this.channels, this.sampleRate, format, this.device)
if (r !== 0) {
throw new Error(`open() failed: ${r}`)
}
this.audio_handle = binding.open(this.channels, this.sampleRate, format, this.device)

@@ -206,5 +201,9 @@ this.emit('open')

debug('writing %o byte chunk', b.length)
binding.write(handle, b, b.length, onwrite)
binding.write(handle, b).then(onwrite, onerror)
}
const onerror = (e) => {
this.emit('error', e)
}
const onwrite = (r) => {

@@ -211,0 +210,0 @@ debug('wrote %o bytes', r)

{
"name": "speaker",
"version": "0.4.2",
"version": "0.5.0",
"license": "MIT",

@@ -16,13 +16,11 @@ "description": "Output PCM audio data to the speakers",

"buffer-alloc": "^1.1.0",
"debug": "^3.0.1",
"nan": "^2.6.2",
"readable-stream": "^2.3.3"
"debug": "^4.0.0"
},
"devDependencies": {
"@types/node": "^10.11.4",
"mocha": "^3.5.0",
"standard": "^10.0.3"
"@types/node": "^12.12.14",
"mocha": "^6.2.2",
"standard": "^14.3.1"
},
"engines": {
"node": ">4"
"node": ">=8.6"
},

@@ -29,0 +27,0 @@ "keywords": [

@@ -11,3 +11,2 @@ /* eslint-env mocha */

const assert = require('assert')
const bufferAlloc = require('buffer-alloc')
const Speaker = require('../')

@@ -20,7 +19,7 @@

it('should export a Function', function () {
assert.equal('function', typeof Speaker)
assert.strictEqual('function', typeof Speaker)
})
it('should have an "api_version" property', function () {
assert(Speaker.hasOwnProperty('api_version'))
assert(Object.prototype.hasOwnProperty.call(Speaker, 'api_version'))
assert('number', typeof Speaker.api_version)

@@ -30,3 +29,3 @@ })

it('should have a "description" property', function () {
assert(Speaker.hasOwnProperty('description'))
assert(Object.prototype.hasOwnProperty.call(Speaker, 'description'))
assert('string', typeof Speaker.description)

@@ -36,3 +35,3 @@ })

it('should have a "module_name" property', function () {
assert(Speaker.hasOwnProperty('module_name'))
assert(Object.prototype.hasOwnProperty.call(Speaker, 'module_name'))
assert('string', typeof Speaker.module_name)

@@ -50,4 +49,4 @@ })

const s = new Speaker()
assert.equal(s.writable, true)
assert.notEqual(s.readable, true)
assert.strictEqual(s.writable, true)
assert.notStrictEqual(s.readable, true)
})

@@ -62,4 +61,4 @@

})
assert.equal(called, false)
s.write(bufferAlloc(0))
assert.strictEqual(called, false)
s.write(Buffer.alloc(0))
})

@@ -74,4 +73,4 @@

})
assert.equal(called, false)
s.end(bufferAlloc(0))
assert.strictEqual(called, false)
s.end(Buffer.alloc(0))
})

@@ -87,4 +86,4 @@

})
assert.equal(called, false)
s.end(bufferAlloc(0))
assert.strictEqual(called, false)
s.end(Buffer.alloc(0))
})

@@ -98,7 +97,7 @@

})
assert.equal(0, count)
assert.strictEqual(0, count)
s.close()
assert.equal(1, count)
assert.strictEqual(1, count)
s.close()
assert.equal(1, count)
assert.strictEqual(1, count)
done()

@@ -110,6 +109,6 @@ })

assert.equal(s.device, 'test')
assert.strictEqual(s.device, 'test')
s.on('close', done)
s.end(bufferAlloc(0))
s.end(Buffer.alloc(0))
})

@@ -137,3 +136,3 @@

speaker.once('error', (err) => {
assert.equal('invalid PCM format specified', err.message)
assert.strictEqual('invalid PCM format specified', err.message)
done()

@@ -140,0 +139,0 @@ })

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc