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

C++ play_sound函数代码示例

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

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



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

示例1: record_monst

void record_monst(cCreature *which_m)
{
	short r1;
	char str[60];
	
	r1 = get_ran(1,1,100);
	r1 = (r1 * 7) / 10;
	
	if ((which_m->x_width > 1) || (which_m->y_width > 1)) {
		ASB("Capture Soul: Monster is too big.");
		}
	else if ((r1 > charm_odds[which_m->level / 2]) || (which_m->spec_skill == 12)
		|| (which_m->m_type == 3)) {
		monst_spell_note(which_m->number,10);
		play_sound(68);
		}
		else {
			monst_spell_note(which_m->number,24);
			r1 = get_ran(1,0,3);
			if (univ.party.imprisoned_monst[r1] == 0)
				univ.party.imprisoned_monst[r1] = which_m->number;
				else {
					r1 = get_ran(1,0,3);
					univ.party.imprisoned_monst[r1] = which_m->number;
					}
			ASB("Capture Soul: Success!");
			sprintf((char *)str,"  Caught in slot %d.",r1 + 1);
			add_string_to_buf((char *)str);
			play_sound(53);
			}
}
开发者ID:PBrookfield,项目名称:cboe-msvc,代码行数:31,代码来源:boe.monster.cpp


示例2: check_game_state

static void
check_game_state (void)
{
  if (is_line_at (player, row, column)) {
    gameover = TRUE;
    winner = player;
    switch (get_n_human_players ()) {
    case 1:
      if (is_player_human ()) {
	play_sound (SOUND_YOU_WIN);
      } else {
	play_sound (SOUND_I_WIN);
      }
      break;
    case 0:
    case 2:
      play_sound (SOUND_PLAYER_WIN);
      break;
    }
    blink_winner (6);
  } else if (moves == 42) {
    gameover = TRUE;
    winner = NOBODY;
    play_sound (SOUND_DRAWN_GAME);
  }
}
开发者ID:Swetha5,项目名称:gnome-games,代码行数:26,代码来源:main.c


示例3: main

int main( int argc, char* argv[])
{
    //check argument
    if ( argc != 2 )
    {
	fprintf(stderr, "[PLAY]: %s <filename>.wav \n", argv[0]);
	exit(1);
    }

    play_init(LIST, NOWAIT, NONDISP);
    play_read_filelist(argv[1]);

    play_sound("start");
    sleep(1);
    play_sound("stop");
    sleep(1);
    play_sound("left");
    sleep(1);
    play_sound("right");
    sleep(1);

    play_sync();
    play_close();
    return 1;
}
开发者ID:CPFL,项目名称:AutoICT,代码行数:25,代码来源:sample.c


示例4: play_ambient_sound

void play_ambient_sound(){ // TODO: Maybe add a system for in-town ambient sounds
	if(overall_mode == MODE_TOWN) {
		for(int i = 0; i < univ.town.monst.size(); i++) {
			if(party_can_see_monst(i))
				check_if_monst_seen(univ.town.monst[i].number, univ.town.monst[i].cur_loc);
		}
		return;
	}
	static const short drip[2] = {78,79}, bird[3] = {76,77,91};
	if(overall_mode != MODE_OUTDOORS) return; // ambient sounds are outdoors only at the moment
	if(get_ran(1,1,100) > 10) return; // 10% chance per move of playing a sound
	short sound_to_play;
	switch(univ.out->ambient_sound){
		case AMBIENT_DRIP:
			sound_to_play = get_ran(1,0,1);
			play_sound(-drip[sound_to_play]);
			break;
		case AMBIENT_BIRD:
			sound_to_play = get_ran(1,0,2);
			play_sound(-bird[sound_to_play]);
			break;
		case AMBIENT_CUSTOM:
			sound_to_play = univ.out->out_sound;
			play_sound(-sound_to_play);
			break;
		case AMBIENT_NONE:
			break; // obviously, do nothing
	}
}
开发者ID:LibreGames,项目名称:cboe,代码行数:29,代码来源:boe.graphutil.cpp


示例5: init_sound

void init_sound() {
	play_sound ( 1000 );
	sleep ( 1 );
	play_sound ( 990 );
	sleep ( 1 );
	play_sound ( 1000 );
	sleep ( 1 );
	nosound();
	exit();
}
开发者ID:teenHack42,项目名称:MatrixOS,代码行数:10,代码来源:kernel.c


