Page 1 of 1

Cleaner Database

PostPosted: Sat Mar 06, 2010 9:23 pm
by Hblade
You can load sounds / music from a different location, such as an "Audio" folder using this.

heres the straight code:

Make 3 variables called :
SoundLocation(string)
MusicLocation(string)
soundvol(real)

Then put this code in Global Code
Code: Select all
#define HIGH 0
#define MEDIUM 1
#define LOW 2
#define LEFT -1
#define MIDDLE 0
#define RIGHT 1
void playBGM(char *fileName, int Priority)
{
    sprintf(MusicLocation, "Audio/Music/%s", fileName);
    switch(Priority)
    {
        case 0:
        PlayMusic2(MusicLocation, musicvol, 0, HIGH_PRIORITY_MUSIC);
        break;
        case 1:
        PlayMusic2(MusicLocation, musicvol, 0, MEDIUM_PRIORITY_MUSIC);
        break;
        case 2:
        PlayMusic2(MusicLocation, musicvol, 0, MEDIUM_PRIORITY_MUSIC);
        break;
    }
}

void playSE(char *fileName)
{
    sprintf(SoundLocation, "Audio\\Sounds\\%s", fileName);
    PlaySound2(SoundLocation, soundvol, 1, 0.000000);
}


The Left, Middle, and Right definitions arn't used yet.

To call this function, simply:

playBGM("Filename.ogg", HIGH);

HIGH means High Priority.

playSE("File name.wav");

Plays a sound effect.

Look in the code to change the directory of your music / sound files.

Demo:
Clean Database.zip
(1012.77 KiB) Downloaded 42 times


The reason the demo is so big in file size is because of the fact that it has audio files in it :3