Homebrew [Release] Bread Box (C64 Emulator)

  • Thread starter Thread starter spinal_cord
  • Start date Start date
  • Views Views 105,054
  • Replies Replies 450
  • Likes Likes 46
OK, I need a little help with the sound. I've managed to get the quality to where I want it (good), however I seem to be filling the buffer incorrectly. The attached build uses the following code to update the sound, have a listen ant tell me where I've gone wrong (please)...

Code:
// CALC_FREQ = 50
// TPS = ticks per second = 268123480   
// sample_length = 44100 = 1 second   
  
    int divide = 50;
    thisTime = svcGetSystemTick();
    if (oldTime < thisTime){
        oldTime = thisTime + (TPS/CALC_FREQ); // 50 times per second
        if(showMenu != 1 && filesGot != 1){
            calc_buffer(sound_calc_buf + offset, (sample_length/divide)*2); // 2 50ths of a second of sound
            offset += (sample_length/divide); // increment by 50th of sample length
            if(offset >= sample_length) offset -= sample_length;
        }else{
            memset(sound_calc_buf, 0, sample_length);
        }
    }
The ticks per second for sound do not appear to be the same as the system clock. I experienced quite a bit of drift using the system value. I used 268111856LL instead and it stays synced for much longer. Unfortunately it is still not perfect.
 
The ticks per second for sound do not appear to be the same as the system clock. I experienced quite a bit of drift using the system value. I used 268111856LL instead and it stays synced for much longer. Unfortunately it is still not perfect.

I've just ran a simple test, checking the ticks for 98 seconds (was 100 but the first two were crazy numbers) and averaged it out at 268123324, which is currently running for around 4 minutes before going out of sync. however when it does, it lasts about 12 seconds. If only I could tell if that number should be higher or lower :-(

I'm not sure if there's any way to tell if the sound cursor is catching up to the timer or if the timer is catching up to the sound cursor.
 
Last edited by spinal_cord,
I've just ran a simple test, checking the ticks for 98 seconds (was 100 but the first two were crazy numbers) and averaged it out at 268123324, which is currently running for around 4 minutes before going out of sync. however when it does, it lasts about 12 seconds. If only I could tell if that number should be higher or lower :-(

I'm not sure if there's any way to tell if the sound cursor is catching up to the timer or if the timer is catching up to the sound cursor.
I think it probably comes down to the fact that csnd is not really suitable for this type of use. It looks like dsp is much better suited to the task as you can query the sample position. In firmware 4.5 and lower you used to be able to get the sample position with csnd too but then it started always returning 0 - I think we should complain to Nintendo :)
 
Latest version uploaded. Like I said in the above post, the sound should be ok for about 4 minutes then will sound awful for about 12 seconds, then you're good for another 4 minutes again. Unfortunately that's the state of 3ds audio right now.
 
  • Like
Reactions: SLiV3R
Thanks for adding quick scrolling through game files.

Other feature requests:
1. Support for sleep mode when lid is closed.
2. Auto load feature to pre trigger auto reset feature (currently have to reset manually before loading new game)
 
Thanks for adding quick scrolling through game files.

Other feature requests:
1. Support for sleep mode when lid is closed.
2. Auto load feature to pre trigger auto reset feature (currently have to reset manually before loading new game)

Sleep is a good idea, I'll have to look into that. I had an awful lot of trouble getting the emulator to pause for menus (that's why it doesn't) but it's something I'll be working on.
As for auto reset, I had that feature in there, but for some reason the bloody thing kept crashing so I took it out again.
 
Sleep is a good idea, I'll have to look into that. I had an awful lot of trouble getting the emulator to pause for menus (that's why it doesn't) but it's something I'll be working on.
As for auto reset, I had that feature in there, but for some reason the bloody thing kept crashing so I took it out again.
Thanks for your hard work. Emulator is feeling more and more mature. I am really enjoying it.

Is auto load tape files a feature yet (don't have 3DS with me to check)?
 
What game is that?!

Bread Box - Frodo 3DS
c64_3ds_01-png.29016

 
Wizard of Wor is an early game for the Commodore 64, based on a Midway arcade title. It was originally released as a cartridge but was converted to disc by hackers. I don't know if that has anything to do with why it's not working properly, but there's a lot of unpleasant noise where sound effects should be. If the developer would like more information, please contact me via private message.
 
Wizard of Wor is an early game for the Commodore 64, based on a Midway arcade title. It was originally released as a cartridge but was converted to disc by hackers. I don't know if that has anything to do with why it's not working properly, but there's a lot of unpleasant noise where sound effects should be. If the developer would like more information, please contact me via private message.

If that's the weird pac-man style maze game thing, it seems alright to me. There's a little crackling on one of the lower warbles but everything else sounds ok. Have you tried a different version?
 
Maybe I should. I'll look into it.

EDIT: Nope, I've tried four different versions and I get the same results. Lots of static and garbling. This is how the game sounds on a Commodore 64:



But of course, I could always play the game in MAME instead, which would probably be a better idea anyway. Whoops!
 
Last edited by ArugulaZ,

Site & Scene News

Popular threads in this forum