示例6: pv_scene

// seg001:05EC
void __pascal far pv_scene() {
	init_princess();
	saveshad();
	if (fade_in_1()) return;
	init_vizier();
	savekid();
	if (proc_cutscene_frame(2)) return;
	play_sound(sound_50_story_2_princess); // story 2: princess waiting
	do {
		if (proc_cutscene_frame(1)) return;
		//idle();
	} while(check_sound_playing());
	cutscene_frame_time = 8;
	if (proc_cutscene_frame(5)) return;
	play_sound(sound_4_gate_closing); // gate closing
	do {
		if (proc_cutscene_frame(1)) return;
	} while(check_sound_playing());
	play_sound(sound_51_princess_door_opening); // princess door opening
	if (proc_cutscene_frame(3)) return;
	seqtbl_offset_shad_char(98); // princess turn around [PV1]
	if (proc_cutscene_frame(5)) return;
	seqtbl_offset_kid_char(96); // Jaffar walk [PV1]
	if (proc_cutscene_frame(6)) return;
	play_sound(sound_53_story_3_Jaffar_comes); // story 3: Jaffar comes
	seqtbl_offset_kid_char(97); // Jaffar stop [PV1]
	if (proc_cutscene_frame(4)) return;
	if (proc_cutscene_frame(18)) return;
	seqtbl_offset_kid_char(96); // Jaffar walk [PV1]
	if (proc_cutscene_frame(30)) return;
	seqtbl_offset_kid_char(97); // Jaffar stop [PV1]
	if (proc_cutscene_frame(35)) return;
	seqtbl_offset_kid_char(102); // Jaffar conjuring [PV1]
	cutscene_frame_time = 7;
	if (proc_cutscene_frame(1)) return;
	seqtbl_offset_shad_char(99); // princess step back [PV1]
	if (proc_cutscene_frame(17)) return;
	hourglass_state = 1;
	flash_time = 5;
	flash_color = 15; // white
	do {
		if (proc_cutscene_frame(1)) return;
		//idle();
	} while(check_sound_playing());
	seqtbl_offset_kid_char(100); // Jaffar end conjuring and walk [PV1]
	hourglass_sandflow = 0;
	if (proc_cutscene_frame(6)) return;
	play_sound(sound_52_story_4_Jaffar_leaves); // story 4: Jaffar leaves
	if (proc_cutscene_frame(24)) return;
	hourglass_state = 2;
	if (proc_cutscene_frame(9)) return;
	seqtbl_offset_shad_char(113); // princess look down [PV1]
	if (proc_cutscene_frame(28)) return;
	fade_out_1();
}
开发者ID:ecalot,项目名称:SDLPoP,代码行数:56,代码来源:seg001.c


示例7: get_level

/* Break a brick: */
void
World::trybreakbrick(float x, float y, bool small, Direction col_side)
{
  Level* plevel = get_level();
  
  Tile* tile = gettile(x, y);
  if (tile->brick)
    {
      if (tile->data > 0)
        {
          /* Get a distro from it: */
          add_bouncy_distro(((int)(x + 1) / 32) * 32,
                                  (int)(y / 32) * 32);

          // TODO: don't handle this in a global way but per-tile...
          if (!counting_distros)
            {
              counting_distros = true;
              distro_counter = 5;
            }
          else
            {
              distro_counter--;
            }

          if (distro_counter <= 0)
            {
              counting_distros = false;
              plevel->change(x, y, TM_IA, tile->next_tile);
            }

          play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
          player_status.score = player_status.score + SCORE_DISTRO;
          player_status.distros++;
        }
      else if (!small)
        {
          /* Get rid of it: */
          plevel->change(x, y, TM_IA, tile->next_tile);
          
          /* Replace it with broken bits: */
          add_broken_brick(tile, 
                                 ((int)(x + 1) / 32) * 32,
                                 (int)(y / 32) * 32);
          
          /* Get some score: */
          play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER);
          player_status.score = player_status.score + SCORE_BRICK;
        }
    }
  else if(tile->fullbox)
    tryemptybox(x, y, col_side);
}
开发者ID:bingmann,项目名称:bingmann.github.io,代码行数:54,代码来源:world.cpp


