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

C++ play_music函数代码示例

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

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



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

示例1: Prop

void WindowPlanes::addProp()
{
    QPointer<Prop> prop=new Prop(this);//0代表是子弱代表炸弹
    time=QTime::currentTime();
    qsrand(time.msec()*100000+time.second()*10000);
    int temp=qrand()%2;

    if(temp==0)
    {
        prop->mytype=0;
        prop->pixmap=&pixmap_prop0;
    }
    else
    {
        prop->mytype=1;
        prop->pixmap=&pixmap_prop1;
    }
    prop->setNumber(getNumber());
    prop->setSize(prop->pixmap->size());

    prop->setY(-prop->height());
    time=QTime::currentTime();
    qsrand(time.msec()*100000+time.second()*10000);
    prop->setX(qrand()%(int)(width()-prop->width()));


    prop->go();

    emit play_music("out_porp");

    //qDebug()<<"add double bullet ok";
}
开发者ID:pink5,项目名称:Aircraft-War,代码行数:32,代码来源:windowplanes.cpp


示例2: game_over_init

void game_over_init(void)
{
    winsys_set_display_func( main_loop );
    winsys_set_idle_func( main_loop );
    winsys_set_reshape_func( reshape );
    winsys_set_mouse_func( mouse_cb );
    winsys_set_motion_func( ui_event_motion_func );
    winsys_set_passive_motion_func( ui_event_motion_func );

    remove_all_bonuses();

    halt_sound( "flying_sound" );
    halt_sound( "rock_sound" );
    halt_sound( "ice_sound" );
    halt_sound( "snow_sound" );

    play_music( "game_over" );

    aborted = g_game.race_aborted;

    if ( !aborted ) {
        update_player_score( get_player_data( local_player() ) );
    }

    if ( (!g_game.practicing &&!aborted) || (!g_game.practicing && aborted && !game_abort_is_for_tutorial())) {
        race_won = was_current_race_won();
        init_starting_tutorial_step(-100);
    }

    g_game.needs_save_or_display_rankings=false;
    g_game.rankings_displayed=false;
}
开发者ID:anil11,项目名称:Tux-Racer-4-iOS,代码行数:32,代码来源:game_over.c


示例3: play_music_once

void play_music_once(const std::string &file)
{
	// Clear list so it's not replayed.
	current_track_list.clear();
	current_track = music_track(file);
	play_music();
}
开发者ID:suxinde2009,项目名称:Rose,代码行数:7,代码来源:sound.cpp


示例4: launch_sdl

int			launch_sdl(t_sdl *sdl)
{
  TTF_Font		*font288;
  TTF_Font		*font200;
  SDL_Event		event;

  sdl->screen = NULL;
  sdl->music = NULL;
  if ((sdl->screen = init_sdl(sdl->screen)) == NULL)
    return (EXIT_FAILURE);
  if ((font288 = TTF_OpenFont("game_over.ttf", FONT_SIZE1)) == NULL)
    abort();
  if ((font200 = TTF_OpenFont("game_over.ttf", 100)) == NULL)
    abort();
  intro_corewar(font288, "CoreWar", sdl->screen, 0);
  intro_corewar(font200, "An original game by Victor A. Vyssotsky, Robert " \
		"Morris Sr. & M. Douglas McIlroy", sdl->screen, 100);
  intro_corewar(font200, "Coded by Le Gang de la Toundra", sdl->screen, 200);
  intro_corewar(font200, "(Insert coin to play)", sdl->screen, 400);
  SDL_Flip(sdl->screen);
  while (1)
    {
      SDL_WaitEvent(&event);
      if (event.type == SDL_KEYUP)
	break;
    }
  sdl->music = play_music(sdl->music);
  return (EXIT_SUCCESS);
}
开发者ID:Bridouille,项目名称:corewar,代码行数:29,代码来源:sdl_gui.c


示例5: Enemy

