Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
my site   Message List  
Reply | Forward Message #4841 of 15019 |
RE: [gbadev] Re: Direct Sound..

Marcus wrote:

> Heres some code thats plays an 8bit sample at 16 Khz, I've currently got
it
> playing a 1 minute Prodigy Firestarter track while 4x4 offroaders is
running
> at 20FPS on the GBA unit, pretty cool..

Thanks for the code, Marcus. Works great for me too!

You might get over 20FPS if you make a small change, however:

> *(unsigned short *)TM0CNT = 0x000c3;

This enables IRQ on timer 0, which isn't necessary. Use 0x83 instead.
Otherwise, you're generating 16,000 interrupts every second, needlessly.

============

Changing the Sample Rate

Storing 0x83 into TM0CNT and 0xFFFF into TM0D sets the sample rate at
16780000 / 1024 = 16387Hz. For a different sample rate, the following
works:

Calculate X = int(16780000.0f / sample_rate + 0.5);
Set TM0D = 65536 - X
Set TM0CNT to 0x80 [no prescaling]

This gives excellent resolution for sample rate [e.g. X = 761 for 22.050Hz
which is 1/2 of CD audio rate; the resulting sample rate is 22049.93.]

Ed xxx





Mon Jul 2, 2001 3:14 am

eddie@...
Send Email Send Email

Forward
Message #4841 of 15019 |
Expand Messages Author Sort by Date

Hello, I've started a little site dedicated to my projects on the GBA : www.lifl.fr/~saugis/gba Please let me know (in private) how it sucks ;-) and what you...
6re9ouINet
gregory.saugis@...
Send Email
Jun 20, 2001
4:34 pm

Help I'm trying to do some direct sound stuff but cannot seem to get it to work as it just locks up the GBA, can anyone point out the no doubt obvious flaw in...
Marcus Lynn
marcus@...
Send Email
Jun 21, 2001
6:32 pm

Okay =) I've done a bit with dsound, so I'll look through and point out errors... see corrections below -Stephen ... From: "Marcus Lynn"...
Stephen Stair
sgstair@...
Send Email
Jun 25, 2001
2:58 pm

Thanks but I've got the Dsound stuff working fine now, just having a problem finding a way to get it to loop neatly.....
Marcus Lynn
marcus@...
Send Email
Jun 25, 2001
3:08 pm

Wanna post a working example then? Please... -pc ... a problem...
gb_feedback@...
Send Email
Jun 25, 2001
5:58 pm

Heres some code thats plays an 8bit sample at 16 Khz, I've currently got it playing a 1 minute Prodigy Firestarter track while 4x4 offroaders is running at...
Marcus Lynn
marcus@...
Send Email
Jun 26, 2001
8:12 pm

... it ... running ... Thanks for the code, Marcus. Works great for me too! ... This enables IRQ on timer 0, which isn't necessary. Use 0x83 instead. ...
Eddie Edwards
eddie@...
Send Email
Jul 2, 2001
9:50 am

... According to the docs this setting will be ignored by the DMA in sound FIFO mode. So this shouldn't matter... But never trust docs though! :) --Jim...
James Boulton
jim@...
Send Email
Jun 25, 2001
5:56 pm

... [...] Where are you guys getting these register definitions? I can't find them in any of the publically released source code.. or should I not ask? =)...
Dan Potter
bard@...
Send Email
Jul 1, 2001
3:32 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help