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

Sound - APU Implementation #24

Open
bugright opened this issue Mar 12, 2022 · 13 comments
Open

Sound - APU Implementation #24

bugright opened this issue Mar 12, 2022 · 13 comments

Comments

@bugright
Copy link

No description provided.

@SuzieQQ
Copy link
Contributor

SuzieQQ commented Mar 16, 2022

https://github.com/SuzieQQ/video-simple-nes-test-apu

here are test videos today i added apu in simple nes but it go slow i have to fix it

@mayweather911
Copy link

mayweather911 commented Mar 16, 2022

No description provided.

https://youtube.com/shorts/uqL5e0qLJFM?feature=share test 1

https://youtube.com/shorts/d2f1uBxprRM?feature=share Test 2

https://youtube.com/shorts/sVbthcnU_X0?feature=share Test 3

Sorry it's always me and that I forgot the password of the account of suzie and I stored it only in the pc

@amhndu
Copy link
Owner

amhndu commented Mar 17, 2022

I had started working on an APU a while ago but SFML, the library this uses, has no way to play/stream audio in real time. You need to generate the samples in a buffer, then play that buffer. This means a constant latency and extra synchronization which proved problematic.

@amhndu
Copy link
Owner

amhndu commented Mar 17, 2022

@mayweather911 Do you have the source somewhere? I'll take a look.
I appreciate all the work you're putting into SimpleNES but I've been super busy the past few months to focus on this project again.

@mayweather911
Copy link

I had started working on an APU a while ago but SFML, the library this uses, has no way to play/stream audio in real time. You need to generate the samples in a buffer, then play that buffer. This means a constant latency and extra synchronization which proved problematic.

As soon as I can I will publish in my fork this version
I have added the sdl2 library
And added files that I've seen many emulators use
I have almost synchronized the audio and video
But there is a reading problem from what I see because if I compile in debug it works, but a reading bug appears in some game crash.

In release mode black screen you can see that it affects this bug

@amhndu
Copy link
Owner

amhndu commented Mar 17, 2022

Depending on both sdl and SFML doesn't sound ideal, since they are both competing libraries offering similar features. Perhaps we'll just get rid of SFML. Another idea is using OpenAL directly, which SFML uses.

And added files that I've seen many emulators use
What do you mean by this?

@mayweather911
Copy link

Depending on both sdl and SFML doesn't sound ideal, since they are both competing libraries offering similar features. Perhaps we'll just get rid of SFML. Another idea is using OpenAL directly, which SFML uses.

SimpleNES ADDED APU.zip

Here is the zipper of the version with apu, in a while 'I get home and upload it to github.

I was inquiring about OpenAL
It seems good

@mayweather911
Copy link

Depending on both sdl and SFML doesn't sound ideal, since they are both competing libraries offering similar features. Perhaps we'll just get rid of SFML. Another idea is using OpenAL directly, which SFML uses.

And added files that I've seen many emulators use
What do you mean by this?

Ah compile in debug mode to make it work, there is a bug in the apu to solve from black screen in the release

@SuzieQQ
Copy link
Contributor

SuzieQQ commented Mar 17, 2022

Depending on both sdl and SFML doesn't sound ideal, since they are both competing libraries offering similar features. Perhaps we'll just get rid of SFML. Another idea is using OpenAL directly, which SFML uses.

And added files that I've seen many emulators use
What do you mean by this?

https://github.com/SuzieQQ/SimpleNES

Added APU

@amhndu
Copy link
Owner

amhndu commented Mar 18, 2022

That seems to rely too much on Blargg's implementation, which i honestly think is against the point of this emulator. Let's try not to copy other emulators code. Maybe we can try doing an implementation of a realtime sound queue based on OpenAL and then use that for the rest of the APU. I'll try to experiment with OpenAL tonight

@amhndu amhndu changed the title why is no sound? Sound Mar 18, 2022
@amhndu amhndu changed the title Sound Sound - APU Implementation Mar 18, 2022
@bugright
Copy link
Author

That seems to rely too much on Blargg's implementation, which i honestly think is against the point of this emulator. Let's try not to copy other emulators code. Maybe we can try doing an implementation of a realtime sound queue based on OpenAL and then use that for the rest of the APU. I'll try to experiment with OpenAL tonight

great work

@mayweather911
Copy link

That seems to rely too much on Blargg's implementation, which i honestly think is against the point of this emulator. Let's try not to copy other emulators code. Maybe we can try doing an implementation of a realtime sound queue based on OpenAL and then use that for the rest of the APU. I'll try to experiment with OpenAL tonight

Yes in fact I said that because I have seen many emulators use these files

Great, I'll try to do something with the library you mentioned, thanks for everything you do.

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

4 participants