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.18 to 0.1.19

4

dist/cacophony.d.ts

@@ -54,2 +54,3 @@ import { AudioContext, IAudioBuffer, IAudioBufferSourceNode, IAudioListener, IBiquadFilterNode, IGainNode, IMediaElementAudioSourceNode, IMediaStreamAudioSourceNode, IPannerOptions } from 'standardized-audio-context';

export declare class Sound extends FilterManager implements BaseSound {
url: string;
buffer: IAudioBuffer;

@@ -61,3 +62,3 @@ context: AudioContext;

loopCount: LoopCount;
constructor(buffer: AudioBuffer, context: AudioContext, globalGainNode: IGainNode<AudioContext>);
constructor(url: string, buffer: AudioBuffer, context: AudioContext, globalGainNode: IGainNode<AudioContext>);
preplay(): Playback[];

@@ -86,2 +87,3 @@ play(): Playback[];

private buffer?;
playing: boolean;
constructor(source: SourceNode, gainNode: GainNode, context: AudioContext, loopCount?: LoopCount);

@@ -88,0 +90,0 @@ handleLoop(): void;

@@ -26,6 +26,6 @@ "use strict";

if (bufferOrUrl instanceof AudioBuffer) {
return Promise.resolve(new Sound(bufferOrUrl, this.context, this.globalGainNode));
return Promise.resolve(new Sound("", bufferOrUrl, this.context, this.globalGainNode));
}
const url = bufferOrUrl;
return cache_1.CacheManager.getAudioBuffer(url, this.context).then(buffer => new Sound(buffer, this.context, this.globalGainNode));
return cache_1.CacheManager.getAudioBuffer(url, this.context).then(buffer => new Sound(url, buffer, this.context, this.globalGainNode));
});

@@ -50,4 +50,5 @@ }

return __awaiter(this, void 0, void 0, function* () {
const audio = new Audio(url);
audio.crossOrigin = 'anonymous';
const audio = new Audio();
audio.src = url;
audio.preload = "auto";
audio.load();

@@ -133,4 +134,5 @@ // we have the audio, let's make a buffer source node out of it

class Sound extends FilterManager {
constructor(buffer, context, globalGainNode) {
constructor(url, buffer, context, globalGainNode) {
super();
this.url = url;
this.playbacks = [];

@@ -217,2 +219,3 @@ this._position = [0, 0, 0];

this.currentLoop = 0;
this.playing = false;
this.loopCount = loopCount;

@@ -245,4 +248,9 @@ this.source = source;

this.currentLoop++;
this.play();
if (this.playing) {
this.play();
}
}
else {
this.playing = false;
}
}

@@ -259,2 +267,3 @@ play() {

}
this.playing = true;
return [this];

@@ -298,2 +307,3 @@ }

}
const playing = this.isPlaying();
// Stop the current playback

@@ -305,3 +315,5 @@ this.stop(); // Create a new source to start from the desired time

this.source.connect(this.panner).connect(this.gainNode);
this.source.start(0, time);
if (playing) {
this.source.start(0, time);
}
}

@@ -382,4 +394,6 @@ get volume() {

isPlaying() {
var _a;
return ((_a = this.source) === null || _a === void 0 ? void 0 : _a.context.state) === 'running';
if (!this.source) {
throw new Error('Cannot check if a sound is playing that has been cleaned up');
}
return this.playing;
}

@@ -429,2 +443,5 @@ cleanup() {

}
if (!this.isPlaying()) {
return;
}
if ('stop' in this.source) {

@@ -437,2 +454,3 @@ this.source.stop();

}
this.playing = false;
}

@@ -439,0 +457,0 @@ pause() {

{
"name": "cacophony",
"version": "0.1.18",
"version": "0.1.19",
"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