示例8: bump

void
Upgrade::collision(void* p_c_object, int c_object, CollisionType type)
{
  Player* pplayer = NULL;

  if(type == COLLISION_BUMP) {
    if(c_object == CO_PLAYER)
      pplayer = (Player*) p_c_object;
    bump(pplayer);
    return;
  }

  switch (c_object)
    {
    case CO_PLAYER:
      /* Remove the upgrade: */

      /* p_c_object is CO_PLAYER, so assign it to pplayer */
      pplayer = (Player*) p_c_object;

      /* Affect the player: */

      if (kind == UPGRADE_GROWUP)
        {
          play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER);
          pplayer->grow();
        }
      else if (kind == UPGRADE_ICEFLOWER)
        {
          play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER);
          pplayer->grow();
          pplayer->got_coffee = true;
        }
      else if (kind == UPGRADE_HERRING)
        {
          play_sound(sounds[SND_HERRING], SOUND_CENTER_SPEAKER);
          pplayer->invincible_timer.start(TUX_INVINCIBLE_TIME);
          World::current()->play_music(HERRING_MUSIC);
        }
      else if (kind == UPGRADE_1UP)
        {
          if(player_status.lives < MAX_LIVES) {
            player_status.lives++;
            play_sound(sounds[SND_LIFEUP], SOUND_CENTER_SPEAKER);
          }
        }

      remove_me();
      return;
    }
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:51,代码来源:special.cpp


示例9: play_sound

void MelnormeShot::calculate()
{
	STACKTRACE;
	if (released) {
		Shot::calculate();
	} else {
		SpaceObject::calculate();
	}
	if (!exists()) return;
	frame_step += frame_time;
	if (frame_step >= frame_size) {
		frame_step -= frame_size;
		frame++;
		if (frame == frame_count) {
			frame = 0;
			if ((!released) && (charge_phase < 3)) {
				charge_frame++;
				if (charge_frame == 5) {
					charge_frame = 0;
					charge_phase++;
					damage_factor *= 2;
					armour *= 2;
					range += RangeUp;
					play_sound(data->sampleWeapon[0]);
				}
			}
		}
	}
	sprite_index = (charge_phase * 10) + frame;
	if (!released) {
		if (!ship || !ship->fire_weapon) {
			//			vx = cos(angle) * v;
			//			vy = sin(angle) * v;
			vel = v * unit_vector(angle);
			released = TRUE;
			play_sound(data->sampleSpecial[0]);
		} else {
			angle = ship->get_angle();
			//			x = ship->normal_x() + (cos(angle) * (ship->width() / 2.0));
			//			y = ship->normal_y() + (sin(angle) * (ship->height() / 2.0));
			pos = ship->normal_pos() + 0.5 * product(unit_vector(angle), ship->get_size());
			//			vx = ship->get_vx();
			//			vy = ship->get_vy();
			vel = ship->get_vel();

		}
	}
	return;
}
开发者ID:argarak,项目名称:tw-light,代码行数:49,代码来源:shpmeltr.cpp


示例10: keys_keys

void
keys_keys ()
{
  static int      lscan_code;
  int             scan_code;
  scan_code = GetKey ();
  if (!scan_code && lscan_code)
    {
      keys[player][keynum] = lscan_code;
      keynum++;
#ifdef SOUND
      if (ssound)
	play_sound (S_CREATOR2);
#endif
      if (keynum > (rotation[player] ? 2 : 3))
	{
	  player++;
	  keynum = 0;
	  if (player > lastplayer)
	    {
	      change_menu ();
	      gamemode = MENU;
	    }
	}
    }
  lscan_code = scan_code;
}
开发者ID:lkundrak,项目名称:koules,代码行数:27,代码来源:menu.c


示例11: play_sound

