- Joined
- May 9, 2014
- Messages
- 2,493
- Reaction score
- 1,524
- Trophies
- 0
- Location
- Hervey Bay, Queensland
- XP
- 1,827
- Country

Indeed. Looking forward to seeing it develop further.I think sound will be awesome. This emulator has a lot of potential.

Indeed. Looking forward to seeing it develop further.I think sound will be awesome. This emulator has a lot of potential.

If anyone is any good at audio on the 3DS, I probably need some pointers.
Code:sound_calc_buf = (int16*)linearAlloc(SAMPLE_BUF_SIZE); csndPlaySound(8, SOUND_FORMAT_16BIT | SOUND_REPEAT, SAMPLE_FREQ, 1, 0, sound_calc_buf, sound_calc_buf, SAMPLE_BUF_SIZE);
Is the above the correct way to set a sample repeating?
I'm getting awful distortion.
You guys can download the latest build and source below (also in the first post once i edit it).
I changed the file loading a little. Now it will automatically list the files on the .d64 when you select it.
To load a game, HOLD 'R' and tap the d-pad UP/DOWN until the cursor is on the line with the filename you want to load, then, while still holding 'R', hit 'A'.
As you can hear, the sound is terrible. If anyone has a clue why it sounds like that please let me know. At this point I don't know if it's a C64 issue or a 3DS issue. If anyone can tell from listening what might be the cause of the symptoms PM me or something![]()

I can't tell if this is the exploit or if it is the emulator, but... well, this:
It happens after I quit breadbox and try to load another app.



ToDo
o Better Sound
o Maybe switch off the lower screen when not used

Yes to both of them! For the lower screen switch off. I guess you can simply copy the code from handy3ds or some other emulator that has that function!

port dont flip out. do it. pleaseeeeeeeeeeeeeeeI just did a quick test, dropping the audio into a file on the SD while the emulator was running and guess what, it sounds perfect, if a little slow (probably because the emu slowed down) so the audio problem lies entirely on the 3DS side of things, not the SID emulation!
No idea where to go from here.
I just did a quick test, dropping the audio into a file on the SD while the emulator was running and guess what, it sounds perfect, if a little slow (probably because the emu slowed down) so the audio problem lies entirely on the 3DS side of things, not the SID emulation!
No idea where to go from here.

This means that the data stream is correct but the CSND service reads the data faster than the emulator can fill the buffer.
If this happens the stream ends the available new samples and starts reading the old samples written in the buffer at the previous round, than the buffer is filled again ahead of the reading point.
This result in a fast sound glitch with the same frequency of the video FPS.
It's unavoidable if the FPS is low (leaving a constant audio frequency). Modulating frequency can be worst if it change too often (I tryed it with handy3DS).
I have the fps at a constant 50 with a frameskip, and it never dips below 45 without frameskip.

Do you fill the sound just buffer before limiting the FPS with svcSleepThread()?
If you fill the buffer after the limiter, that's the problem.
--------------------- MERGED ---------------------------
And you also have to check that you start the loop only after filling the samples for the first frame.
if(draw_frame) {
TheDisplay->Update();
}
uint32 tim2 = svcGetSystemTick();
while(tim2 < tim){tim2 = svcGetSystemTick();}
tim = svcGetSystemTick() + (TICKS_PER_SEC/50);
I had this issue from the beginning, before limiting the fps, which i'm doing the following way --
Code:if(draw_frame) { TheDisplay->Update(); } uint32 tim2 = svcGetSystemTick(); while(tim2 < tim){tim2 = svcGetSystemTick();} tim = svcGetSystemTick() + (TICKS_PER_SEC/50);
if(draw_frame) {
TheDisplay->Update();
}
if (svcGetSystemTick() < tim) {
... // fill here the sound buffer with enough samples for the next frame.
while(svcGetSystemTick() < tim);
tim += (TICKS_PER_SEC/50);
} else { // a lag happened
... // handle here the sound buffer adjustment for the lag, then fill in the samples for the next frame.
tim = svcGetSystemTick() + (TICKS_PER_SEC/50);
}
... // if the sound loop is stopped, start it now!


I'll give that a shot.
In the meantime, a couple of test have revealed the the audio file that is being saved is exactly 25% of full speed. Could this be a clue to fixing it?

I've removed that for now. It wasn't much use for 99% of games anyway.@spinal_cord, Sorry to go off-topic, but I was thinking about your 3D slider-based scrolling and wondered: what are 2DS users expected to do? (I don't have one personally to check, was just curious.)