Esempio n. 1
0
FMOD_SYSTEM *Sound::fmodSetup() {
    FMOD_SYSTEM *system;
    FMOD_RESULT result;
    unsigned int version;
    int numDrivers;
    FMOD_SPEAKERMODE speakerMode;
    FMOD_CAPS caps;
    char name[256];

    result = FMOD_System_Create(&system);
    FMODErrorCheck(result);

    result = FMOD_System_GetVersion(system, &version);
    FMODErrorCheck(result);

    result = FMOD_System_GetNumDrivers(system, &numDrivers);
    FMODErrorCheck(result);

    if (numDrivers == 0) {
        result = FMOD_System_SetOutput(system, FMOD_OUTPUTTYPE_NOSOUND);
        FMODErrorCheck(result);
    }
    else {
        result = FMOD_System_GetDriverCaps(system, 0, &caps, 0, &speakerMode);
        FMODErrorCheck(result);

        result = FMOD_System_SetSpeakerMode(system, speakerMode);
        FMODErrorCheck(result);

        if (caps & FMOD_CAPS_HARDWARE_EMULATED) {
            result = FMOD_System_SetDSPBufferSize(system, 1024, 10);
            FMODErrorCheck(result);
        }
        result = FMOD_System_GetDriverInfo(system, 0, name, 256, 0);
        FMODErrorCheck(result);

        if (strstr(name, "SigmaTel")) {
            result = FMOD_System_SetSoftwareFormat(system, 48000, FMOD_SOUND_FORMAT_PCMFLOAT, 0, 0,
                                                   FMOD_DSP_RESAMPLER_LINEAR);
            FMODErrorCheck(result);
        }
    }

    result = FMOD_System_Init(system, 100, FMOD_INIT_NORMAL, 0);

    if (result == FMOD_ERR_OUTPUT_CREATEBUFFER) {
        result = FMOD_System_SetSpeakerMode(system, FMOD_SPEAKERMODE_STEREO);
        FMODErrorCheck(result);
        result = FMOD_System_Init(system, 100, FMOD_INIT_NORMAL, 0);
    }

    FMODErrorCheck(result);

    return system;
}
Esempio n. 2
0
// this should only be called once per device
void ofMultiDeviceSoundPlayer::initializeFmodWithTargetDevice(int deviceIndex)
{
	if(!sys_Array_init[deviceIndex]){
		FMOD_System_Create(&sys_Array[deviceIndex]);
		
		int driverNum;
		FMOD_System_GetNumDrivers(sys_Array[deviceIndex], &driverNum);
		
		cout << "NUM DRIVERS : " << driverNum << endl;
		/*
		
		for(int i=0; i<driverNum; i++)
		{
			char name[256];
			FMOD_GUID *guid = new FMOD_GUID();
			FMOD_System_GetDriverInfo(sys_Array[deviceIndex], i, name, 256, guid);
		
			//printf("%d : %s\n", i, name);
		}*/
		
		FMOD_System_SetDriver(sys_Array[deviceIndex], deviceIndex);
		FMOD_System_Init(sys_Array[deviceIndex], 2000, FMOD_INIT_NORMAL, NULL);  //do we want just 32 channels?
		
		FMOD_System_GetMasterChannelGroup(sys_Array[deviceIndex], &channel_Array[deviceIndex]);
		
		sys_Array_init[deviceIndex] = true;
	}
}
Esempio n. 3
0
Sgame CreateGame(int id_map) {

    Sgame game;

    /* Creation du hero */
    Shero Heros = CreateHero(POSITION_DEPART_HEROS_X, POSITION_DEPART_HEROS_Y,id_map,"sasha",PARQUET,DIRECTION_DEPART_HEROS);
    game.hero= Heros;

    /* Demarrage du son */
    FMOD_SYSTEM *system;
    FMOD_SOUND *son;
    FMOD_System_Create(&system);
    FMOD_System_Init(system, 7, FMOD_INIT_NORMAL, NULL);
    FMOD_System_CreateSound(system, "data/music/Menutheme.mp3",  FMOD_2D | FMOD_CREATESTREAM | FMOD_LOOP_NORMAL, 0, &son);
    FMOD_Sound_SetLoopCount(son, -1);
    FMOD_System_PlaySound(system, son, NULL, 0, NULL);
    game.pokedex[9]=game.hero.pokemon[0];
    game.pokedex[9].vu=1;
    game.son = son;
    game.system = system;
    game.scenario=0;

    /* Ajout des personnages non jouables du jeu */
    addNpc(&game);

	return game;
}
Esempio n. 4
0
int sound_initialize(void)
{
    if (FMOD_System_Create(&_system) != FMOD_OK) return -1;
    if (FMOD_System_Init(_system, 2, FMOD_INIT_NORMAL | FMOD_IGNORETAGS, 0) != FMOD_OK) return -1;

    return 0;
}
Esempio n. 5
0
SoundSystem::SoundSystem()  : id_gen(1), remote_head(0), sys(0) {
#ifdef USE_FMOD    
	FMOD_RESULT r;
	r = FMOD_System_Create(&sys);
	FMOD_ERRCHECK(r);

	unsigned int version;
	r = FMOD_System_GetVersion(sys, &version);
	FMOD_ERRCHECK(r);
	if(version < FMOD_VERSION ){
		print("Error!  You are using an old version of FMOD %08x.  This program requires %08x\n", version, FMOD_VERSION);
		return;
	}
	r = FMOD_System_Init( sys, 32, FMOD_INIT_NORMAL, NULL );
	FMOD_ERRCHECK(r);
#endif
#ifdef USE_UNTZ
	UNTZ::System::initialize( 44100, 512, 0 );
#endif
#ifdef USE_OPENAL
    if(alutInit(0,NULL)==AL_FALSE) {
        print("alutInit failed! error:%s", alutGetErrorString(alutGetError()));
        assert(false);
    } else {
        print("alutInit success!");
    }
#endif    
    for(int i=0;i<elementof(sounds);i++) sounds[i] = NULL;
}
Esempio n. 6
0
// this should only be called once per device
void ofMultiDeviceSoundPlayer::initializeFmodWithTargetDevice(int deviceIndex)
{
	if(!sys_Array_init[deviceIndex]){
		FMOD_System_Create(&sys_Array[deviceIndex]);
		
		int driverNum;
		FMOD_System_GetNumDrivers(sys_Array[deviceIndex], &driverNum);
		
		
		for(int i=0; i<driverNum; i++)
		{
			char name[256];
			FMOD_System_GetDriverName(sys_Array[deviceIndex], i, name, 256);
			
			printf("%d : %s\n", i, name);
		}
		
		FMOD_System_SetDriver(sys_Array[deviceIndex], deviceIndex);
		FMOD_System_Init(sys_Array[deviceIndex], 2000, FMOD_INIT_NORMAL, NULL);  //do we want just 32 channels?
		
		FMOD_System_GetMasterChannelGroup(sys_Array[deviceIndex], &channel_Array[deviceIndex]);
		
		sys_Array_init[deviceIndex] = true;
	}
}
Esempio n. 7
0
void Audio::init(){
    FMOD_RESULT result = FMOD_System_Create(&System);

    if(result == FMOD_OK){
        FMOD_System_Init(System, 100, 0, NULL);
    }
}
Esempio n. 8
0
void		fmode(void)
{
  FMOD_SYSTEM	*system;
  FMOD_SOUND	*musique;
  FMOD_CHANNEL	*channel;
  FMOD_RESULT	resultat;
  char		*str;

  str = "./graphic/Martin Garrix - Animals.mp3";
  FMOD_System_Create(&system);
  FMOD_System_Init(system, 2, FMOD_INIT_NORMAL, NULL);
  resultat = FMOD_System_CreateSound(system, str, FMOD_SOFTWARE
				     | FMOD_2D | FMOD_CREATESTREAM, 0, &musique);
  if (resultat != FMOD_OK)
    {
      my_printf(2, "Cannot find ");
      my_printf(2, "%s", str);
      my_printf(2, ", put this file next to the executable 'corewar'");
      write(2, "\n", 1);
    }
  else
    {
      FMOD_Sound_SetLoopCount(musique, -1);
      FMOD_System_GetChannel(system, 9, &channel);
      FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL);
    }
}
Esempio n. 9
0
int sound_manager_alloc(sound_manager** target) {
	if (target == NULL) {
		debug_critical("[sound_manager_alloc] target cannot be NULL");
		return 0;
	}

	if (*target != NULL) {
		debug_warning("[sound_manager_alloc] target points to a non NULL handle, possible memory leak");
	}

	*target = h_malloc(sizeof(sound_manager));

	sound_manager* this = *target;

	this->system_handle = NULL;

	if (FMOD_System_Create(&this->system_handle) != FMOD_OK) {
		debug_critical("[sound_manager_alloc] FMOD failed to allocate sound system");
		h_free(*target);
		*target = NULL;
		return 0;
	}

	if (FMOD_System_Init(this->system_handle, HUNTER_SOUND_MANAGER_CHANNELS, 0, NULL) != FMOD_OK) {
		debug_critical("[sound_manager_alloc] failed to initialize sound system");
		h_free(*target);
		*target = NULL;
		return 0;
	}

	return 1;
}
Esempio n. 10
0
void QSPCallBacks::Init(QSPFrame *frame)
{
	m_frame = frame;
	m_volumeCoeff = 1.0;

	FMOD_System_Create(&m_sys);
	wxString soundPath(QSPTools::GetAppPath() + QSP_SOUNDPLUGINS);
	FMOD_System_SetPluginPath(m_sys, wxConvFile.cWX2MB(soundPath.c_str()));
	#ifdef __WXMSW__
		FMOD_System_SetOutput(m_sys, FMOD_OUTPUTTYPE_DSOUND);
	#elif __WXOSX__
		FMOD_System_SetOutput(m_sys, FMOD_OUTPUTTYPE_COREAUDIO);
	#else
		FMOD_System_SetOutput(m_sys, FMOD_OUTPUTTYPE_ALSA);
	#endif
	FMOD_System_Init(m_sys, 32, FMOD_INIT_NORMAL, 0);

	QSPSetCallBack(QSP_CALL_SETTIMER, (QSP_CALLBACK)&SetTimer);
	QSPSetCallBack(QSP_CALL_REFRESHINT, (QSP_CALLBACK)&RefreshInt);
	QSPSetCallBack(QSP_CALL_SETINPUTSTRTEXT, (QSP_CALLBACK)&SetInputStrText);
	QSPSetCallBack(QSP_CALL_ISPLAYINGFILE, (QSP_CALLBACK)&IsPlay);
	QSPSetCallBack(QSP_CALL_PLAYFILE, (QSP_CALLBACK)&PlayFile);
	QSPSetCallBack(QSP_CALL_CLOSEFILE, (QSP_CALLBACK)&CloseFile);
	QSPSetCallBack(QSP_CALL_SHOWMSGSTR, (QSP_CALLBACK)&Msg);
	QSPSetCallBack(QSP_CALL_SLEEP, (QSP_CALLBACK)&Sleep);
	QSPSetCallBack(QSP_CALL_GETMSCOUNT, (QSP_CALLBACK)&GetMSCount);
	QSPSetCallBack(QSP_CALL_SHOWMENU, (QSP_CALLBACK)&ShowMenu);
	QSPSetCallBack(QSP_CALL_INPUTBOX, (QSP_CALLBACK)&Input);
	QSPSetCallBack(QSP_CALL_SHOWIMAGE, (QSP_CALLBACK)&ShowImage);
	QSPSetCallBack(QSP_CALL_SHOWWINDOW, (QSP_CALLBACK)&ShowPane);
	QSPSetCallBack(QSP_CALL_OPENGAME, (QSP_CALLBACK)&OpenGame);
	QSPSetCallBack(QSP_CALL_OPENGAMESTATUS, (QSP_CALLBACK)&OpenGameStatus);
	QSPSetCallBack(QSP_CALL_SAVEGAMESTATUS, (QSP_CALLBACK)&SaveGameStatus);
}
Esempio n. 11
0
OBJECT_ID fmod_Init(VM_ID vm,TUPLE_ID locals,TUPLE_ID kw_locals)
{
	object *self = GetItem((object*)locals,0);
	unsigned int version;
    FMOD_SYSTEM *fmod_sys;
	FMOD_RESULT result;
 	result = FMOD_System_Create(&fmod_sys);
	ERRCHECK(result);

	result = FMOD_System_GetVersion(fmod_sys, &version);
	ERRCHECK(result);

	if (version < FMOD_VERSION)
	{
		printf("Error!  You are using an old version of FMOD %08x.  This program requires %08x\n", version, FMOD_VERSION);
		return 0;
	}

	result = FMOD_System_Init(fmod_sys, 32, FMOD_INIT_NORMAL, NULL);
	ERRCHECK(result);

	unicode_object *sys = CreateUnicodeObject(str_Copy("__fmod_sys__"));
	tag_object *tag = CreateTagObject(fmod_sys);
	SetAttribute(self,sys,tag);
	object *tmp =CreateEmptyObject(TYPE_NONE);
	return (tmp);	
}
Esempio n. 12
0
t_sound		*init_sound_amb(char *path)
{
  int		i;
  char		*path_sound;
  char		*tmp;
  t_sound	*sound_tab;
  FMOD_RESULT	c;

  i = -1;
  if ((sound_tab = malloc(sizeof(t_sound) * NB_SOUND_AMB_MAX)) == NULL)
    return (NULL);
  while (++i < NB_SOUND_AMB_MAX)
    {
      FMOD_System_Create(&sound_tab[i].sys);
      FMOD_System_Init(sound_tab[i].sys, 1, FMOD_INIT_NORMAL, NULL);
      tmp = my_getstr(i, "0123456789");
      path_sound = my_str_concat(tmp, FORMAT_SOUND);
      if ((c = FMOD_System_CreateSound
	   (sound_tab[i].sys, my_str_concat(path, path_sound),
	    FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0,
	    &sound_tab[i].sound)) != FMOD_OK)
	return (NULL);
      printf("[*] Sound ambiance %s load\n", path_sound);
      free(tmp);
      free(path_sound);
    }
  return (sound_tab);
}
sound_system_c::sound_system_c(const char *song_name) {
	// Init FMOD
	fmod_errorcheck(FMOD_System_Create(&fmod_system));
	fmod_errorcheck(FMOD_System_SetSoftwareFormat(fmod_system, OUTPUTRATE, FMOD_SOUND_FORMAT_PCM16, 2, 0, FMOD_DSP_RESAMPLER_LINEAR));
	fmod_errorcheck(FMOD_System_Init(fmod_system, 32, FMOD_INIT_NORMAL, 0));
	// Init song
	fmod_errorcheck(FMOD_System_CreateStream(fmod_system, song_name, FMOD_LOOP_NORMAL | FMOD_2D | FMOD_HARDWARE | FMOD_UNIQUE, 0, &music));
}
//---------------------------------------
// this should only be called once
void ofSoundPlayer::initializeFmod(){
	if(!bFmodInitialized){
		FMOD_System_Create(&sys);
		FMOD_System_Init(sys, 32, FMOD_INIT_NORMAL, NULL);  //do we want just 32 channels?
		FMOD_System_GetMasterChannelGroup(sys, &channelgroup);
		bFmodInitialized = true;
	}
}
Esempio n. 15
0
FMODSound::FMODSound(const std::string &name, const std::string &name_file, Engine::ISound::type type, int frequence)
  : _tmp(false), _name(name), _type(type), _frequence(frequence), _volume(1.0)
{
  FMOD_System_Create(&(this->_system));
  FMOD_System_Init(this->_system, 1, FMOD_INIT_NORMAL, NULL);
  FMOD_System_CreateSound(this->_system, name_file.c_str(),
			  FMOD_CREATESAMPLE, 0, &(this->_sound));
}
Esempio n. 16
0
void Init()
{
	g_nFrameCount = 0;

	FMOD_System_Create(&g_System);
	FMOD_System_Init(g_System, 32, FMOD_INIT_NORMAL, NULL);
	FMOD_System_CreateSound(g_System, "run.wav", FMOD_DEFAULT, 0, &g_Sound);
}
Esempio n. 17
0
void initMusic(void)
{
		  unsigned int      version;
		  result = FMOD_System_Create(&sys);
		  ERRCHECK(result);

		  result = FMOD_System_GetVersion(sys, &version);
		  ERRCHECK(result);

		  if (version < FMOD_VERSION)
		  {
					 return;
		  }

		  result = FMOD_System_Init(sys, 1, FMOD_INIT_NORMAL, NULL);
		  ERRCHECK(result);

		  sounds = (FMOD_SOUND **)malloc(SCNT*sizeof(FMOD_SOUND *));
		  result = FMOD_System_CreateSound(sys, "media/scienceisfun.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[0]));
		  ERRCHECK(result);
		  //		  Log("sound 1 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/concentrationenhancingmenuinitialiser.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[1]));
		  ERRCHECK(result);
		  //		  Log("sound 2 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/999999.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[2]));
		  ERRCHECK(result);
		  //		  Log("sound 3 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/thecourtesycall.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[3]));
		  ERRCHECK(result);
		  //		  Log("sound 4 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/technicaldifficulties.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[4]));
		  ERRCHECK(result);
		  //		  Log("sound 5 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/overgrowth.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[5]));
		  ERRCHECK(result);
		  //		  Log("sound 6 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/ghostofrattman.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[5]));
		  ERRCHECK(result);
		  //		  Log("sound 7 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/hauntedpanels.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[7]));
		  ERRCHECK(result);
		  //		  Log("sound 8 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/thefuturestartswithyou.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[8]));
		  ERRCHECK(result);
		  //		  Log("sound 9 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/theresheis.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[9]));
		  ERRCHECK(result);
		  //		  Log("sound 10 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/youknowher.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[10]));
		  ERRCHECK(result);
		  //		  Log("sound 11 of 12 loaded\n");
		  result = FMOD_System_CreateSound(sys, "media/thefriendlyfaithplate.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &(sounds[11]));
		  ERRCHECK(result);
		  //		  Log("sound 12 of 12 loaded\n");

		  current_track = (rand() % SCNT);
		  playMusic(current_track);
}
Esempio n. 18
0
int main(void)
{
	SDL_Surface *screen = NULL, *viseur = NULL;
	SDL_Event event;
	SDL_Rect position;
	FMOD_SYSTEM *system;
	FMOD_SOUND *tir = NULL;
	FMOD_RESULT resultat;
	int continuer = 1;

	/*Initiation de FMOD pour le tir du pistolet*/
	FMOD_System_Create(&system);
	FMOD_System_Init(system, 2, FMOD_INIT_NORMAL, NULL);

	resultat = FMOD_System_CreateSound(system,"gun_shot.mp3",FMOD_CREATESAMPLE, 0, &tir);
	if(resultat != FMOD_OK)
	{
		fprintf(stderr, "Impossible de lire gun_shot.mp3");
		exit(EXIT_FAILURE);
	}
	/*Initiation de la SDL*/
	SDL_Init(SDL_INIT_VIDEO);
	SDL_ShowCursor(SDL_DISABLE);
	screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
	SDL_WM_SetCaption("Gestion du son avec FMOD", NULL);
	viseur = IMG_Load("cible.png");

	SDL_EnableKeyRepeat(10, 10);
	while(continuer)
	{
		SDL_WaitEvent(&event);

		switch(event.type)
		{
			case SDL_QUIT:
				continuer = 0;
				break;
			case SDL_MOUSEBUTTONDOWN:
				FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, tir, 0, NULL);
				break;
			case SDL_MOUSEMOTION:
				position.x = event.motion.x - (viseur->w / 2);
				position.y = event.motion.y - (viseur->h / 2);
				break;
		}
		SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
		SDL_BlitSurface(viseur, NULL, screen, &position);
		SDL_Flip(screen);
	}

	SDL_FreeSurface(viseur);
	SDL_Quit();
	FMOD_Sound_Release(tir);
	FMOD_System_Close(system);
	FMOD_System_Release(system);

	return EXIT_SUCCESS;
}
Esempio n. 19
0
//const int& maxChannelsNumber
bool
CFModExDriver::init(const SAudioParameters&)
{

    const int maxChannelsNumber = 4;
    FMOD_RESULT result;

    result = FMOD_System_Create(&_audioSystem);

    if(result != FMOD_OK){

        //fus::ILogger::Log(fus::EWarning)
        _LOG_WARNING << "Impossible to initialize FmodEx : " << FMOD_ErrorString(result);
        return false;
    }


    unsigned int version = 0;
    getFMODExVersion(version);

    // check version is correct
    if (version < FMOD_VERSION) {
        _LOG_WARNING << "Error!  You are using an old version of FMOD " << version << ".  This program requires " << FMOD_VERSION;
        return false;
    }

    result = FMOD_System_Init(_audioSystem, maxChannelsNumber, FMOD_INIT_NORMAL, NULL);

    if(result != FMOD_OK){

        //fus::ILogger::Log(fus::EWarning)
        _LOG_WARNING << "Impossible to init audio system : " << FMOD_ErrorString(result);
        return false;
    }
    //Specify user callbacks for FMOD's internal file manipulation functions.
//        result = _audioSystem->setFileSystem(&fmodFileOpenCallback, &fmodFileCloseCallback, &fmodFileReadCallback, &fmodFileSeekCallback, 2048);
//        if (result != FMOD_OK){
//
//        }


    // update var static
    //CSound::_audioSystem = _audioSystem;

    // TODO Parametrer le volume

    FMOD_System_GetMasterChannelGroup( _audioSystem, &_masterGroup);


    // TODO
    //FMOD_System_createChannelGroup()

    //fus::ILogger::Log(fus::ENotice)
    _INFO  << "Sound System ok";
    return true;

}
Esempio n. 20
0
void Sound::Init(int _channels)
{
	s_result = FMOD_System_Create(&s_fmod_system);
	assert(s_result == FMOD_OK);
	//Initializes the system with 1 channel
	s_result = FMOD_System_Init(s_fmod_system, _channels, FMOD_INIT_NORMAL, 0);
	assert(s_result == FMOD_OK);
	FMOD_Channel_SetVolume(s_channel, 0.0f);
}
Esempio n. 21
0
void Audio::initialiser() {
	FMOD_System_Create(&_systeme);
	resultat = FMOD_System_Init(_systeme, NB_CANAUX, FMOD_INIT_NORMAL, 0);
	erreur(resultat, 1);

	for(int i = 0; i < NB_CANAUX; ++i) {
		_canaux[i] = 0;
	}
}
// SoundManager initialization (to be called before loadMusic() and playMusic())
void SoundManager::initialize(int spectrumSize)
{
	mSpectrumSize = spectrumSize;
	if (mSpectrum != 0)
		delete mSpectrum;
	mSpectrum = new float[spectrumSize];
	
	FMOD_System_Create(&mSystem);
	FMOD_System_Init(mSystem, 1, FMOD_INIT_NORMAL, 0);
}
Esempio n. 23
0
void Sound::init() {
  //create the sound system. If fails, sound is set to impossible
  result = FMOD_System_Create(&fmodsystem);
  if (result != FMOD_OK) possible = false;
  //if initialise the sound system. If fails, sound is set to impossible
  if (possible) result = FMOD_System_Init(fmodsystem, 2, FMOD_INIT_NORMAL, 0);
  if (result != FMOD_OK) possible = false;
  //sets initial sound volume (mute)
  if (possible) {FMOD_Channel_SetVolume(channel, 0.0f); printf("sadsad\n");}
}
Esempio n. 24
0
//---------------------------------------
// this should only be called once
void ofFmodSoundPlayer::initializeFmod(){
	if(!bFmodInitialized_){
		FMOD_System_Create(&sys);
		#ifdef TARGET_LINUX
			FMOD_System_SetOutput(sys,FMOD_OUTPUTTYPE_ALSA);
		#endif
		FMOD_System_Init(sys, 32, FMOD_INIT_NORMAL, NULL);  //do we want just 32 channels?
		FMOD_System_GetMasterChannelGroup(sys, &channelgroup);
		bFmodInitialized_ = true;
	}
}
Esempio n. 25
0
void    se(char *path, t_music *m)
{
  FMOD_System_Create(&m->system);
  FMOD_System_Init(m->system, 1, FMOD_INIT_NORMAL, NULL);
  if ((m->result = FMOD_System_CreateSound(m->system, path, FMOD_SOFTWARE
					   | FMOD_2D | FMOD_CREATESTREAM
					   | FMOD_LOOP_NORMAL, 0, &m->music)) != FMOD_OK)
    show_error(3);
  FMOD_Sound_SetLoopCount(m->music, 0);
  FMOD_System_PlaySound(m->system, FMOD_CHANNEL_FREE, m->music, 0, NULL);
}
Esempio n. 26
0
bool Audio::Init()
{
    if (FMOD_System_Create(&system) != FMOD_OK) {
        return false;
    }

    if (FMOD_System_Init(system,100,FMOD_INIT_NORMAL,NULL) != FMOD_OK) {
        return false;
    }

    return true;
}
Esempio n. 27
0
/**
 * @brief Initializes FMOD system.
 * Throws an exception if anything fails.
 *
 * @return Returns a pointer to the fmod shared audio
 * system if could be successfully initialized.
 **/
FMOD_SYSTEM* SoundManagerFMOD::init()
{
  // If already initialized, skip
  if( m_system )
      return m_system;

  // Some info
  LOG( "Starting shared audio subsystem..." );

  // Try to open FMOD
  FMOD_RESULT result = FMOD_System_Create( &m_system );
  // Check for unrecoverable error
  if( failedFMODResultCode( result ) )
	{
      LOG_ERROR( getFmodMessageFromCode( result ) );
			return NULL;
	}

  // Lets continue, now checking version
  unsigned int version = FMOD_VERSION;
  result = FMOD_System_GetVersion( m_system, &version );
  // Check for unrecoverable error
  if( failedFMODResultCode( result ) )
	{
      LOG_ERROR( getFmodMessageFromCode( result ) );
			return NULL;
	}

  // Should be equal to compiled version
  if( version != FMOD_VERSION )
	{
		LOG_ERROR( "Invalid FMOD library version. Check DLL file." );
	}

	
	// Set speaker mode
    result = FMOD_System_SetSpeakerMode(m_system, m_speakerMode);  


  // TODO Revise these parameters (set to default)
  result = FMOD_System_Init( m_system, 32, FMOD_INIT_NORMAL, 0 ); // Initialize FMOD.

  // Check for unrecoverable error
  if( failedFMODResultCode( result ) )
	{
      LOG_ERROR( getFmodMessageFromCode( result ) );
			return NULL;
	}

  // Ok message
  LOG( "Shared audio subsystem successfully initialized." );
  return m_system;
}
Esempio n. 28
0
int		sound_init(Sound* s)
{
    FMOD_RESULT	res;

    if (   FMOD_OK != (res = FMOD_System_Create(&s->system))
            || FMOD_OK != (res = FMOD_System_Init(s->system, 32, FMOD_INIT_NORMAL, NULL))
            || FMOD_OK != (res = FMOD_System_CreateSound(s->system, "sound/xship_shoot.wav", FMOD_SOFTWARE, 0, &s->mp3[SND_XHSIP_SHOOT]))
            || FMOD_OK != (res = FMOD_System_CreateSound(s->system, "sound/menu_open.wav", FMOD_SOFTWARE, 0, &s->mp3[SND_MENU_OPEN]))
       )
        return printf("FMOD error! (%d) %s\n", res, FMOD_ErrorString(res));
    return 0;
}
// ----------------------------------------------------------------------------
// these are global functions, that affect every sound / channel:
// ----------------------------------------------------------------------------
void ofxSoundInitialize() // this should only be called once
{
	if(!bFmodInitialized)
	{
		FMOD_System_Create(&sys);
    #ifdef TARGET_LINUX
		FMOD_System_SetOutput(sys,FMOD_OUTPUTTYPE_ALSA);
    #endif
		FMOD_System_Init(sys, 32, FMOD_INIT_NORMAL, NULL);  //do we want just 32 channels?
		FMOD_System_GetMasterChannelGroup(sys, &channelgroup);
		bFmodInitialized = true;
	}
}
Esempio n. 30
0
void Java_org_fmod_fsb_Example_cBegin(JNIEnv *env, jobject thiz)
{
	FMOD_RESULT result = FMOD_OK;

	result = FMOD_System_Create(&gSystem);
	CHECK_RESULT(result);

	result = FMOD_System_Init(gSystem, 32, FMOD_INIT_NORMAL, 0);
	CHECK_RESULT(result);

	result = FMOD_System_CreateSound(gSystem, "/sdcard/fmod/example.fsb", FMOD_DEFAULT | FMOD_LOOP_OFF, 0, &gFSB);
	CHECK_RESULT(result);
}