• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Mix_AllocateChannels函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Mix_AllocateChannels函数的典型用法代码示例。如果您正苦于以下问题:C++ Mix_AllocateChannels函数的具体用法?C++ Mix_AllocateChannels怎么用?C++ Mix_AllocateChannels使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Mix_AllocateChannels函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sound_mix_init

/**
 * @brief Initializes the sound subsystem.
 *
 *    @return 0 on success.
 */
int sound_mix_init (void)
{
   SDL_InitSubSystem(SDL_INIT_AUDIO);
   if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT , 2, 1024) < 0) {
      WARN("Opening Audio: %s", Mix_GetError());
      DEBUG();
      return -1;
   }
   Mix_AllocateChannels(SOUND_CHANNEL_MAX);

   /* Reset some variables. */
   group_pos = 0;

   /* Debug magic. */
   print_MixerVersion();

   /* Finish function. */
   Mix_ChannelFinished( voice_mix_markStopped );

   return 0;
}
开发者ID:Arakash,项目名称:naev,代码行数:26,代码来源:sound_sdlmix.c


示例2: init_sound

bool init_sound() {
    LOG_AUDIO << "Initializing audio...\n";
    if(SDL_WasInit(SDL_INIT_AUDIO) == 0)
        if(SDL_InitSubSystem(SDL_INIT_AUDIO) == -1)
            return false;

    if(!mix_ok) {
        if(Mix_OpenAudio(preferences::sample_rate(), MIX_DEFAULT_FORMAT, 2, preferences::sound_buffer_size()) == -1) {
            mix_ok = false;
            ERR_AUDIO << "Could not initialize audio: " << Mix_GetError() << "\n";
            return false;
        }

        mix_ok = true;
        Mix_AllocateChannels(n_of_channels);
        Mix_ReserveChannels(n_reserved_channels);

        channel_chunks.clear();
        channel_chunks.resize(n_of_channels, NULL);
        channel_ids.resize(n_of_channels, -1);

        Mix_GroupChannel(bell_channel, SOUND_BELL);
        Mix_GroupChannel(timer_channel, SOUND_TIMER);
        Mix_GroupChannels(source_channel_start, source_channel_last, SOUND_SOURCES);
        Mix_GroupChannel(UI_sound_channel, SOUND_UI);
        Mix_GroupChannels(n_reserved_channels, n_of_channels - 1, SOUND_FX);

        set_sound_volume(preferences::sound_volume());
        set_UI_volume(preferences::UI_volume());
        set_music_volume(preferences::music_volume());
        set_bell_volume(preferences::bell_volume());

        Mix_ChannelFinished(channel_finished_hook);

        LOG_AUDIO << "Audio initialized.\n";

        play_music();
    }
    return true;
}
开发者ID:RushilPatel,项目名称:BattleForWesnoth,代码行数:40,代码来源:sound.cpp


示例3: SDL_Log

Sound::Sound() {
	
	if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
        SDL_Log("Unable to initialize SDL: %s", SDL_GetError());
        return;
    }

	if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 1024) == -1) {
		printf("%s", Mix_GetError());
	}
	for(int i = 0; i < nbChannelSound; i++){
		activeChannel[i] = false;
	}
	menu = Mix_LoadMUSType_RW(SDL_RWFromMem(music_menu_mp3, music_menu_mp3_len), MUS_MP3, 0);
	battle = Mix_LoadMUSType_RW(SDL_RWFromMem(music_battle_mp3, music_battle_mp3_len), MUS_MP3, 0);

	bipSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_bip_wav, sound_bip_wav_len), 0);
	bombeBounceSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_bounce_wav, sound_bounce_wav_len), 0);
	playerBurnSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_burn_wav, sound_burn_wav_len), 0);
	cancelSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_cancel_wav, sound_cancel_wav_len), 0);
	endSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_end_wav, sound_end_wav_len), 0);
	fireSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_fire_wav, sound_fire_wav_len), 0);
	hole1Sound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_hole1_wav, sound_hole1_wav_len), 0);
	hole2Sound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_hole2_wav, sound_hole2_wav_len), 0);
	hole3Sound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_hole3_wav, sound_hole3_wav_len), 0);
	playerKickSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_kick_wav, sound_kick_wav_len), 0);
	louisSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_louis_wav, sound_louis_wav_len), 0);
	mineSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_mine_wav, sound_mine_wav_len), 0);
	teleporterCloseSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_teleporter_close_wav, sound_teleporter_close_wav_len), 0);
	teleporterOpenSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_teleporter_open_wav, sound_teleporter_open_wav_len), 0);
	validSound = Mix_LoadWAV_RW(SDL_RWFromMem(sound_valide_wav, sound_valide_wav_len), 0);

	Mix_PlayMusic(menu, -1);
	Mix_VolumeMusic (MIX_MAX_VOLUME);
	Mix_AllocateChannels(nbChannelSound);
	Mix_Volume(0, MIX_MAX_VOLUME / 2);
	Mix_Volume(3, MIX_MAX_VOLUME / 2);

	mineOffsetChannel = 14;
}
开发者ID:alexis-puska,项目名称:lr-multi-bomberman,代码行数:40,代码来源:Sound.cpp


