Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
oidos
Commits
72f78e9a
Commit
72f78e9a
authored
Apr 21, 2017
by
Aske Simon Christensen
Browse files
Rust version of additive core, for documentation
parent
9131032b
Changes
1
Hide whitespace changes
Inline
Side-by-side
synth/src/oidos_generate.rs
View file @
72f78e9a
#![allow(dead_code)]
use
std
::{
f32
,
f64
};
use
std
::
mem
::
transmute
;
use
std
::
ops
::{
Index
};
...
...
@@ -423,6 +421,28 @@ impl SoundGenerator for OidosSoundGenerator {
}
}
impl
OidosSoundGenerator
{
/// Functionally equivalent to the vectorized asm versions, but much slower.
#[allow(unused)]
fn
additive_core
(
&
mut
self
)
->
f64
{
let
mut
s
=
0f64
;
for
i
in
0
..
self
.n_partials
{
let
re
=
self
.state_re
[
i
]
*
self
.step_re
[
i
]
-
self
.state_im
[
i
]
*
self
.step_im
[
i
];
let
im
=
self
.state_re
[
i
]
*
self
.step_im
[
i
]
+
self
.state_im
[
i
]
*
self
.step_re
[
i
];
self
.state_re
[
i
]
=
re
;
self
.state_im
[
i
]
=
im
;
let
f
=
self
.filter_low
[
i
]
.min
(
self
.filter_high
[
i
])
.min
(
1.0
)
.max
(
0.0
);
self
.filter_low
[
i
]
+=
self
.f_add_low
;
self
.filter_high
[
i
]
+=
self
.f_add_high
;
s
+=
re
*
f
;
}
s
}
}
extern
"cdecl"
{
fn
supports_avx
()
->
bool
;
fn
additive_core_sse2
(
state_re
:
*
mut
f64
,
state_im
:
*
mut
f64
,
step_re
:
*
const
f64
,
step_im
:
*
const
f64
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment