You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#1
Sound programming
Posted on: 2007/8/7 23:48
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
Hi to everyone, I'm getting almost done with my game but it doesn't have any sound yet... I don't really know nothing about waves and that stuff so like to know if there is someone out there who has made some sound programming for the VB and would like to share his code.

jorgeche
Top

#2
Re: Sound programming
Posted on: 2007/8/8 0:42
PVB Elite
Joined 2003/7/25
USA
1507 Posts
PVBCC 1stCoderContributor#3 PosterHOTY09 EntryLong Time User (15 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
I wish I had some nice code, but for the most part all of my sound programming code is really ugly. If you haven't already, read through the sound chapter in the official development manual. It's not particularly difficult to program, there's just no functionality like "play this sound" or "continuously loop this song in the background", etc. It'd be possible to make a function that does that, but nobody has AFAIK. I don't think anyone has made any functions to convert audio files to work on the VB either (like the BMP to VB converter in VIDE), so you'll have to compose your music from scratch or make a converter.

DogP
Top

#3
Re: Sound programming
Posted on: 2007/8/8 18:19
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
I plan to just output some very simple sounds... maybe when I release the code someone else or maybe myself be able to add proper sound functionality. I will really appreciate if you can share whatever you have, it would be help to know where to start, thats the way I came to understand how to display stuff in the VB.

Regards
jorgeche
Top

#4
Re: Sound programming
Posted on: 2007/8/9 0:00
PVB Elite
Joined 2003/7/25
USA
1507 Posts
PVBCC 1stCoderContributor#3 PosterHOTY09 EntryLong Time User (15 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
I just emailed you the code and app that I created... it's nothing special, but hopefully it'll help.

DogP
Top

#5
Re: Sound programming
Posted on: 2007/8/9 0:52
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
Thanks DogP I will check it out.

Regards
jorgeche
Top

#6
Re: Sound programming
Posted on: 2008/9/29 18:56
Nintendoid!
Joined 2007/8/8
Great Britain
201 Posts
CoderContributorHOTY09 EntryLong Time User (12 Years) App Coder
Here's a bit of code that plays Mario's jump effect from SMB. Boing!

Has anyone had a look to see if there are any NES/Game Boy/GBA sound tools we could convert?


// SOUND 5
#define REG_S5INT        *(vu8*)(0x01000500)
#define REG_S5LRV        *(vu8*)(0x01000504)
#define REG_S5FQL        *(vu8*)(0x01000508)
#define REG_S5FQH        *(vu8*)(0x0100050C)
#define REG_S5EV0        *(vu8*)(0x01000510)
#define REG_S5EV1        *(vu8*)(0x01000514)
#define REG_S5RAM        *(vu8*)(0x01000518)
#define REG_S5SWP        *(vu8*)(0x0100051C)

#define WAVE_RAM1        ((vu8*)0x01000000)    // array

const u8 sqrwave[]=
{    
    
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
    
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
    
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
}

void play()
{
        
REG_S5EV00xF1;
        
REG_S5EV10x41;
        
REG_S5SWP0xAF;

        
REG_S5FQL0x40;
        
REG_S5FQH0x05

        
REG_S5INT0x80// play
}

void main()
{
    
int ii;

    for(
ii=0ii<32ii++)
        
WAVE_RAM1[ii*4]= sqrwave[ii];

    
REG_S5LRV0xFF;
    
REG_S5RAM0

    while(
1)
    {
        
vbWaitFrame(1); // wait for end of drawing
        
key_poll();
        
        if(
key_hit(K_A))
            
play();
    }
}


Refs
Virtual Boy Dev Manual Section 6 - Sound Processor
http://belogic.com/gba/
http://www.coranac.com/tonc/text/sndsqr.htm
Top

#7
Re: Sound programming
Posted on: 2008/9/29 21:02
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
Hey cool!, will include it in my demo ASAP.

jorgeche
Top

#8
Re: Sound programming
Posted on: 2008/9/29 21:26
Nintendoid!
Joined 2007/8/8
Great Britain
201 Posts
CoderContributorHOTY09 EntryLong Time User (12 Years) App Coder
The frequency should probably be a bit higher, maybe 0x05A0.
Top

 Top   Previous Topic   Next Topic


Register To Post