示例4: audio_initialize

void audio_initialize(int soundMax, int musicMax, int pakMax)
{
	int flags=MIX_INIT_OGG;
	if(soundMax <= 0 || musicMax <= 0)
	{
		slog("cannot initialize for 0 sounds or 0 musics");
		return;
	}
	if(Mix_Init(flags) != flags)
	{
		slog("Not initialized for ogg");
		return;
	}
	if(Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096) != 0)
	{
		slog("failed to open audio");
		return;
	}
	atexit(audio_close_lists);

	if(Mix_AllocateChannels(5) != 5)
	{
		slog("unable to allocate enough channels");
		return;
	}

	musicList = (Music *) malloc (sizeof (Music) * musicMax);
	soundList = (Sound *) malloc (sizeof (Sound) * soundMax);
	pakList = (SoundPak *) malloc (sizeof (SoundPak) * pakMax);

	memset(musicList, 0, sizeof (Music) * musicMax);
	memset(soundList, 0, sizeof (Sound) * soundMax);
	memset(pakList, 0, sizeof (SoundPak) * pakMax);

	maxMusics = musicMax;
	maxSounds = soundMax;
	maxPaks = pakMax;

	atexit(audio_close_lists);
}
开发者ID:egilmore533,项目名称:IT-276-Pep-s-Spicy-Adventure-,代码行数:40,代码来源:audio.c


示例5: printf

bool audio::init()
{
//	sran1(SDL_GetTicks());

	sfact = NULL;
	// start SDL with audio support
	if(SDL_InitSubSystem(SDL_INIT_AUDIO) ==- 1) {
		printf("SDL_Init (audio): %s\n", SDL_GetError());
		return false;
	}

	audio_rate = 22050;			//Frequency of audio playback
	audio_format = AUDIO_S16SYS; 	//Format of the audio we're playing
	audio_channels = 2;			//2 channels = stereo
	audio_buffers = 1024;		//Size of the audio buffers in memory

	//Initialize SDL_mixer with our chosen audio settings
	if(Mix_OpenAudio(audio_rate,
							audio_format,
							audio_channels,
							audio_buffers) != 0) {
		printf("Unable to initialize audio: %s\n", Mix_GetError());
		return false;
	}

	// allocate 32 mixing channels
	Mix_AllocateChannels(32);
	sfact = new soundFactory(32);

	music = NULL;
//	Mix_Volume(-1,MIX_MAX_VOLUME * .30);
//	Mix_VolumeMusic(MIX_MAX_VOLUME * .5);

	Mix_HookMusicFinished(song_done);
	songs.load("./data/config/playlist.xml");
//	songs.print();

	return true;

}
开发者ID:zurn,项目名称:Zakes,代码行数:40,代码来源:audio.cpp


示例6: m_queuesEmpty