void WindowPlanes::addenemy3_3()
{
    QPointer<Enemy> enemy=new Enemy(this);
    enemy->setNumber(getNumber());
    enemy->mytype=3;
#ifdef Q_OS_SYMBIAN_V5//判断qt的版朊    enemy->speed=6300;
#else
    //enemy->speed=6300;
    enemy->speed=3800;
#endif

    enemy->pixmap=&pixmap_enemy3_1;
    enemy->setSize(enemy->pixmap->size());
    enemy->blast1=&pixmap_enemy3_1;
    enemy->blast2=&pixmap_enemy3_2;
    enemy->blast3=&pixmap_enemy3_3;
    enemy->blast4=&pixmap_enemy3_4;
    enemy->blast5=&pixmap_enemy3_5;
    enemy->blast6=&pixmap_enemy3_6;
    enemy->blast7=&pixmap_enemy3_7;
    enemy->blast8=&pixmap_enemy3_8;
    enemy->blast9=&pixmap_enemy3_9;
    enemy->HP=15;
    enemy->score=30000;

    enemy->setY(-enemy->height());
    time=QTime::currentTime();
    qsrand(time.msec()*100000+time.second()*10000);
    //qDebug()<<"qrand():"<<qrand()<<time.msec()+time.second()*1000;
    enemy->setX(qrand()%(int)(width()-enemy->width()));
    enemy->go();
    emit play_music("flying");
}
开发者ID:pink5,项目名称:Aircraft-War,代码行数:33,代码来源:windowplanes.cpp


示例6: schedule_behaviour

void schedule_behaviour() {
  // called at 100 Hz / 10ms
    
  if (behaviour == BEHAVIOUR_CALIB){
    return;
  }

  if (!get_input_bit(IO_INPUT_1)) {
    play_music();
  }
  
  copro_update();
  update_ori();
  uint8_t new_behaviour = behaviour;
  
  switch (behaviour) {
    case BEHAVIOUR_LINE:     new_behaviour = behaviour_follow_line(); break;
    case BEHAVIOUR_OBSTACLE: new_behaviour = behaviour_obstacle_avoidance(); break;
  }

  if (new_behaviour != behaviour) {
    behaviour=new_behaviour;
    switch (behaviour) {
      case BEHAVIOUR_LINE:     behaviour_follow_line_start(); break;
      case BEHAVIOUR_OBSTACLE: behaviour_obstacle_avoidance_start(); break;
    }
  }
}
开发者ID:firemind,项目名称:LabyrinthNibo,代码行数:28,代码来源:main.c


示例7: play_music

void AudioManager::play_audio(AudioClip *inClip)
{
	if (_init && inClip)
	{
		if (inClip->type == TEXENG_AUDIO_FX) play_fx(inClip);
		else play_music(inClip);
	}
}
开发者ID:TEXStudio,项目名称:texengine,代码行数:8,代码来源:audioManager.cpp


示例8: show_text

