Homebrew [Release] Bread Box (C64 Emulator)

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,034
Country
United States
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.
 

spinal_cord

Knows his stuff
OP
Member
Joined
Jul 21, 2007
Messages
3,226
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,392
Country
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,

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,034
Country
United States
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 :)
 

spinal_cord

Knows his stuff
OP
Member
Joined
Jul 21, 2007
Messages
3,226
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,392
Country
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

rygar

Active Member
Newcomer
Joined
Nov 21, 2014
Messages
43
Trophies
0
Age
49
XP
93
Country
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)
 

spinal_cord

Knows his stuff
OP
Member
Joined
Jul 21, 2007
Messages
3,226
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,392
Country
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.
 

rygar

Active Member
Newcomer
Joined
Nov 21, 2014
Messages
43
Trophies
0
Age
49
XP
93
Country
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)?
 

XDel

Author of Alien Breed: Projekt Odamex
Member
Joined
Jul 25, 2012
Messages
2,714
Trophies
2
Age
49
Location
Another Huxleyian Dystopia
XP
3,549
Country
United States
What game is that?!

Bread Box - Frodo 3DS
c64_3ds_01-png.29016

 

ArugulaZ

Well-Known Member
Member
Joined
Sep 17, 2009
Messages
677
Trophies
1
XP
1,111
Country
United States
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.
 

spinal_cord

Knows his stuff
OP
Member
Joined
Jul 21, 2007
Messages
3,226
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,392
Country
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?
 

ArugulaZ

Well-Known Member
Member
Joined
Sep 17, 2009
Messages
677
Trophies
1
XP
1,111
Country
United States
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

General chit-chat
Help Users
  • Veho
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
    Veho @ Veho: https://youtube.com/watch?v=Y23PPkftXIY