SDLMixerSoundSystem::SDLMixerSoundSystem()
 : m_queuesEmpty(true)
{
    int retval = SDL_InitSubSystem ( SDL_INIT_AUDIO );
    CrbReleaseAssert ( retval == 0 );

    int channels = g_prefsManager->GetInt ( "SoundChannels", 32 ),
        frequency = g_prefsManager->GetInt ( "SoundMixFreq", 22050 ),
        bufferSize = g_prefsManager->GetInt ( "SoundBufferSize", 1024 );

    if ( channels < 16 ) channels = 16;
    if ( frequency < 22050 ) frequency = 22050;
    if ( bufferSize < 512 ) bufferSize = 512;

    if ( !isPowerOfTwo ( bufferSize ) ) bufferSize = nearestPowerOfTwo ( bufferSize );

    retval = Mix_OpenAudio ( frequency, AUDIO_S16SYS, 2, bufferSize );
    CrbReleaseAssert ( retval == 0 );

    Mix_AllocateChannels ( channels );
    m_channelPlaying.setSize ( channels );
}
开发者ID:EddieRingle,项目名称:cerberus,代码行数:22,代码来源:soundsystem_sdlmixer.cpp


示例7: DKDebug

DKAudio::DKAudio(DKString file)
{
	if(!DKFile::FileExists(file)){
		DKDebug("Audio File Does Not Exist\n");
		return;
	}
	Mix_Init(0);
	Mix_Quit(); //???
	int error = 0;
	error = Mix_OpenAudio(8000,MIX_DEFAULT_FORMAT,2,BUFFER);
	if(error){
		DKDebug("Audio Error");
	}

	Mix_AllocateChannels(10);

	sound = Mix_LoadWAV(file.c_str());
	if(!sound){
		//DKDebug(Mix_GetError());
	}
	Mix_VolumeMusic(64);
}
开发者ID:trigg4htre,项目名称:dklib,代码行数:22,代码来源:DKAudio.cpp


示例8: sdl_init_sounds

/**
 * Initialize SDL sounds so that sdl_play_sample can be called.
 * @return 0 on success, nonzero otherwise.
 */
int sdl_init_sounds(void) {
#ifdef HAVE_SDL_MIXER
    int ret;

    ret = SDL_InitSubSystem(SDL_INIT_AUDIO);
    if (ret != 0)
        return 1;

    /*
     * use a 4096 byte buffer:
     * 44100*2*2 bytes/sec / 4096 bytes = about 1/43 seconds
     */
    ret = Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096);
    if (ret < 0)
        return 1;
    Mix_AllocateChannels(16);   /* max. 16 simultaneous samples */
    return 0;
#else
    printf("This version of triplane has been compiled without sound support.\n");
    return 1;
#endif
}
开发者ID:Gendron5000,项目名称:triplane,代码行数:26,代码来源:sdl_compat.cpp


示例9: priorities

Sound::Sound(uint8_t vol)
	:chunks(34), priorities(MIXER_CHANNELS)
{
	if (Mix_OpenAudio(OUTPUT_RATE, OUTPUT_FORMAT, 
			  OUTPUT_CHANNELS, OUTPUT_CHUNK_SIZE) == -1) {
		throw Sound_Error(Mix_GetError());
	}
	Mix_AllocateChannels(MIXER_CHANNELS);

	std::string filename;
	Mix_Chunk *chunk;
	for ( auto i=0; i < 34; ++i ) {
		filename = DATADIR "/sounds/" + filenames[i] + ".ogg";
		chunk = Mix_LoadWAV(filename.c_str());
		if (chunk == NULL)
			throw Sound_Error(Mix_GetError());

		chunks[i] = chunk;
	}
	//delete[] filename;
	Mix_Volume(-1, vol*16);
}
开发者ID:MaddTheSane,项目名称:maelstrom,代码行数:22,代码来源:sound.cpp