// detects bullet hits
void Game::detectHits(bool gameMuted) {
    // loop through each bullet and detect
    // collsion against each enemy
    for(int i = 0; i < this->player.shots.size(); i++) {
        for(int j = 0; j < this->enemies.size(); j++) {
            // if the two elements intersect
            if(intersects(this->player.shots[i], this->enemies[j])) {
                this->player.shots.erase(this->player.shots.begin() + i);
                this->enemies.erase(this->enemies.begin() + j);
                this->PLAYER_SCORE += 10;
                if(!gameMuted)
                    play_sound("impact.wav");
                break;
            }
        }
    }

    // loop through enemy bullets and detect
    // collision against player
    for(int i = 0; i < this->enemyShots.size(); i++ ) {
        if(intersects(this->enemyShots[i], this->player)) {
            this->enemyShots.erase(this->enemyShots.begin() + i);
            this->PLAYER_LIVES--;
        }
    }
}
开发者ID:Shaneprrlt,项目名称:penguin-2D-game,代码行数:27,代码来源:Game.cpp


示例12: os_start_sample

void os_start_sample (int number, int volume, int repeats, zword eos)
{
  /* INCOMPLETE */

  sigset_t sigchld_mask;
  struct sigaction sa;

  os_prepare_sample(number);
  if (! sound_buffer)
    return;
  os_stop_sample(0);

  sigemptyset(&sigchld_mask);
  sigaddset(&sigchld_mask, SIGCHLD);
  sigprocmask(SIG_BLOCK, &sigchld_mask, NULL);

  child_pid = fork();

  if (child_pid < 0) {          /* error in fork */
    perror("fork");
    return;
  }
  else if (child_pid == 0) {    /* child */
    sigprocmask(SIG_UNBLOCK, &sigchld_mask, NULL);
    play_sound(volume, repeats);
  }
  else {                        /* parent */
    sa.sa_handler = sigchld_handler;
    sigemptyset(&sa.sa_mask);
    sa.sa_flags = 0;
    sigaction(SIGCHLD, &sa, NULL);

    sigprocmask(SIG_UNBLOCK, &sigchld_mask, NULL);
  }
}/* os_start_sample */
开发者ID:BAM-X,项目名称:frotz,代码行数:35,代码来源:ux_audio_oss.c


示例13: _delete_enemy

static void* _delete_enemy(ListAnchor *enemies, List* enemy, void *arg) {
	Enemy *e = (Enemy*)enemy;

	if(e->hp <= 0 && e->hp != ENEMY_IMMUNE && e->hp != ENEMY_BOMB) {
		play_sound("enemydeath");

		for(int i = 0; i < 10; i++) {
			tsrand_fill(2);

			PARTICLE(
				.sprite = "flare",
				.pos = e->pos,
				.timeout = 10,
				.rule = linear,
				.draw_rule = Fade,
				.args = { (3+afrand(0)*10)*cexp(I*afrand(1)*2*M_PI) },
			);
		}

		PARTICLE(.proto = pp_blast, .pos = e->pos, .timeout = 20, .draw_rule = Blast, .flags = PFLAG_REQUIREDPARTICLE);
		PARTICLE(.proto = pp_blast, .pos = e->pos, .timeout = 20, .draw_rule = Blast, .flags = PFLAG_REQUIREDPARTICLE);
		PARTICLE(.proto = pp_blast, .pos = e->pos, .timeout = 15, .draw_rule = GrowFade, .flags = PFLAG_REQUIREDPARTICLE);

		for(Projectile *p = global.projs.first; p; p = p->next) {
			if(p->type == PROJ_ENEMY && !(p->flags & PFLAG_NOCOLLISION) && cabs(p->pos - e->pos) < 64) {
				spawn_and_collect_item(e->pos, ITEM_PIV, 1);
			}
		}
	}
开发者ID:laochailan,项目名称:taisei,代码行数:29,代码来源:enemy.c


示例14: play_sound

void TauFiendPWave::inflict_damage(SpaceObject *other)
{
	STACKTRACE;
	play_sound(explosionSample);
	add(new TauFiendPEffect(this, (Ship*)other, explosionSprite, emp_fs, delay));
	state = 0;
}
开发者ID:Yurand,项目名称:tw-light,代码行数:7,代码来源:shptaufi.cpp


示例15: if

void TauFiend::calculate_fire_special()
{
	STACKTRACE;
	if (cooling_count > 0) cooling_count -= frame_time;
	if ((!fire_special) || (batt == 0)) {
		if (charge_count >= 0)
			charge_count -= frame_time;
	}
	else    if ((fire_special) && (cooling_count <= 0)) {
		if (charge_count < charge_time) {
			charge_count += frame_time;
			residual_drain += frame_time * (double)special_drain / charge_time;
		} else {
			cooling_count = cooling_time;
			charge_count = -1;
			play_sound(data->sampleSpecial[0]);
			add(new TauFiendPWave(Vector2(0, 30), angle, specialVelocity, specialRange, this,
				data->spriteSpecialExplosion, specialRelativity, specialSap, specialDuration));
		}
	}
	int a = (int)floor(residual_drain);
	batt -= a;
	if (batt < 0) batt = 0;
	residual_drain -= a;
	if (residual_drain < 0) residual_drain = 0;
}
开发者ID:Yurand,项目名称:tw-light,代码行数:26,代码来源:shptaufi.cpp


示例16: GetGlobalPathManager

void
CSoundFX::PlaySoundFX (UINT IDButton, UINT IDWindow, BOOL UseDefault /*= TRUE*/)
{
   LPCSTR   fn;
   int      i;

   for (i = 0; i < NUM_SOUNDFX; i++)
   {
      if (SoundIndex >= NUM_SOUNDFX)
         SoundIndex = 0;

      if ((Sound [SoundIndex].WindowID == IDWindow) && (Sound [SoundIndex].ControlID == IDButton))
         break;
      
      SoundIndex ++;
   } 

   if (i >= NUM_SOUNDFX)   // Didn't find it, use default sound (maybe)
   {
      if (UseDefault != TRUE)
         return;

      fn = FileName [0];
   }
   else
      fn = FileName [Sound [SoundIndex].FileNameIndex];

   CString csName = GetGlobalPathManager()->ExpandPath((char *)fn);
   play_sound ((LPSTR)(LPCSTR)csName, 0, NULL, FALSE);
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:30,代码来源:SOUNDFX.CPP


示例17: play_note

void play_note(){
	if(notes[note_index].freq==WAIT_FREQ){
		stop_sound();
	} else {
		play_sound(notes[note_index].freq);
	}
}
开发者ID:dvarubla,项目名称:os_course_works,代码行数:7,代码来源:main_prog.c


示例18: play_sound

void Dodger::check_if_eating(int new_cell)
{
    if (new_cell == Level::apple
            || new_cell == Level::sberry
            || new_cell == Level::cherry) {
        level.food_count--;
        level.data[player_line][player_col] = Level::grid;

        play_sound(sounds.chomp);

        switch (new_cell) {
        case Level::apple:
            score += 20;
            break;
        case Level::sberry:
            score += 30;
            break;
        case Level::cherry:
            score += 50;
            break;
        }

        score_panel.set_score(score);
        if (score > high_score) {
            high_score = score;
            score_panel.set_high_score(high_score);
        }
    }
}
开发者ID:funchal,项目名称:dodger-remake,代码行数:29,代码来源:dodger.cpp


示例19: unit_vector

int EarthlingCruiserMk3::activate_special()
{
	STACKTRACE;
	bool fire = false;;
	SpaceObject *o;
	double rng = 1e40;
	SpaceObject *tgt = NULL;

								 //!!!
	pos -= unit_vector(angle) * 6;
	Query q;
	for (q.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) +
	bit(LAYER_CBODIES), specialRange); q.current; q.next()) {
		o = q.currento;
		if (!o->isInvisible() && !o->sameTeam(this) && (o->collide_flag_anyone&bit(LAYER_LINES))
		&& (distance(o) < rng)) {
			tgt = o;
			rng = distance(o);
		}
	}
	q.end();
								 //!!!
	pos += unit_vector(angle) * 6;

	if (tgt) {
		game->add(new EarthlingCruiserMk3Beam(this, Vector2(0,-6), specialRange,
			specialDamage, specialDamageShots, specialFrames, tgt));
		play_sound(data->sampleSpecial[0]);
		fire = true;
	}

	return(fire);
}
开发者ID:argarak,项目名称:tw-light,代码行数:33,代码来源:shpearc3.cpp


示例20: handle_lever

bool handle_lever(location w) {
	if(cChoiceDlog("basic-lever",{"pull", "leave"}).show() == "leave")
		return false;
	play_sound(94);
	alter_space(w.x,w.y,univ.scenario.ter_types[univ.town->terrain(w.x,w.y)].trans_to_what);
	return true;
}
开发者ID:LibreGames,项目名称:cboe,代码行数:7,代码来源:boe.townspec.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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