gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > Using the Bios buildin sound driver

#4379 - I.C.E - Sat Mar 29, 2003 9:52 am

I tried using the builtin sound driver in BIOS but i failed. Is there any sample source code or tutorials using and maybe explaining the calls? I have taken the structures directly from the CowBite document:

Code:

typedef struct tSoundArea {
     u32 ident;           //Flag the system checks to see if the work area has been
                          //initialized/currently being accessed.
     vu8 DmaCount;        //User access prohibited
     u8  reverb;          //Variable for applying reverb effects to direct sound
     u16 d1;              //User access prohibited
     void (*func)();      //User access prohibited
     int intp;            //User access prohibited
     void* NoUse;         //User access prohibited
     SoundChannel vchn[MAX];     //Array of Direct Sound channel structures.
     s8 pcmbuf[PCM_BF*2]; //??
} SoundArea;

typedef struct tSoundChannel {
     u8 sf;     //Channel status.  When 0 sound it is stopped.  To start sound, set other
                //parameters and then write 0x80h.  Logical OR 0x40 for a key-off, or
                //write zero for a pause. The use of other bits is prohibited.
     u8 r1;     //User access prohibited
     u8 rv;     //Sound volume output to right side
     u8 lv;     //Sound volume output to left side
     u8 at;     //The attack value of the envelope.
     u8 de;     //The decay value of the envelope.
     u8 su;     //The sustain value of the envelope.
     u8 re;     //The release value of the envelope. Key-off to enter this state.
     u8 r2[4];  //User access prohibited
     u32 fr;    //The frequency of the produced sound.
     WaveData*  wp;     //Pointer to the sound's waveform data.
     u32 r3[6];  //  User access prohibited
     u8 r4[4];   //User access prohibited
} SoundChannel;

typedef struct tWaveData {
     u16 type;   //Indicates the data type. This is currently not used.
     u16 stat;   //0 - non-looped 0x4000 - forward loop
     u32 freq;   //Frequency.
     u32 loop;   //Loop pointer (start of loop)
     u32 size;   //Number of samples (end position)
     s8 data[];  //The actual waveform data. Takes (number of samples+1)bytes of 8bit
                 //signed linear uncompressed data. The last byte is zero for a non-looped
                 //waveform, and the same value as the loop pointer data for a looped waveform.
} WaveData;


But I havn't understand everything. What is pcmbuf[] for? What are the "User access prohibited" fields for?

I have called IRQ 0x1a once and then i call 0x1d and 0x1c in my vblank irq handler.[/quote]
_________________
To this day, many C programmers believe that "strong typing" just means pounding extra hard on the keyboard.
- Peter van der Linden

#4387 - DekuTree64 - Sat Mar 29, 2003 4:24 pm

I was trying to get it to work the other day, but it never seemed to do anything, so I tried it on hardware, and it just made the screen go reddish color, and made lots of noise. Which I guess meant it was working, but maybe it was configured wrong and locked it up so the VBL interrupt was never happening.
But I think that means VBA doesn't support it, and since I do most of my testing with VBA, I decided to go back to working on my own mixer (besides, I've heard the BIOS sound driver is slow).
But if you ever manage to get it working, let me know cause I'd still like to try it out^^