improved android code + fixes in bw_ppm and bw_rand
This commit is contained in:
parent
13659d9aad
commit
6d92e83b57
1
TODO
1
TODO
@ -101,6 +101,7 @@ build system:
|
||||
* single header(s)
|
||||
* cross compile (rpi etc.)
|
||||
* consider tuist (https://tuist.io/), bazel (https://bazel.build/), pants (https://www.pantsbuild.org/), buck (https://buck2.build/), please (https://please.build/index.html) for mobile apps
|
||||
* homogenize android and ios common code (e.g., same index)
|
||||
|
||||
--
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class MainActivity extends Activity {
|
||||
|
||||
@JavascriptInterface
|
||||
public void setParameter(int i, float v) {
|
||||
nativeSetParameter(i, v * 0.001f);
|
||||
nativeSetParameter(i, v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ public class MainActivity extends Activity {
|
||||
|
||||
@JavascriptInterface
|
||||
public void setParameter(int i, float v) {
|
||||
nativeSetParameter(i, v * 0.001f);
|
||||
nativeSetParameter(i, v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<script type="text/javascript" src="config.js"></script>
|
||||
<script type="text/javascript">
|
||||
var hasAudioPermission = true;
|
||||
@ -75,7 +76,7 @@ window.onload = function () {
|
||||
let index = i;
|
||||
range.addEventListener("input",
|
||||
function (ev) {
|
||||
Android.setParameter(index, ev.target.value * 1000);
|
||||
Android.setParameter(index, parseFloat(ev.target.value));
|
||||
});
|
||||
}
|
||||
div.appendChild(range);
|
||||
@ -108,6 +109,7 @@ function gotAudioPermission() {
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
body {
|
||||
|
@ -33,6 +33,8 @@
|
||||
* <li>Version <strong>0.6.0</strong>:
|
||||
* <ul>
|
||||
* <li>Removed dependency on bw_config.</li>
|
||||
* <li>Fixed bug by forcing <code>-INFINITY</code> output when signal
|
||||
* level is below -600 dB.</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>Version <strong>0.5.0</strong>:
|
||||
@ -200,7 +202,7 @@ static inline void bw_ppm_update_coeffs_audio(bw_ppm_coeffs *BW_RESTRICT coeffs)
|
||||
|
||||
static inline float bw_ppm_process1(const bw_ppm_coeffs *BW_RESTRICT coeffs, bw_ppm_state *BW_RESTRICT state, float x) {
|
||||
const float yl = bw_env_follow_process1(&coeffs->env_follow_coeffs, &state->env_follow_state, x);
|
||||
const float y = yl > 0.f ? bw_lin2dBf_3(yl) : -INFINITY;
|
||||
const float y = yl >= 1e-30f ? bw_lin2dBf_3(yl) : -INFINITY; // -600 dB is quiet enough
|
||||
state->y_z1 = y;
|
||||
return y;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@
|
||||
* <ul>
|
||||
* <li>Added debugging code.</li>
|
||||
* <li>Removed dependency on bw_config.</li>
|
||||
* <li>Fixed harmless warning in <code>bw_randu32()</code>.</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>Version <strong>0.2.0</strong>:
|
||||
@ -95,7 +96,7 @@ static inline uint32_t bw_randu32(uint64_t *BW_RESTRICT state) {
|
||||
// Permuted Congruential Generator,
|
||||
// taken from https://nullprogram.com/blog/2017/09/21/
|
||||
*state = *state * 0x9b60933458e17d7d + 0xd737232eeccdf7ed;
|
||||
return *state >> (29 - (*state >> 61));
|
||||
return (uint32_t)(*state >> (29 - (*state >> 61)));
|
||||
}
|
||||
|
||||
static inline float bw_randf(uint64_t *BW_RESTRICT state) {
|
||||
|
Loading…
Reference in New Issue
Block a user