Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement audio support properly, please (was: sounds play with some delay) #138

Open
DarthVernus opened this issue Nov 26, 2019 · 9 comments

Comments

@DarthVernus
Copy link

       //...
		Assets.loadSoundFromPath("impact_a.ogg", function(sound:Sound) {
			testSound = sound;
		});
	}
        //...
	function keyboardDownListener(keyCode:KeyCode)
	{
		if (testSoundAC != null)
			testSoundAC.play();
		else if (testSound != null)
			testSoundAC = Audio.play(testSound);
	}
@RobDangerous
Copy link
Member

Tested on which platform and with what version of Krom? How large is "some delay"?

@DarthVernus
Copy link
Author

~0.5s.
os: Windows 7
Krom from Kode Studio 18.11.
I know that Kha and Krom are outdated in this release. But Armory3d uses a more recent version and has the same probem. I also built latest Krom from github (for my armory3d project) and had the same problem with sound. HTML5 has less delay.

@RobDangerous
Copy link
Member

But... I disabled sound in Krom.

@DarthVernus
Copy link
Author

What do you mean?

@RobDangerous
Copy link
Member

I literally disabled sound in Krom: https://github.com/Kode/Krom/blob/master/Sources/main.cpp#L96
That's because the current implementation is just a temporary hack. You can manually activate it on the command line but I wouldn't recommend it.

@DarthVernus
Copy link
Author

Ah, that's exactly what I did.

@RobDangerous
Copy link
Member

OK. Let's move and rename.

@DarthVernus
Copy link
Author

Here is what i did:

bool enableSound = true;
               else if (strcmp(argv[i], "--nosound") == 0) {
			enableSound = false;
		}

@RobDangerous RobDangerous changed the title Krom: sounds play with some delay. Implement audio support properly, please (was: sounds play with some delay) Nov 26, 2019
@RobDangerous RobDangerous transferred this issue from Kode/Kha Nov 26, 2019
@MoritzBrueckner
Copy link
Contributor

Not sure if this belongs in a separate issue, but since my last one about loading sounds was closed in favour of this one:

(From Kode/Kha#1441)
Krom currently doesn't check whether loading a sound was successful, and in turn it crashes because it tries to dereference a null pointer. Instead, it should simply return null in that case (see armory3d/armorcore#56). I can't test Kode's version of Krom at the moment because I don't know how to handle this new node stuff, so instead I'm writing this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants