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

cacophony

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacophony - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

11

dist/cacophony.d.ts

@@ -1,2 +0,2 @@

import { AudioContext, IAudioBuffer, IAudioBufferSourceNode, IAudioListener, IBiquadFilterNode, IGainNode, IMediaStreamAudioSourceNode } from 'standardized-audio-context';
import { AudioContext, IAudioBuffer, IAudioBufferSourceNode, IAudioListener, IBiquadFilterNode, IGainNode, IMediaStreamAudioSourceNode, IPannerOptions } from 'standardized-audio-context';
type GainNode = IGainNode<AudioContext>;

@@ -20,2 +20,3 @@ type BiquadFilterNode = IBiquadFilterNode<AudioContext>;

loop?(loopCount?: LoopCount): LoopCount;
threeDOptions?: IPannerOptions;
}

@@ -56,3 +57,2 @@ export declare class Cacophony {

loopCount: LoopCount;
seek(time: number): void;
constructor(buffer: AudioBuffer, context: AudioContext, globalGainNode: IGainNode<AudioContext>);

@@ -64,2 +64,3 @@ preplay(): Playback[];

resume(): void;
seek(time: number): void;
set position(position: Position);

@@ -72,2 +73,3 @@ get position(): Position;

set volume(volume: number);
isPlaying(): boolean;
}

@@ -82,6 +84,8 @@ declare class Playback extends FilterManager implements BaseSound {

private buffer;
seek(time: number): void;
constructor(source: AudioBufferSourceNode, gainNode: GainNode, context: AudioContext, loopCount?: LoopCount);
handleLoop(): void;
play(): this[];
get threeDOptions(): IPannerOptions;
set threeDOptions(options: Partial<IPannerOptions>);
seek(time: number): void;
get volume(): number;

@@ -92,2 +96,3 @@ set volume(v: number);

fadeOut(time: number, fadeType?: FadeType): Promise<void>;
isPlaying(): boolean;
cleanup(): void;

@@ -94,0 +99,0 @@ loop(loopCount?: LoopCount): LoopCount;

@@ -117,5 +117,2 @@ "use strict";

class Sound extends FilterManager {
seek(time) {
this.playbacks.forEach(playback => playback.seek(time));
}
constructor(buffer, context, globalGainNode) {

@@ -161,2 +158,5 @@ super();

}
seek(time) {
this.playbacks.forEach(playback => playback.seek(time));
}
set position(position) {

@@ -192,18 +192,8 @@ this._position = position;

}
isPlaying() {
return this.playbacks.some(p => p.isPlaying());
}
}
exports.Sound = Sound;
class Playback extends FilterManager {
seek(time) {
if (!this.source || !this.buffer || !this.gainNode || !this.panner) {
throw new Error('Cannot seek a sound that has been cleaned up');
}
// Stop the current playback
this.source.stop();
// Create a new source to start from the desired time
this.source = this.context.createBufferSource();
this.source.buffer = this.buffer;
this.refreshFilters();
this.source.connect(this.panner).connect(this.gainNode);
this.source.start(0, time);
}
constructor(source, gainNode, context, loopCount = 0) {

@@ -240,2 +230,47 @@ super();

}
get threeDOptions() {
if (!this.panner) {
throw new Error('Cannot get 3D options of a sound that has been cleaned up');
}
return {
coneInnerAngle: this.panner.coneInnerAngle,
coneOuterAngle: this.panner.coneOuterAngle,
coneOuterGain: this.panner.coneOuterGain,
distanceModel: this.panner.distanceModel,
maxDistance: this.panner.maxDistance,
channelCount: this.panner.channelCount,
channelCountMode: this.panner.channelCountMode,
channelInterpretation: this.panner.channelInterpretation,
panningModel: this.panner.panningModel,
refDistance: this.panner.refDistance,
rolloffFactor: this.panner.rolloffFactor,
positionX: this.panner.positionX.value,
positionY: this.panner.positionY.value,
positionZ: this.panner.positionZ.value,
orientationX: this.panner.orientationX.value,
orientationY: this.panner.orientationY.value,
orientationZ: this.panner.orientationZ.value
};
}
set threeDOptions(options) {
if (!this.panner) {
throw new Error('Cannot set 3D options of a sound that has been cleaned up');
}
Object.entries(options).forEach(([key, value]) => {
Object.assign(this.panner, { [key]: value });
});
}
seek(time) {
if (!this.source || !this.buffer || !this.gainNode || !this.panner) {
throw new Error('Cannot seek a sound that has been cleaned up');
}
// Stop the current playback
this.source.stop();
// Create a new source to start from the desired time
this.source = this.context.createBufferSource();
this.source.buffer = this.buffer;
this.refreshFilters();
this.source.connect(this.panner).connect(this.gainNode);
this.source.start(0, time);
}
get volume() {

@@ -309,2 +344,6 @@ if (!this.gainNode) {

}
isPlaying() {
var _a;
return ((_a = this.source) === null || _a === void 0 ? void 0 : _a.context.state) === 'running';
}
cleanup() {

@@ -311,0 +350,0 @@ if (this.source) {

{
"name": "cacophony",
"version": "0.1.7",
"version": "0.1.8",
"description": "Typescript audio library with caching",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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