示例10: Init

    /* Initialize the sound module */
    void Init()
    {
        /* Skip disabled audio */
        if (!EnableAudio)
        {
            verbose << "Audio disabled -- skipping initialization" << endl;
            return;
        }

        verbose << "Initializing audio...";

        if (Mix_OpenAudio(22050, AUDIO_S16, 2, 1024))
        {
            error << "Mix_OpenAudio Failure" << endl;
            exit(1);
        }
        Mix_AllocateChannels(32);

        verbose << "Audio initialized." << endl;

        if (! (EnableAudio && EnableSFX)) return;

        for (int i=0; i<SFX_MAX; i++)
        {
            string filename = SoundPath;
            filename += SoundFileNames[i];
            mix_sound[i] = Mix_LoadWAV(filename.c_str());

            verbose << "Loading " << filename << "...";

            if (!mix_sound)
                error << endl << "Could not load " << filename << endl;

            else
                verbose << "done." << endl;
        }

        verbose << "...done" << endl;
    }
开发者ID:hdon,项目名称:cellar,代码行数:40,代码来源:sound.cpp


示例11: bgm_volume

SdlAudio::SdlAudio() :
	bgm_volume(0),
	bgs_channel(0),
	bgs_playing(false),
	me_channel(0),
	me_stopped_bgm(false)
{
	if (!(SDL_WasInit(SDL_INIT_AUDIO) & SDL_INIT_AUDIO)) {
		if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
			Output::Error("Couldn't initialize audio.\n%s\n", SDL_GetError());
		}
	}
#ifdef GEKKO
	int const frequency = 32000;
#else
	int const frequency = 44100;
#endif
	if (Mix_OpenAudio(frequency, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 1024) < 0) {
		Output::Error("Couldn't initialize audio.\n%s\n", Mix_GetError());
	}
	Mix_AllocateChannels(32); // Default is MIX_CHANNELS = 8
}
开发者ID:gadesx,项目名称:Player,代码行数:22,代码来源:sdl_audio.cpp


示例12: InitSDL_mixer

int InitSDL_mixer(){
	//On initialise SDL_Mixer 2, qui gérera la musique et les effets sonores
	int flags = MIX_INIT_MP3;
	int initted = Mix_Init(flags);
	if ((initted & flags) != flags)
	{
		printf("Mix_Init: Failed to init SDL_Mixer\n");
		printf("Mix_Init: %s\n", Mix_GetError());
		return 0;
	}
	printf("SDL_Mixer Initialisation complete. \n");
	/* Open 44.1KHz, signed 16bit, system byte order,
	stereo audio, using 1024 byte chunks (voir la doc pour plus d'infos) */
	if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024) == -1) {
		printf("Mix_OpenAudio: %s\n", Mix_GetError());
		return 0;
	}
	printf("Mix_OpenAudio Initialisation complete. \n");
	// Définit le nombre de pistes audio (channels) à mixer
	Mix_AllocateChannels(32);
	return 1;
}
开发者ID:Rxelux,项目名称:SDLProject,代码行数:22,代码来源:SDLSetup.c


示例13: I_InitSound

void I_InitSound()
{ 
  int i;
  
  fprintf( stderr, "I_InitSound: ");
  SDL_Init(SDL_INIT_AUDIO);
  I_InitMusic();
  Mix_AllocateChannels(NUM_CHANNELS);
  Mix_ReserveChannels(3);

  // Initialize external data (all sounds) at start, keep static.
 
  for (i=1 ; i<NUMSFX ; i++)
  { 
    // Alias? Example is the chaingun sound linked to pistol.
    if (!S_sfx[i].link)
    {
      // Load data from WAD file.
      S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );

      // Samples now 16bit LE stereo, upsampled to double length and padded
      S_sfx[i].chunk = Mix_QuickLoad_RAW( S_sfx[i].data, lengths[i] );
    }	
    else
    {
      // Previously loaded already?
      S_sfx[i].data = S_sfx[i].link->data;
      lengths[i] = lengths[(S_sfx[i].link - S_sfx)/sizeof(sfxinfo_t)];
      S_sfx[i].chunk = Mix_QuickLoad_RAW( S_sfx[i].data, lengths[i] );
    }
  }

  fprintf( stderr, " pre-cached all sound data\n");
  
  // Finished initialization.
  fprintf(stderr, "I_InitSound: sound module ready\n");
  SDL_PauseAudio(0);
}
开发者ID:hexameron,项目名称:DOOM,代码行数:38,代码来源:l_sound_sdl.c


示例14: I_SDL_InitSound

