amhndu / SimpleNES

An NES emulator in C++
GNU General Public License v3.0
4.85k stars 1.12k forks source link

Sound - APU Implementation #24

Open bugright opened 2 years ago

SuzieQQ commented 2 years ago

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 commented 2 years ago

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

mayweather911 commented 2 years ago

No description provided.

https://youtube.com/shorts/-zmK7eyZGa0?feature=share

https://youtube.com/shorts/11CiKft46-o?feature=share

https://youtube.com/shorts/441oYOeQzVA?feature=share

https://youtube.com/shorts/-3reAGq5nDA?feature=share

https://youtube.com/shorts/kLMmuRyqbto?feature=share

New test apu

amhndu commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

bugright commented 2 years ago

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 commented 2 years ago

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.