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