static boolean I_SDL_InitSound(void)
{
    int i;

    // No sounds yet

    for (i = 0; i < NUMSFX; ++i)
        sound_chunks[i].abuf = NULL;

    for (i = 0; i < NUM_CHANNELS; ++i)
        channels_playing[i] = sfx_None;

    if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
    {
        fprintf(stderr, "Unable to set up sound.\n");
        return false;
    }

    if (Mix_OpenAudio(snd_samplerate, AUDIO_S16SYS, 2, GetSliceSize()) < 0)
    {
        fprintf(stderr, "Error initializing SDL_mixer: %s\n", Mix_GetError());
        return false;
    }

    Mix_QuerySpec(&mixer_freq, &mixer_format, &mixer_channels);

    // precache sounds to avoid slowdown inside game
    for (i = 0; i < NUMSFX; i++)
        CacheSFX_SDL(i);

    Mix_AllocateChannels(NUM_CHANNELS);

    SDL_PauseAudio(0);

    sound_initialized = true;

    return true;
}
开发者ID:arneolavhal,项目名称:doomretro,代码行数:38,代码来源:i_sdlsound.c


示例15: init_window

SDL_Surface* init_window ()
{
	if (SDL_Init (SDL_INIT_VIDEO))
	{
		fprintf (stderr, "SDL_Init failed : %s\n", SDL_GetError());
		exit (1);
	}
	if (TTF_Init ())
	{
		fprintf (stderr, "TTF_Init failed : %s\n", SDL_GetError());
		exit (2);
	}

	SDL_WM_SetIcon (SDL_LoadBMP("ressources/ico.bmp"), NULL);
	SDL_WM_SetCaption ("HEX (...a saute !)", "");

	if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 1024) == -1)
		fprintf(stderr, "Mix init failed : %s\n", Mix_GetError());
	Mix_AllocateChannels(3); //MIX_CHANNELS

	const SDL_VideoInfo* info = SDL_GetVideoInfo();
	int bpp;
	if (info == NULL)
	{
		fprintf (stderr, "Unable to get video information\n Trying to force BPP to 8.\n");
		bpp = 8;
	}
	else
		bpp = info->vfmt->BitsPerPixel;

	SDL_Surface* window = SDL_SetVideoMode (DWIDTH, DHEIGHT, bpp, SDL_HWSURFACE | SDL_RESIZABLE | SDL_DOUBLEBUF);
	if (window == NULL)
	{
		fprintf (stderr, "Unable to set video mode : %s\n", SDL_GetError());
		exit (3);
	}
	return window;
}
开发者ID:Tropicananass,项目名称:S4-Projet,代码行数:38,代码来源:window.c


示例16: main

int main(int argc, char **argv) {
  SDL_Init(SDL_INIT_AUDIO);
  Mix_Init(MIX_INIT_OGG);

  int ret = Mix_OpenAudio(0, 0, 0, 0); // we ignore all these..
  assert(ret == 0);

  Mix_AllocateChannels(kNumChannels);

  sound = Mix_LoadWAV("sound.ogg");

  // allocate all the channels
  for ( int i = 0; i < kNumChannels; i++ )
  {
    assert(loadAndPlay() != -1);
  }

    // This point, we should have exhausted our channels




  int lastChannel = loadAndPlay();

#if EMSCRIPTEN
  int result = (lastChannel == -1);
  REPORT_RESULT();
#endif

  assert(lastChannel == -1);

  // force a quit
  while(Mix_Init(0))
    Mix_Quit();
  Mix_CloseAudio();

  return 0;
}
开发者ID:AIM360,项目名称:emscripten,代码行数:38,代码来源:sdl_audio_mix_channels.c


示例17: I_SDL_InitSound

