Skip to content

Commit 4e86cd3

Browse files
authored
Merge pull request #43 from superpoweredSDK/v2.6.7
Superpowered v2.6.7
2 parents 9d2b1bd + 12ff9c8 commit 4e86cd3

File tree

17 files changed

+1242
-9
lines changed

17 files changed

+1242
-9
lines changed

‎dist/Superpowered.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* eslint-disable */
2+
// @ts-nocheck
23

34
classSuperpoweredGlue{
45

5-
staticwasmCDNUrl="https://cdn.jsdelivr.net/npm/@superpoweredsdk/[email protected].6/dist/superpowered-npm.wasm"
6+
staticwasmCDNUrl="https://cdn.jsdelivr.net/npm/@superpoweredsdk/[email protected].7/dist/superpowered-npm.wasm"
67

78
niceSize(bytes){
89
if(bytes==0)return'0 byte';elseif(bytes==1)return'1 byte';
@@ -748,7 +749,7 @@ class SuperpoweredWebAudio{
748749
}.bind(node);
749750
});
750751
}else{
751-
import(/* webpackIgnore: true */url).then((processorModule)=>{
752+
import(/* webpackIgnore: true *//* viteIgnore: true */url).then((processorModule)=>{
752753
constnode=this.audioContext.createScriptProcessor(1024,2,2);
753754
node.trackLoaderID=this.Superpowered.registerTrackLoader(node);
754755
node.samplerate=this.audioContext.sampleRate;

‎dist/superpowered-npm.wasm‎

274 Bytes
Binary file not shown.

‎dist/superpowered.wasm‎

276 Bytes
Binary file not shown.

‎examples/example_effects/Superpowered.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* eslint-disable */
2+
// @ts-nocheck
23

34
classSuperpoweredGlue{
45

5-
staticwasmCDNUrl="https://cdn.jsdelivr.net/npm/@superpoweredsdk/[email protected].6/dist/superpowered-npm.wasm"
6+
staticwasmCDNUrl="https://cdn.jsdelivr.net/npm/@superpoweredsdk/[email protected].7/dist/superpowered-npm.wasm"
67

78
niceSize(bytes){
89
if(bytes==0)return'0 byte';elseif(bytes==1)return'1 byte';
@@ -748,7 +749,7 @@ class SuperpoweredWebAudio{
748749
}.bind(node);
749750
});
750751
}else{
751-
import(/* webpackIgnore: true */url).then((processorModule)=>{
752+
import(/* webpackIgnore: true *//* viteIgnore: true */url).then((processorModule)=>{
752753
constnode=this.audioContext.createScriptProcessor(1024,2,2);
753754
node.trackLoaderID=this.Superpowered.registerTrackLoader(node);
754755
node.samplerate=this.audioContext.sampleRate;

‎examples/example_guitardistortion/Superpowered.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* eslint-disable */
2+
// @ts-nocheck
23

34
classSuperpoweredGlue{
45

5-
staticwasmCDNUrl="https://cdn.jsdelivr.net/npm/@superpoweredsdk/[email protected].6/dist/superpowered-npm.wasm"
6+
staticwasmCDNUrl="https://cdn.jsdelivr.net/npm/@superpoweredsdk/[email protected].7/dist/superpowered-npm.wasm"
67

78
niceSize(bytes){
89
if(bytes==0)return'0 byte';elseif(bytes==1)return'1 byte';
@@ -748,7 +749,7 @@ class SuperpoweredWebAudio{
748749
}.bind(node);
749750
});
750751
}else{
751-
import(/* webpackIgnore: true */url).then((processorModule)=>{
752+
import(/* webpackIgnore: true *//* viteIgnore: true */url).then((processorModule)=>{
752753
constnode=this.audioContext.createScriptProcessor(1024,2,2);
753754
node.trackLoaderID=this.Superpowered.registerTrackLoader(node);
754755
node.samplerate=this.audioContext.sampleRate;

‎examples/example_pitchbend/assets/Superpowered.js‎

Lines changed: 869 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import"./Superpowered.js";
2+
3+
classMyProcessorextendsSuperpoweredWebAudio.AudioWorkletProcessor{
4+
cancelledPitchBend=true;
5+
6+
onReady(){
7+
this.player=newthis.Superpowered.AdvancedAudioPlayer(this.samplerate,2,2,0,0.501,2,false);
8+
}
9+
10+
onDestruct(){
11+
this.player.destruct();
12+
}
13+
14+
onMessageFromMainScope(message){
15+
if(message.SuperpoweredLoaded){
16+
this.player.openMemory(this.Superpowered.arrayBufferToWASM(message.SuperpoweredLoaded.buffer),false,false);
17+
this.player.play();
18+
this.sendMessageToMainScope({loaded: true});
19+
}
20+
if(typeofmessage.rate!=='undefined')this.player.playbackRate=message.rate/10000.0;
21+
if(typeofmessage.pitchShift!=='undefined')this.player.pitchShiftCents=parseInt(message.pitchShift)*100;
22+
if(typeofmessage.requestPitchBend!=='undefined')this.sendMessageToMainScope({pitchBendDetails: {currentPitchBend: this.currentPitchBend,currentPitchBendMsOffset: this.currentPitchBendMsOffset}})
23+
if(message.pitchBend)this.pitchBend=message.maxPercent!==0 ? {
24+
maxPercent: message.maxPercent,
25+
bendStretch: message.bendStretch,
26+
faster: message.faster,
27+
holdMs: message.holdMs
28+
} : undefined;
29+
}
30+
31+
processAudio(inputBuffer,outputBuffer,buffersize,parameters){
32+
if(this.pitchBend){
33+
this.player.pitchBend(this.pitchBend.maxPercent,this.pitchBend.bendStretch,this.pitchBend.faster,this.pitchBend.holdMs);
34+
this.cancelledPitchBend=false;
35+
}elseif(!this.cancelledPitchBend){
36+
this.player.endContinuousPitchBend();
37+
this.cancelledPitchBend=true;
38+
}
39+
this.currentPitchBend=this.player.getCurrentPitchBendPercent();
40+
this.currentPitchBendMsOffset=this.player.getBendOffsetMs();
41+
if(!this.player.processStereo(outputBuffer.pointer,false,buffersize,1))this.Superpowered.memorySet(outputBuffer.pointer,0,buffersize*8);
42+
}
43+
}
44+
45+
if(typeofAudioWorkletProcessor==='function')registerProcessor('MyProcessor',MyProcessor);
46+
exportdefaultMyProcessor;
1.25 MB
Binary file not shown.
Lines changed: 14 additions & 0 deletions
Loading
1.84 MB
Binary file not shown.

0 commit comments

Comments
(0)