當前位置: 首頁>>代碼示例>>C++>>正文


C++ FMOD_System_Init函數代碼示例

本文整理匯總了C++中FMOD_System_Init函數的典型用法代碼示例。如果您正苦於以下問題:C++ FMOD_System_Init函數的具體用法?C++ FMOD_System_Init怎麽用?C++ FMOD_System_Init使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了FMOD_System_Init函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: FMOD_System_Create

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;
}
開發者ID:andreisergiu98,項目名稱:squarly-hoop,代碼行數:55,代碼來源:Sound.cpp

示例2: CreateGame

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;
}
開發者ID:CedricPortaneri,項目名稱:Pokemon,代碼行數:27,代碼來源:game.c

示例3: sound_initialize

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;
}
開發者ID:SailorOnDaTea,項目名稱:kissplayer,代碼行數:7,代碼來源:sound.cpp

示例4: id_gen

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;
}
開發者ID:kengonakajima,項目名稱:moyai,代碼行數:29,代碼來源:SoundSystem.cpp

示例5: FMOD_System_Create

// 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;
	}
}
開發者ID:cdj,項目名稱:Alamo,代碼行數:26,代碼來源:ofMultiDeviceSoundPlayer.cpp

示例6: FMOD_System_Create

void Audio::init(){
    FMOD_RESULT result = FMOD_System_Create(&System);

    if(result == FMOD_OK){
        FMOD_System_Init(System, 100, 0, NULL);
    }
}
開發者ID:William8915,項目名稱:QSanguosha,代碼行數:7,代碼來源:audio.cpp

示例7: fmode

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);
    }
}
開發者ID:MaddDogg0001,項目名稱:Corewar,代碼行數:27,代碼來源:fmod.c

示例8: sound_manager_alloc

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;
}
開發者ID:metredigm,項目名稱:hunter,代碼行數:32,代碼來源:audio.c

示例9: FMOD_System_Create

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);
}
開發者ID:Nesles,項目名稱:qsp,代碼行數:34,代碼來源:callbacks_gui.cpp

示例10: fmod_Init

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);	
}
開發者ID:pez2001,項目名稱:sVimPy,代碼行數:27,代碼來源:fmod_wrapper.c

示例11: return

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);
}
開發者ID:Frozenhorns,項目名稱:project,代碼行數:28,代碼來源:sound_amb.c

示例12: fmod_errorcheck

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));
}
開發者ID:Anaatti,項目名稱:FMOD-music-visualizer,代碼行數:8,代碼來源:sound_system.cpp

示例13: FMOD_System_Create

//---------------------------------------
// 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;
	}
}
開發者ID:LeonFedotov,項目名稱:L.A.S.E.R.-TAG-GRL,代碼行數:10,代碼來源:ofSoundPlayer.cpp

示例14: _tmp

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));
}
開發者ID:antiqe,項目名稱:RType,代碼行數:8,代碼來源:FMODSound.cpp

示例15: Init

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);
}
開發者ID:codeboxgit,項目名稱:Game,代碼行數:8,代碼來源:Basic.cpp


注:本文中的FMOD_System_Init函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。