Homebrew [Release] Bread Box (C64 Emulator)

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,036
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,231
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,462
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,036
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,231
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,462
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
50
XP
103
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,231
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,462
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
50
XP
103
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,231
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,462
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
  • BigOnYa @ BigOnYa:
    Surprised they never made a second one.
  • K3Nv2 @ K3Nv2:
    It takes two was their newest different theme
  • BigOnYa @ BigOnYa:
    I didn't care for that one so much, but didn't play it much either.
  • BigOnYa @ BigOnYa:
    I just played little of "Still Wakes The Deep" , just came to gamepass today, its alright, kinda creepy. I'm not usually a horror game fan, but it looks really good graphic wise, esp w 4k. I admit it made me jump a few times.
  • LNLenost @ LNLenost:
    Anyone here using the 3DS?
  • LNLenost @ LNLenost:
    do u have pretendo?
  • LNLenost @ LNLenost:
    whats ur code?
  • B @ btjunior:
    i dont have pretendo sorry
  • LNLenost @ LNLenost:
    oh ok
  • LNLenost @ LNLenost:
    well if ur console isnt modded i suggest u to mod it
  • B @ btjunior:
    also, just curius, does the freinds app still work after the shutdown?
  • LNLenost @ LNLenost:
    yes
  • B @ btjunior:
    nice
  • LNLenost @ LNLenost:
    but u cant play online games anymore :(
  • LNLenost @ LNLenost:
    i miss going in other peoples town
  • B @ btjunior:
    yeah
  • LNLenost @ LNLenost:
    i have a friend named Pineapple (@pineappleJuice hi). we played a lot the day b4 the server shutdown
  • K3Nv2 @ K3Nv2:
    I preten to know doe
  • BigOnYa @ BigOnYa:
    @LNLenost how well is the pretendo servers, you ever get kicked off games when playing online?
    +1
  • LNLenost @ LNLenost:
    @BigOnYa not always you get kicked. it happens rarely to me.
    +1
  • LNLenost @ LNLenost:
    ofc they're not great, but props to them for making this
    +1
  • LNLenost @ LNLenost:
    btw, I decided to make the nintendo support team going insane
  • LNLenost @ LNLenost:
    i told them my badges disappeared after i opened the badge arcade after the shutdown, but actually they disappeared because i opened the badge arcade w/ pretendo
  • AcuteBulbasaurappears @ AcuteBulbasaurappears:
    Hey, is there anybody who knows how to create wuhb-files? :) I would like to create forwarders for two Wii-channels: https://gbatemp.net/threads/wuhb-to-vwii-channel-request.657253/#post-10441514
    AcuteBulbasaurappears @ AcuteBulbasaurappears: Hey, is there anybody who knows how to create wuhb-files? :) I would like to create forwarders...