void sceneShow::show_scene(int n)
{
    if (n < 0) {
        return;
    }
    if (scene_list.size() <= n) {
        std::cout << "ERROR: Scene List[" << n << "] invalid. List size is " << image_scenes.size() << "." << std::endl;
        return;
    }
    CURRENT_FILE_FORMAT::file_scene_list scene = scene_list.at(n);
    input.clean();

    for (int i=0; i<SCENE_OBJECTS_N; i++) {
        input.read_input();
        int scene_seek_n = scene.objects[i].seek_n;
        //std::cout << ">> sceneShow::show_scene - i: " << i << ", scene_seek_n: " << scene_seek_n << std::endl;

        if (_interrupt_scene == true || input.p1_input[BTN_START] == 1) {
            scene_seek_n = -1;
            break;
        }

        if (scene_seek_n != -1) {
            int scene_type = scene.objects[i].type;
            //std::cout << "### scene_type[" << scene_type << "]" << std::endl;
            if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_TEXT) {
                show_text(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_AREA) {
                clear_area(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_SCREEN) {
                graphLib.clear_area(0 ,0, RES_W, RES_H, 0, 0, 0);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_IMAGE) {
                show_image(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_VIEWPOINT) {
                show_viewpoint(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_MUSIC) {
                play_music(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_SFX) {
                play_sfx(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_ANIMATION) {
                show_animation(scene_seek_n, scene.objects[i].repeat_value, scene.objects[i].repeat_type);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_STOP_MUSIC) {
                soundManager.stop_music();
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SUBSCENE) {
                show_scene(scene_seek_n);
            } else {
                std::cout << ">> sceneShow::show_scene - unknown scene_type[" << scene_type << "]" << std::endl;
            }
            std::cout << "show_scene::DELAY[" << i << "][" << scene.objects[i].delay_after << "]" << std::endl;
            if (input.waitScapeTime(scene.objects[i].delay_after) == 1) {
                _interrupt_scene = true;
            }
        } else {
            break;
        }
    }
    std::cout << "show_scene::DONE" << std::endl;
}
开发者ID:protoman,项目名称:rockbot,代码行数:58,代码来源:sceneshow.cpp


示例9: play_music_config

void play_music_config(const config &music_node)
{
	music_track track( music_node );

	if (!track.valid() && !track.id().empty()) {
		ERR_AUDIO << "cannot open track '" << track.id() << "'; disabled in this playlist." << std::endl;
	}

	// If they say play once, we don't alter playlist.
	if (track.play_once()) {
		current_track = track;
		play_music();
		return;
	}

	// Clear play list unless they specify append.
	if (!track.append()) {
		current_track_list.clear();
	}

	if(track.valid()) {
		// Avoid 2 tracks with the same name, since that can cause an infinite loop
		// in choose_track(), 2 tracks with the same name will always return the
		// current track and track_ok() doesn't allow that.
		std::vector<music_track>::const_iterator itor = current_track_list.begin();
		while(itor != current_track_list.end()) {
			if(track == *itor) break;
			++itor;
		}

		if(itor == current_track_list.end()) {
			current_track_list.push_back(track);
		} else {
			ERR_AUDIO << "tried to add duplicate track '" << track.file_path() << "'" << std::endl;
		}
	}

	// They can tell us to start playing this list immediately.
	if (track.immediate()) {
		current_track = track;
		play_music();
	} else if (!track.append()) { // Make sure the current track is finished
		current_track.set_play_once(true);
	}
}
开发者ID:aquileia,项目名称:wesnoth,代码行数:45,代码来源:sound.cpp


示例10: racing_init

void racing_init(void) 
{
    player_data_t *plyr = get_player_data( local_player() );
    
    winsys_set_display_func( main_loop );
    winsys_set_idle_func( main_loop );
    winsys_set_reshape_func( reshape );
    winsys_set_mouse_func( NULL );
    winsys_set_motion_func( NULL );
    winsys_set_passive_motion_func( NULL );
    winsys_set_mouse_func( NULL );
    
    /* Initialize view */
    if ( getparam_view_mode() < 0 || 
        getparam_view_mode() >= NUM_VIEW_MODES ) 
    {
        setparam_view_mode( ABOVE );
    }
    set_view_mode( plyr, (view_mode_t)getparam_view_mode() );
    
    /* We need to reset controls here since callbacks won't have been
     called in paused mode. This results in duplication between this
     code and init_physical_simulation.  Oh well. */
    left_turn = right_turn = paddling = False;
    trick_modifier = False;
    charging = False;
    plyr->control.turn_fact = 0.0;
    plyr->control.turn_animation = 0.0;
    plyr->control.is_braking = False;
    plyr->control.is_paddling = False;
    plyr->control.jumping = False;
    plyr->control.jump_charging = False;
    
#ifdef __APPLE__
    plyr->control.is_flying=False;
    plyr->control.fly_total_time=0;
#endif
    
    /* Set last_terrain to a value not used below */
    last_terrain = 0;
    
    if ( g_game.prev_mode != PAUSED ) {
        init_physical_simulation();
    }
    
    last_terrain = 0;
    
    g_game.race_aborted = False;
#ifdef __APPLE__
    g_game.race_time_over = False;
#endif
    
    play_music( "racing" );
    /* play_sound( "start_race", 0 ); */
}
开发者ID:LeifAndersen,项目名称:TuxRider,代码行数:55,代码来源:racing.c


示例11: play_music

void WindowPlanes::bulletToDouble()
{
    time_double_bullet_begin.start();//记录双子弹状态是从什么时候开始的
    save_timer_bullet_to_single = 15000;
    pixmap_bullet=&pixmap_bullet2;
    bullet_type=2;

    emit play_music("double_saler");

    timer_bullet_to_single.start(15000);
}
开发者ID:pink5,项目名称:Aircraft-War,代码行数:11,代码来源:windowplanes.cpp


示例12: draw

static void draw(void)
{
   int x, y, offx, offy;
   float c = 1;
   static char logo_text1[] = "Allegro";
   static char logo_text2[] = "";
   /* XXX commented out because the font doesn't contain the characters for
    * anything other than "Allegro 4.2"
    */
   /* static char logo_text2[] = "5.0"; */

   if (progress < 0.5f) {
      c = progress / 0.5f;
      al_clear_to_color(al_map_rgb_f(c, c, c));
   } else {
      if (!already_played_midi) {
         play_music(DEMO_MIDI_INTRO, 0);
         already_played_midi = 1;
      }

      c = 1;
      al_clear_to_color(al_map_rgb_f(c, c, c));

      x = screen_width / 2;
      y = screen_height / 2 - 3 * al_get_font_line_height(demo_font_logo) / 2;

      offx = 0;
      if (progress < 1.0f) {
         offx =
            (int)(al_get_text_width(demo_font_logo, logo_text1) *
                  (1.0f - 2.0f * (progress - 0.5f)));
      }

      demo_textprintf_centre(demo_font_logo, x + 6 - offx,
                           y + 5, al_map_rgba_f(0.125, 0.125, 0.125, 0.25), logo_text1);
      demo_textprintf_centre(demo_font_logo, x - offx, y,
                           al_map_rgba_f(1, 1, 1, 1), logo_text1);

      if (progress >= 1.5f) {
         y += 3 * al_get_font_line_height(demo_font_logo) / 2;
         offy = 0;
         if (progress < 2.0f) {
            offy = (int)((screen_height - y) * (1.0f - 2.0f * (progress - 1.5f)));
         }

         demo_textprintf_centre(demo_font_logo, x + 6,
                              y + 5 + offy, al_map_rgba_f(0.125, 0.125, 0.125, 0.25),
                              logo_text2);
         demo_textprintf_centre(demo_font_logo, x, y + offy,
                              al_map_rgba_f(1, 1, 1, 1), logo_text2);
      }
   }
}
开发者ID:BorisCarvajal,项目名称:allegro5,代码行数:53,代码来源:intro.c


示例13: credits_init

static void credits_init(void) 
{
    winsys_set_display_func( main_loop );
    winsys_set_idle_func( main_loop );
    winsys_set_reshape_func( reshape );
    winsys_set_mouse_func( mouse_cb );
    winsys_set_motion_func( ui_event_motion_func );
    winsys_set_passive_motion_func( ui_event_motion_func );
    
    y_offset = 0;
    
    play_music( "credits_screen" );
}
开发者ID:FeeJai,项目名称:Tux-Racer-4-iOS,代码行数:13,代码来源:credits.c


示例14: play_music

void MusicMng::play_music(s32 pos)
{
	if (pos >= 0 && pos < (s32)m_list.size())
	{
#ifdef UNICODE
		std::string str = Helper::Utf16ToACP(m_list[pos]);
		const c8 * name = str.c_str();
#else
		const c8 * name = m_list[pos].c_str();
#endif
		play_music(name);
	}
}
开发者ID:esrrhs,项目名称:fuck-music-player,代码行数:13,代码来源:musicmng.cpp


示例15: add_bonus

// --------------------------------------------------------------
// object which gives a temporary boost to luck
// --------------------------------------------------------------
void t_luck_object::activate_trigger( t_army* army, t_adv_map_point const& point, 
		                              t_direction direction, t_adventure_frame* frame )
{
	int  i;
	bool any_award = false;

	// loop through all heroes/creatures in the army and award temporary statistic based on subtype

	t_creature_array& creatures = army->get_creatures();


	for (i = 0; i < t_creature_array::k_size; i++)
	{
		if (creatures[i].get_number() == 0)
			continue;
		if (creatures[i].has_temporary_bonus( get_type() ))
			continue;
		add_bonus( creatures[i] );
		any_award = true;
	}

	// determine what response to print
	if (army->get_owner()->is_computer())
		return;

	t_basic_dialog*          dialog;
	std::string              text;

	dialog = new t_basic_dialog;
	if (any_award)
	{
		text = get_text( "initial" );
		add_icons( dialog );
	}
	else
	{
		text = get_text( "empty" );
	}

	dialog->set_text( text );
	dialog->add_ok_button();
	dialog->set_title( get_name() );
	dialog->open( get_dialog_bottom( point ), true, k_align_bottom );
	t_sound_cache music = get_music_playing();
	stop_music();
	get_dialog_sound( k_dialog_sound_luck )->play( get_sound_volume() );
	dialog->run_modal();
    // Update stats.
    frame->update_army();
	play_music( music );
}
开发者ID:sundoom,项目名称:sunstudio,代码行数:54,代码来源:luck_object.cpp


示例16: handle_adventure_sound_minimization

// stop or start sounds when minimized
void handle_adventure_sound_minimization(bool minimized)
{
	static bool was_minimized = false;
	static bool music_is_saved = false;
	static int former_music_volume;
	static t_sound_cache saved_music;

	if (minimized == false && !was_minimized) // never have minimized yet
		return;

	// go through the current managed sound list and make sure a sound
	t_active_sounds::iterator iter;

	if (minimized)
		was_minimized = true;

	// handle music
	if (music_is_saved && !minimized) 
		play_music( saved_music );
	else if (minimized)
	{
		music_is_saved = true;
		saved_music = get_music_playing();
	//	if (saved_music)
	//		former_music_volume = saved_music->get_volume();
		stop_music();
	}

	// traverse the list of active sounds and process each
	for( iter = active_sounds.begin(); iter != active_sounds.end(); ++iter )
	{
		t_managed_sound * playing_sound = (*iter).get();
		if (minimized) // fade out the sound
		{
			playing_sound->set_former_volume(playing_sound->get_sound_ptr()->get_volume());
			playing_sound->get_sound_ptr()->set_volume(k_almost_min_volume);
		}
		else // restore prior volume level
		{
			if (playing_sound->get_sound_ptr())
			{
				playing_sound->get_sound_ptr()->set_volume(playing_sound->get_former_volume() );
			}
			else
			{
				minimized = minimized; // debug hook for a bug??
			}
		}
	}
}
开发者ID:sundoom,项目名称:sunstudio,代码行数:51,代码来源:adventure_sounds.cpp


示例17: zero

void t_sanctuary::activate_trigger( t_army* army, t_adv_map_point const& point, 
									t_direction direction, 
									t_adventure_frame* frame )
{
	t_dialog_sanctuary*				dialog;
	t_player*						player = army->get_owner();
	std::string						text;
	t_screen_point					zero(0,0);

	resurrect_heroes( *army, k_text_sanctuary_resurrects_heroes, frame );
	dialog = new t_dialog_sanctuary( frame );

	if (!empty())
	{
		dialog->set_text( get_text( "denied" ) );
		dialog->enable_entry( false );
	}
	else if (m_paid[army->get_owner_number()])
	{
		dialog->set_text( get_text( "paid" ) );
		dialog->enable_entry( true );
	}
	else
	{
		dialog->set_text( get_text( "initial" ));
		dialog->enable_entry( player->get_funds()[k_gold] >= k_rental_fee);
	}
	dialog->set_title( get_name() );

	t_sound_cache music = get_music_playing();
	stop_music();
	get_dialog_sound( k_dialog_sound_sanctuary )->play( get_sound_volume() );
	switch (dialog->run_modal())
	{
		case k_choice_cancel:
			return;

		case k_choice_enter:
			if (!m_paid[army->get_owner_number()])
			{
				player->spend( k_gold, k_rental_fee );
				m_paid[army->get_owner_number()] = true;
			}
			set_owner( army->get_owner_number() );
			swap( army->get_creatures() );
			frame->destroy_army( army );
			break;
	}
	play_music( music );
}
开发者ID:sundoom,项目名称:sunstudio,代码行数:50,代码来源:sanctuary.cpp


示例18: play_music

void
SoundManager::enable_music(bool enable)
{
  if(device == 0)
    return;
  music_enabled = enable;
  if(music_enabled) {
    play_music(current_music);
  } else {
    if(music_source) {
      delete music_source;
      music_source = 0;
    }
  }
}
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:15,代码来源:sound_manager.cpp


示例19: play_music

void
SoundManager::enable_music(bool enable)
{
  if(device == NULL)
    return;

  music_enabled = enable;
  if(music_enabled) {
    play_music(current_music);
  } else {
    if(music_source) {
      music_source.reset();
    }
  }
}
开发者ID:Julydeea,项目名称:supertux,代码行数:15,代码来源:sound_manager.cpp


示例20: play_music_repeatedly

void play_music_repeatedly(const std::string &id)
{
	// Can happen if scenario doesn't specify.
	if (id.empty())
		return;

	current_track_list.clear();
	current_track_list.push_back(music_track(id));

	// If we're already playing it, don't interrupt.
	if (current_track != id) {
		current_track = music_track(id);
		play_music();
	}
}
开发者ID:aquileia,项目名称:wesnoth,代码行数:15,代码来源:sound.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ play_sample函数代码示例发布时间:2022-05-30
下一篇:
C++ play_game函数代码示例发布时间: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