1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 21:00:23 +01:00

Notification should show up for every function.

This commit is contained in:
kkapsner 2018-06-21 00:19:12 +02:00
parent dd1173841b
commit a41eba1dff

View File

@ -86,11 +86,11 @@
return status;
}
let notified = false;
function notifyOnce(notify){
if (!notified){
let notified = new Map();
function notifyOnce(name, notify){
if (!notified.get(name)){
notify("fakedAudioReadout");
notified = true;
notified.set(name, true);
}
}
// changed functions and their fakes
@ -99,7 +99,7 @@
object: ["AnalyserNode"],
fakeGenerator: function(prefs, notify, window, original){
return function getFloatFrequencyData(array){
notifyOnce(notify);
notifyOnce("getFloatFrequencyData", notify);
var ret = original.apply(this, window.Array.from(arguments));
fakeFloat32Array(array, window, prefs);
return ret;
@ -110,7 +110,7 @@
object: ["AnalyserNode"],
fakeGenerator: function(prefs, notify, window, original){
return function getByteFrequencyData(array){
notifyOnce(notify);
notifyOnce("getByteFrequencyData", notify);
var ret = original.apply(this, window.Array.from(arguments));
fakeUint8Array(array, window, prefs);
return ret;
@ -118,12 +118,10 @@
}
},
getFloatTimeDomainData: {
type: "readout",
getStatus: getStatus,
object: ["AnalyserNode"],
fakeGenerator: function(prefs, notify, window, original){
return function getFloatTimeDomainData(array){
notifyOnce(notify);
notifyOnce("getFloatTimeDomainData", notify);
var ret = original.apply(this, window.Array.from(arguments));
fakeFloat32Array(array, window, prefs);
return ret;
@ -134,7 +132,7 @@
object: ["AnalyserNode"],
fakeGenerator: function(prefs, notify, window, original){
return function getByteTimeDomainData(array){
notifyOnce(notify);
notifyOnce("getByteTimeDomainData", notify);
var ret = original.apply(this, window.Array.from(arguments));
fakeUint8Array(array, window, prefs);
return ret;
@ -145,7 +143,7 @@
object: ["AudioBuffer"],
fakeGenerator: function(prefs, notify, window, original){
return function getChannelData(channel){
notifyOnce(notify);
notifyOnce("getChannelData", notify);
var ret = original.apply(this, window.Array.from(arguments));
fakeFloat32Array(ret, window, prefs);
return ret;
@ -156,7 +154,7 @@
object: ["AudioBuffer"],
fakeGenerator: function(prefs, notify, window, original){
return function copyFromChannel(destination, channelNumber, startInChannel){
notifyOnce(notify);
notifyOnce("copyFromChannel", notify);
var ret = original.apply(this, window.Array.from(arguments));
fakeFloat32Array(destination, window, prefs);
return ret;
@ -167,7 +165,7 @@
object: ["BiquadFilterNode", "IIRFilterNode"],
fakeGenerator: function(prefs, notify, window, original){
return function getFrequencyResponse(frequencyArray, magResponseOutput, phaseResponseOutput){
notifyOnce(notify);
notifyOnce("getFrequencyResponse", notify);
var ret = original.apply(this, window.Array.from(arguments));
fakeFloat32Array(magResponseOutput, window, prefs);
fakeFloat32Array(phaseResponseOutput, window, prefs);