mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-09-25 10:51:42 +02:00
parent
53cdf8347e
commit
e47f726abb
@ -154,6 +154,7 @@
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getChannelDataAlreadyFakedArrays = new WeakMap();
|
||||||
// changed functions and their fakes
|
// changed functions and their fakes
|
||||||
scope.changedFunctions = {
|
scope.changedFunctions = {
|
||||||
getFloatFrequencyData: {
|
getFloatFrequencyData: {
|
||||||
@ -218,9 +219,12 @@
|
|||||||
return function getChannelData(channel){
|
return function getChannelData(channel){
|
||||||
return checkerWrapper(checker, this, arguments, function(args, check){
|
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||||
var {prefs, notify, window, original} = check;
|
var {prefs, notify, window, original} = check;
|
||||||
notify("fakedAudioReadout");
|
|
||||||
var ret = original.apply(this, window.Array.from(args));
|
var ret = original.apply(this, window.Array.from(args));
|
||||||
|
if (!getChannelDataAlreadyFakedArrays.get(ret)){
|
||||||
|
notify("fakedAudioReadout");
|
||||||
fakeFloat32Array(ret, window, prefs);
|
fakeFloat32Array(ret, window, prefs);
|
||||||
|
getChannelDataAlreadyFakedArrays.set(ret, true);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@ Version 0.5.8:
|
|||||||
-
|
-
|
||||||
|
|
||||||
new features:
|
new features:
|
||||||
-
|
- Added cache for getChannelData
|
||||||
|
|
||||||
fixes:
|
fixes:
|
||||||
- after reset the hidden settings and expanded views were not reset
|
- after reset the hidden settings and expanded views were not reset
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1>Audio test</h1>
|
<h1>Audio test</h1>
|
||||||
<div id="test">
|
<div id="test">
|
||||||
Hash: <span class="hash"></span><br>
|
Hashes: <ul class="hash"></ul>
|
||||||
Sum: <span class="sum"></span>
|
Sum: <span class="sum"></span>
|
||||||
<button>refresh</button>
|
<button>refresh</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
var pxi_output;
|
var pxi_output;
|
||||||
var pxi_full_buffer;
|
var pxi_full_buffer;
|
||||||
function run_pxi_fp(){
|
function run_pxi_fp(){
|
||||||
var context = new window.OfflineAudioContext(1, 44100, 44100);
|
var context = new window.OfflineAudioContext(2, 44100, 44100);
|
||||||
|
|
||||||
// Create oscillator
|
// Create oscillator
|
||||||
var pxi_oscillator = context.createOscillator();
|
var pxi_oscillator = context.createOscillator();
|
||||||
@ -44,14 +44,14 @@
|
|||||||
var copyTest = new Float32Array(44100);
|
var copyTest = new Float32Array(44100);
|
||||||
event.renderedBuffer.copyFromChannel(copyTest, 0);
|
event.renderedBuffer.copyFromChannel(copyTest, 0);
|
||||||
var getTest = event.renderedBuffer.getChannelData(0);
|
var getTest = event.renderedBuffer.getChannelData(0);
|
||||||
Promise.all([
|
var getTest2 = event.renderedBuffer.getChannelData(0);
|
||||||
crypto.subtle.digest("SHA-256", getTest),
|
var getTest3 = event.renderedBuffer.getChannelData(1);
|
||||||
crypto.subtle.digest("SHA-256", copyTest),
|
Promise.all([getTest, getTest2, getTest3, copyTest].map(function(array){
|
||||||
]).then(function(hashes){
|
return crypto.subtle.digest("SHA-256", array);
|
||||||
container.querySelector(".hash").textContent =
|
})).then(function(hashes){
|
||||||
byteArrayToHex(hashes[0]) +
|
container.querySelector(".hash").innerHTML = hashes.map(byteArrayToHex).map(function(hash){
|
||||||
" / " +
|
return "<li>" + hash + "</li>";
|
||||||
byteArrayToHex(hashes[1]);
|
}).join("");
|
||||||
});
|
});
|
||||||
var sum = 0;
|
var sum = 0;
|
||||||
for (var i = 4500; i < 5000; i += 1) {
|
for (var i = 4500; i < 5000; i += 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user