dboolean I_SDL_InitSound(void)
{
    int i;

    // No sounds yet
    for (i = 0; i < NUM_CHANNELS; ++i)
        channels_playing[i] = NULL;

    if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
        return false;

    {
        const SDL_version       *linked = Mix_Linked_Version();

        if (linked->major != MIX_MAJOR_VERSION || linked->minor != MIX_MINOR_VERSION)
            I_Error("The wrong version of SDL2_MIXER.DLL was found. "PACKAGE_NAME" requires "
                "v%d.%d.%d, not v%d.%d.%d.", linked->major, linked->minor, linked->patch,
                MIX_MAJOR_VERSION, MIX_MINOR_VERSION, MIX_PATCHLEVEL);

        if (linked->patch != MIX_PATCHLEVEL)
            C_Warning("The wrong version of SDL2_MIXER.DLL was found. "PACKAGE_NAME" requires "
                "v%d.%d.%d, not v%d.%d.%d.", linked->major, linked->minor, linked->patch,
                MIX_MAJOR_VERSION, MIX_MINOR_VERSION, MIX_PATCHLEVEL);
    }

    if (Mix_OpenAudio(snd_samplerate, AUDIO_S16SYS, 2, GetSliceSize()) < 0)
        return false;

    Mix_QuerySpec(&mixer_freq, &mixer_format, &mixer_channels);

    Mix_AllocateChannels(NUM_CHANNELS);

    SDL_PauseAudio(0);

    sound_initialized = true;

    return true;
}
开发者ID:zachiPL,项目名称:doomretro,代码行数:38,代码来源:i_sdlsound.c


示例18: SoundReconfigure

void SoundReconfigure(SoundDevice *s)
{
	s->isInitialised = false;

	if (Mix_AllocateChannels(s->channels) != s->channels)
	{
		printf("Couldn't allocate channels!\n");
		return;
	}

	Mix_Volume(-1, ConfigGetInt(&gConfig, "Sound.SoundVolume"));
	Mix_VolumeMusic(ConfigGetInt(&gConfig, "Sound.MusicVolume"));
	if (ConfigGetInt(&gConfig, "Sound.MusicVolume") > 0)
	{
		MusicResume(s);
	}
	else
	{
		MusicPause(s);
	}

	s->isInitialised = true;
}
开发者ID:NSYXin,项目名称:cdogs-sdl,代码行数:23,代码来源:sounds.c


示例19: Log

/**
 * Initializes the audio subsystem.
 */
void Game::initAudio()
{
	Uint16 format;
	if (Options::audioBitDepth == 8)
		format = AUDIO_S8;
	else
		format = AUDIO_S16SYS;
	if (Mix_OpenAudio(Options::audioSampleRate, format, 2, 1024) != 0)
	{
		Log(LOG_ERROR) << Mix_GetError();
		Log(LOG_WARNING) << "No sound device detected, audio disabled.";
		Options::mute = true;
	}
	else
	{
		Mix_AllocateChannels(16);
		// Set up UI channels
		Mix_ReserveChannels(4);
		Mix_GroupChannels(1, 2, 0);
		Log(LOG_INFO) << "SDL_mixer initialized successfully.";
		setVolume(Options::soundVolume, Options::musicVolume, Options::uiVolume);
	}
}
开发者ID:oculushut,项目名称:OpenXcom,代码行数:26,代码来源:Game.cpp


示例20: SDL_Init

SoundPlayer::SoundPlayer()
{
	int sdlret = SDL_Init(SDL_INIT_AUDIO);
        if(sdlret == -1){
                std::cout << "SDL value: " << sdlret << std::endl;
                std::cout << SDL_GetError();
        }
	Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096);

	/*bgMusic = Mix_LoadMUS("sounds/bgMusic.wav");
	if(bgMusic == NULL) {
		std::cout << Mix_GetError() << std::endl;
	}*/
	//Mix_PlayMusic(bgMusic, -1);

	Mix_AllocateChannels(24);

	paddleSwing = Mix_LoadWAV("sounds/paddleSwing.wav");
	score = Mix_LoadWAV("sounds/score.wav");
	shipHit = Mix_LoadWAV("sounds/shipHit.wav");

	mute = false;
}
开发者ID:buzzmark,项目名称:PaddleShip,代码行数:23,代码来源:SoundPlayer.cpp



注:本文中的Mix_AllocateChannels函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Mix_FadeInMusic函数代码示例发布时间:2022-05-30
下一篇:
C++ MissingArgumentException函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap