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

speaker

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speaker - npm Package Compare versions

Comparing version

to
0.0.8

@@ -0,1 +1,6 @@

0.0.8 / 2013-02-10
==================
- throw an Error if non-native endianness is specified
0.0.7 / 2013-01-14

@@ -2,0 +7,0 @@ ==================

@@ -6,2 +6,3 @@

var os = require('os');
var debug = require('debug')('speaker');

@@ -12,2 +13,7 @@ var binding = require('bindings')('binding');

// determine the native host endianness, the only supported playback endianness
var endianness = 'function' == os.endianness ?
os.endianness() :
'LE'; // assume little-endian for older versions of node.js
// node v0.8.x compat

@@ -34,3 +40,3 @@ if (!Writable) Writable = require('readable-stream/writable');

*
* @param {Object} options object
* @param {Object} opts options object
* @api public

@@ -68,2 +74,4 @@ */

* Calls the audio backend's `open()` function, and then emits an "open" event.
*
* @api private
*/

@@ -110,7 +118,10 @@

/**
* set given options
* Set given PCM formatting options.
*
* @param {Object} opts
* @api private
*/
Speaker.prototype._format = function (opts) {
debug('opts(%j)', opts);
debug('format(keys = %j)', Object.keys(opts));
if (null != opts.channels) {

@@ -140,2 +151,9 @@ debug('setting "channels"', opts.channels);

}
if (null == opts.endianness || endianness == opts.endianness) {
// no "endianness" specified or explicit native endianness
this.endianness = endianness;
} else {
// only native endianness is supported...
this.emit('error', new Error('only native endianness ("' + endianness + '") is supported, got "' + opts.endianness + '"'));
}
};

@@ -145,2 +163,6 @@

* `_write()` callback for the Writable base class.
*
* @param {Buffer} chunk
* @param {Function} done
* @api private
*/

@@ -195,2 +217,4 @@

* set, then they will be used over the currently set values.
*
* @api private
*/

@@ -206,2 +230,4 @@

* Calls the `flush()` bindings for the audio backend.
*
* @api private
*/

@@ -208,0 +234,0 @@

@@ -21,3 +21,3 @@ {

],
"version": "0.0.7",
"version": "0.0.8",
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",

@@ -24,0 +24,0 @@ "repository": {

node-speaker
============
### Output [PCM audio][pcm] data to the speakers
[![Build Status](https://secure.travis-ci.org/TooTallNate/node-speaker.png)](http://travis-ci.org/TooTallNate/node-speaker)

@@ -5,0 +6,0 @@

/**
* Module dependencies.
*/
var os = require('os');
var assert = require('assert');
var Speaker = require('../');
var endianness = 'function' == os.endianness ? os.endianness() : 'LE';
var opposite = endianness == 'LE' ? 'BE' : 'LE';

@@ -89,2 +96,14 @@ describe('exports', function () {

it('should not throw an Error if native endianness is specified', function () {
assert.doesNotThrow(function () {
new Speaker({ endianness: endianness });
});
});
it('should throw an Error if non-native endianness is specified', function () {
assert.throws(function () {
new Speaker({ endianness: opposite });
});
});
});