![]() |
|
[HELP] joystick vs loadsound - Printable Version +- NaaLaa (https://www.naalaa.com/forum) +-- Forum: NaaLaa (https://www.naalaa.com/forum/forum-1.html) +--- Forum: NaaLaa 7 Questions (https://www.naalaa.com/forum/forum-3.html) +--- Thread: [HELP] joystick vs loadsound (/thread-299.html) Pages:
1
2
|
[HELP] joystick vs loadsound - 1micha.elok - 07-16-2025 Hi Marcus, Quick question — when I use sword = loadsound("sounds/sword.wav"), joyx(), joyy(), and joybutton() don’t seem to work anymore. Any idea why? I’m not sure — maybe I made a mistake in the code or left something out. Would really appreciate any help — thanks a lot! Code: set window "The Shadow Master",400,400,falseRE: [HELP] joystick vs loadsound - Marcus - 07-16-2025 (07-16-2025, 11:47 AM)1micha.elok Wrote: Hi Marcus, That sounds really, really strange I'll have a look at it tonight!Edit: I downloaded your project and tried it. Here it works as it should even when the sword sound is loaded :/ How very odd. Does the graphical window (not the console window) have focus when you use the joystick? Edit 2: Hm, joystick and sound work here even when the window doesn't have focus. You don't have any other window open that also tries to capture joystick input? Doesn't make sense that loadsound affects it anyway ... RE: [HELP] joystick vs loadsound - 1micha.elok - 07-17-2025 Don't worry Marcus... I think the problem is on my old gamepad that needs to be replaced with a new one
RE: [HELP] joystick vs loadsound - Marcus - 07-17-2025 Well, these weird bugs are usually the nastiest. There should be absolutely no connection between joystick input and sound. If one affects the other, the cause could be memory related. That is, there may be a memory management error in the code for loading sound effects. I might be writing at invalid memory locations, causing random stuff (bugs) to appear. So I'll have to inspect the sound code and see if I find something. Does it also happen if you use the n6 way of loading sounds? Code: sword = 1RE: [HELP] joystick vs loadsound - 1micha.elok - 07-17-2025 (07-17-2025, 06:12 AM)Marcus Wrote: ... unfortunately, my joystiick still doesn't like "load sound"
RE: [HELP] joystick vs loadsound - 1micha.elok - 07-17-2025 Good news !!! ![]() Though my joystick doesn't like loadsound, it likes loadimage Code: #win32RE: [HELP] joystick vs loadsound - Marcus - 07-18-2025 I can't explain the behavior. It's super weird. The audio system isn't initialized until you do something music or sound related. So when you call 'loadsound', I launch the audio thread. Yesterday I thought I was on to something, because I experienced huge slowdowns every time the audio thread started. But, nah, that was just Windows Defender (that was updated yesterday) that wanted to sniff on every N7 program's butt for an hour or so. I've looked at the code for loading audio files, and there's nothing weird in them (no memory leaks or corruption). So ... I don't know, nothing I can do about it now ![]() But if someone else experiences something similar, please tell me! There's one last test you could test though! What happens if you load the sound effect before calling 'set window', so that the audio thread is already running when the window is created (joystick input is window related)? RE: [HELP] joystick vs loadsound - johnno56 - 07-18-2025 After reading the posts about joystick/sound issues, I finally found and dusted off my old Logitech joystick, to see if I could at least replicate the problem. I ran both joystick test programs via N7, with and without loading the sound, and both programs functioned just fine. All programmed buttons displayed correctly when activated... my only issue was, the first time I ran them, the stick was not detected... turned out to be poor USB contacts after a long time of no use.... Do you need an N6 test done? RE: [HELP] joystick vs loadsound - 1micha.elok - 07-18-2025 (07-18-2025, 05:51 AM)Marcus Wrote: .... @Marcus load the sound effect before calling 'set window'....my joystick is responding well now Thanks, Marcus, could you please tell me what happened ? @Johnno, thanks for your feedback, too. RE: [HELP] joystick vs loadsound - Marcus - 07-18-2025 To be honest, I have no idea of why that worked. It was just a gut feeling. In the next release I'm going to try another way of capturing joystick input - the way I did it in n6. Hopefully that works better for you - and others. |