0
0

Hey, I’m having trouble with FMOD, running a *.MOD for background music. I have created a program, and tried to add background music. I run Debian Linux, with a sound card built into motherboard (a DFI NF2 something…. for AMD 3200+ XP).(I have a soundcard that i can install separately).

i sent my program to a friend(windows/ i don’t know his soundcard), and he changed the 2 locations where i entered the sound name to a “canyon.mid”. and his worked perfectly.

my code: it returns “FMOD_ERR_OUTPUT_FORMAT” and the handle remains NULL

[i:381bj8bv]

include <stdio.h>

include “fmod.h”

include “fmod_errors.h”

FMUSIC_MODULE handle=NULL;
int main()
{
int class; /
class/
int strength; /
strength/
int dexterity; /
dexterity/
int constitution; /
constitution/
int wisdom; /
wisdom/
int intelligence; /
intelligence/
int charisma; /
charisma/
char name[128];
char filename[128];
int looped1;
int looped2;
char option[128];
int dif; /
difference between remaining and choosen*/
FILE *charinfo;
int i;
i=access(“wf_medieval.mod”);
if(i==0) printf(“Sound exists\n”);

if(FSOUND_Init(44100, 32, 0) == 0) printf(“init failed!!\n”);
switch(FSOUND_GetError()) {case FMOD_ERR_NONE: printf(“FMOD_ERR_NONE”); break; case FMOD_ERR_BUSY: printf(“FMOD_ERR_BUSY”); break;case FMOD_ERR_UNINITIALIZED: printf(“FMOD_ERR_UNINITIALIZED”); break;case FMOD_ERR_INIT: printf(“FMOD_ERR_INIT”); break;case FMOD_ERR_ALLOCATED: printf(“FMOD_ERR_ALLOCATED”); break;case FMOD_ERR_PLAY: printf(“FMOD_ERR_PLAY”); break;case FMOD_ERR_OUTPUT_FORMAT: printf(“FMOD_ERR_OUTPUT_FORMAT”); break;case FMOD_ERR_COOPERATIVELEVEL: printf(“FMOD_ERR_COOPERATIVELEVEL”); break;case FMOD_ERR_CREATEBUFFER: printf(“FMOD_ERR_CREATEBUFFER”); break;case FMOD_ERR_FILE_NOTFOUND: printf(“FMOD_ERR_FILE_NOTFOUND”); break;case FMOD_ERR_FILE_FORMAT: printf(“FMOD_ERR_FILE_FORMAT”); break;case FMOD_ERR_FILE_BAD: printf(“FMOD_ERR_FILE_BAD”); break;case FMOD_ERR_MEMORY: printf(“FMOD_ERR_MEMORY”); break;case FMOD_ERR_VERSION: printf(“FMOD_ERR_VERSION”); break;case FMOD_ERR_INVALID_PARAM: printf(“FMOD_ERR_INVALID_PARAM”); break;case FMOD_ERR_NO_EAX: printf(“FMOD_ERR_NO_EAX”); break;case FMOD_ERR_CHANNEL_ALLOC: printf(“FMOD_ERR_CHANNEL_ALLOC”); break;case FMOD_ERR_RECORD: printf(“FMOD_ERR_RECORD”); break;case FMOD_ERR_MEDIAPLAYER: printf(“FMOD_ERR_MEDIAPLAYER”); break;case FMOD_ERR_CDDEVICE: printf(“FMOD_ERR_CDDEVICE”); break;}

handle=FMUSIC_LoadSong(“wf_medieval.mod”);
if(handle==NULL) printf(“\n\nhandle is still null1\n”);
FMUSIC_PlaySong(handle);
if(handle==NULL) printf(“\nhandle is still null2\n”);
printf(“Playing %s…\n”, FMUSIC_GetName(handle));

printf(“\n \nWelcome to the Realm of Impending Doom!\n\n”);
looped1 = 0;

do
{

printf(“You can now choose whether you want to load an account or create a new one.\nType \”New_Account\” to create a new account, type \”Load_Existing\” to load your already made file\n\n”);
scanf(“%s”, option);
if(strcmp(option,”New_Account”)==0)/* new character shiz*/
{

printf(“Choose a character name\n”);
scanf(“%s”, name);
printf(“Your have choosen to be called %s\n”, name);

printf(“Input Class\n \n 1=Knight 2=Mage 3=Ranger\n”);
scanf(“%d”, &class);
while(class>3 || class<1)
{
printf(“Damn you! Stop trying to cause error\n”);
printf(“Input class\n \n 1=Knight 2=Mage 3=Ranger\n”);
scanf(“%d”, &class);
}

if(class==1) printf(“You have selected to be a Knight\n”);
else if(class==2) printf(“You have selected to be a Mage\n”);
else printf(“You have selected to be a Ranger\n”);
printf(“\n”);

printf(“You have 90 points to distribute among 6 stats as you please\n \n They are Strength, Dexterity, Constitution, Wisdom, Intelligence, and Charisma\n”);
printf(“Please do accurate calculations. There are cheating precautions. It will start over if you use more or less points than you have.\n”);

looped2 = 0;
do
{
if(looped2 != 0)
{
printf(“DON’T CHEAT DAMN IT\n\n”);
printf(“Now lets try this again\n \n”);
}
printf(“Input the number of points you wish to have for Strength\n”);
scanf(“%d”, &strength);
dif = 90 – strength;
printf(“You have %d remaining stat points\n”, dif);

printf("Input the number of points you wish to have for Dexterity\n");
scanf("%d", &amp;dexterity);
dif = dif - dexterity;
printf("You have %d remaining stat points\n", dif);

printf("Input the number of points you wish to have for Consitution\n");
scanf("%d", &amp;constitution);
dif = dif - constitution;
printf("You have %d remaining stat points\n", dif);

printf("Input the number of points you wish to have for Wisdom\n");
scanf("%d", &amp;wisdom);
dif = dif - wisdom;
printf("You have %d remaining stat points\n", dif);

printf("Input the number of points you wish to have for Intelligence\n");
scanf("%d", &amp;intelligence);
dif = dif - intelligence;
printf("You have %d remaining stat points\n", dif);

printf("Input the number of points you wish to have for Charisma\n");
scanf("%d", &amp;charisma);
dif = dif - charisma;
printf("You have %d remaining stat points\n", dif);

looped2=1;

}
while((strength + dexterity + constitution + wisdom + intelligence + charisma > 90) || (strength < 0) || (dexterity < 0) || (constitution < 0) || (wisdom < 0) || (intelligence < 0) || (charisma < 0));

printf(“\n \n Good, You have finished selecting your class and stats\n \n”);
if (class==1) printf(“You are %s the Knight “, name);
else if (class==2) printf(“You are %s the Mage “, name);
else printf(“You are %s the Ranger “, name);
printf(“and you have\n %d Strength\n %d Dexterity\n %d Constitution\n %d Wisdom\n %d Intelligence\n %d Charisma\n”, strength, dexterity, constitution, wisdom, intelligence, charisma);
printf(“\n Your account\n is now being saved\n Please run this again and load.\n”);
sprintf(filename, “%s.txt”, name);

charinfo = fopen(filename, “w+b”);
fprintf(charinfo, “%s\n”, name);
fprintf(charinfo, “%d\n”, class);
fprintf(charinfo, “%d\n”, strength);
fprintf(charinfo, “%d\n”, dexterity);
fprintf(charinfo, “%d\n”, constitution);
fprintf(charinfo, “%d\n”, wisdom);
fprintf(charinfo, “%d\n”, intelligence);
fprintf(charinfo, “%d\n”, charisma);
fclose(charinfo);
looped1 = 1;
}
else if(strcmp(option,”Load_Existing”)==0)/load char shizz/
{
printf(“Please enter the name of the account you wish to open.\n”);
scanf(“%s”, filename);
strcat(filename,”.txt”);
charinfo = fopen(filename, “r+b”);
if(!charinfo) printf(“Couldn\’t access file\n”);

fscanf(charinfo, “%s”, name);

fscanf(charinfo, “%d”, &class);

fscanf(charinfo, “%d %d %d %d %d %d”, &strength, &dexterity, &constitution, &wisdom, &intelligence, &charisma);
fclose(charinfo);
if(class==1) printf(“You have loaded %s the Knight\n”, name);

else if(class==2) printf(“You have loaded %s the Mage\n”, name);

else printf(“You have loaded %s the Ranger.\n”, name);

printf(“Your stats are:\n %d strength\n %d dexterity\n %d constitution\n %d wisdom\n %d intelligence\n %d charisma\n”, strength, dexterity, constitution, wisdom, intelligence, charisma);
looped1=1;
}
else(looped1=0);
}
while(looped1==0);
FMUSIC_StopSong(handle);
FMUSIC_FreeSong(handle);
FSOUND_Close();
}
[/i:381bj8bv]

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.