1 // Copyright 2021 Jean Pierre Cimalando
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 // SPDX-License-Identifier: Apache-2.0
19 #include "WDL/eel2/ns-eel.h"
20 #include "WDL/eel2/ns-eel-int.h"
21 #include <type_traits>
25 inline typename
std::enable_if
<std::is_integral
<T
>::value
, T
>::type
26 ysfx_eel_round(EEL_F value
)
28 return (T
)(value
+ (EEL_F
)0.0001); // same one as used in eel2 everywhere
31 //------------------------------------------------------------------------------
32 class ysfx_eel_ram_reader
{
34 ysfx_eel_ram_reader() = default;
35 ysfx_eel_ram_reader(NSEEL_VMCTX vm
, int64_t addr
);
41 const EEL_F
*m_block
= nullptr;
42 uint32_t m_block_avail
= 0;
45 //------------------------------------------------------------------------------
46 class ysfx_eel_ram_writer
{
48 ysfx_eel_ram_writer() = default;
49 ysfx_eel_ram_writer(NSEEL_VMCTX vm
, int64_t addr
);
50 bool write_next(EEL_F value
);
55 EEL_F
*m_block
= nullptr;
56 uint32_t m_block_avail
= 0;