Comments (3)
The code in the area of this error looks like this:
var dynCall = (sig,ptr,args)=>{
var rtn = getWasmTableEntry(ptr).apply(null, args);
return rtn
}
It seems that in SDL2.audio.scriptProcessorNode.onaudioprocess, when retrieving a function from the function table, it is not found and an error is occurring.
Perhaps this change in Emscripten 3.1.46 is the reason, but I'm not sure:
The wasmTable global is now a JS library function that will only be included as needed.
Code that references wasmTable will no need to declare a dependency on it.
It can also be explictly included using -sEXPORTED_RUNTIME_METHODS=wasmTable.
I've already tried -sEXPORTED_RUNTIME_METHODS=wasmTable
option and nothing changed.
I am thinking that perhaps the callback function for audio defined on the Rust side is not registered in the wasmTable.
from pyxel.
This code is a part of audio.rs in the pyxel-platform crate.
pub trait AudioCallback {
fn update(&mut self, out: &mut [i16]);
}
extern "C" fn c_audio_callback(userdata: *mut c_void, stream: *mut u8, len: c_int) {
let audio_callback = unsafe { &*userdata.cast::<Arc<Mutex<dyn AudioCallback>>>() };
let stream: &mut [i16] =
unsafe { slice::from_raw_parts_mut(stream.cast::<i16>(), len as usize / 2) };
audio_callback.lock().update(stream);
}
pub fn start_audio(
sample_rate: u32,
num_channels: u8,
num_samples: u16,
audio_callback: Arc<Mutex<dyn AudioCallback>>,
) {
let userdata = Box::into_raw(Box::new(audio_callback)).cast();
let desired = SDL_AudioSpec {
freq: sample_rate as i32,
format: AUDIO_S16 as u16,
channels: num_channels,
silence: 0,
samples: num_samples,
padding: 0,
size: 0,
callback: Some(c_audio_callback),
userdata,
};
let mut obtained = MaybeUninit::uninit();
platform().audio_device_id =
unsafe { SDL_OpenAudioDevice(null_mut(), 0, &desired, obtained.as_mut_ptr(), 0) };
if platform().audio_device_id == 0 {
println!("PyxelWarning: Failed to initialize audio device");
}
set_audio_enabled(true);
}
c_audio_callback
is registered for SDL2 by start_audio
and should be called from JavaScript code of SDL2.audio.scriptProcessorNode.onaudioprocess, but it failed to find c_audio_callback
from Emscripten function table.
from pyxel.
With the latest Pyodide, this issue was addressed. Thank you.
from pyxel.
Related Issues (20)
- mouse_wheel never become 0 HOT 3
- Pyxel Editor crash when selecting Music Editor HOT 6
- Non pixel perfect pixels on the right side of the screen HOT 29
- Pyxel not running HOT 4
- Pyxel crash when starting edit or hello world example HOT 1
- Don't start when I ask for
- command for the terminal didn't work (pycharm) HOT 2
- Slide sound effect only works once HOT 4
- Unable to build a pyxel to exe application on a drive other than C:/ on Windows. HOT 1
- pyxel edit で音符マークを押したら music_editor.py の インデックスエラーで異常終了する。 HOT 1
- `pyxel.sqrt(0)` returns 1.7976931348623157e+308 HOT 4
- Id like to edit the game on web. HOT 3
- Drone yazılımı arıyorum HOT 1
- Please tell me your work with Pyxel (Part5) HOT 12
- New functions HOT 2
- pyxel run of .pyxapp file results in "no such file: 'filename.pyxapp.py' HOT 2
- Display Glitch with Horizontal Green Lines in ‘Hello Pyxl’ Program HOT 3
- Failed to create OpenGL context HOT 1
- How to change the window icon in Pyxel. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyxel.