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

C++ sample_start函数代码示例

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

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



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

示例1: astrof_sample1_w

void astrof_sample1_w(int offset,int data)
{
	static int last = 0;

	if (death_playing)
	{
		death_playing = sample_playing(CHANNEL_EXPLOSION);
	}

	if (bosskill_playing)
	{
		bosskill_playing = sample_playing(CHANNEL_EXPLOSION);
	}

	/* Bit 2 - Explosion trigger */
	if ((data & 0x04) && !(last & 0x04))
	{
		/* I *know* that the effect select port will be written shortly
		   after this one, so this works */
		start_explosion = 1;
	}

	/* Bit 0/1/3 - Background noise */
	if ((data & 0x08) != (last & 0x08))
	{
		if (data & 0x08)
		{
			int sample = SAMPLE_WAVE + (data & 3);
			sample_start(CHANNEL_WAVE,sample,1);
		}
		else
		{
			sample_stop(CHANNEL_WAVE);
		}
	}

	/* Bit 4 - Boss Laser */
	if ((data & 0x10) && !(last & 0x10))
	{
		if (!bosskill_playing)
		{
			sample_start(CHANNEL_BOSSFIRE,SAMPLE_BOSSFIRE,0);
		}
	}

	/* Bit 5 - Fire */
	if ((data & 0x20) && !(last & 0x20))
	{
		if (!bosskill_playing)
		{
			sample_start(CHANNEL_FIRE,SAMPLE_FIRE,0);
		}
	}

	/* Bit 6 - Don't know. Probably something to do with the explosion sounds */

	/* Bit 7 - Don't know. Maybe a global sound enable bit? */

	last = data;
}
开发者ID:OS2World,项目名称:APP-EMULATION-MAME,代码行数:60,代码来源:astrof.c


示例2: proc_mechsounds

/* Check if a sample is specified for changed solenoid */
void proc_mechsounds(int sol, int newState) {
  if ((sol == sLRFlip) ||
      ((sol == sURFlip) && (core_gameData->hw.flippers & FLIP_SOL(FLIP_UR))))
    sample_start(0, newState ? SAM_RFLIPPER : SAM_SOLENOID_OFF,0);
  else if ((sol == sLLFlip) ||
           ((sol == sULFlip) && (core_gameData->hw.flippers & FLIP_SOL(FLIP_UL))))
    sample_start(2, newState ? SAM_LFLIPPER : SAM_SOLENOID_OFF,0);
  else {
    wpc_tSamSolMap *item = core_gameData->hw.solsammap;
    if (item) {
	  while (item->solname >= 0 && item->solname != sol)
			item++;
	  if(item->solname >= 0 && item->solname == sol) {
		if (newState) {
	        if (item->flags == WPCSAM_F_OFFON)
	          sample_start(item->channel, item->samname, 0);
		    else if (item->flags == WPCSAM_F_CONT)
              sample_start(item->channel, item->samname, 1);
		}
		else {
			if (item->flags == WPCSAM_F_ONOFF)
              sample_start(item->channel, item->samname, 0);
            else if (item->flags == WPCSAM_F_CONT)
	          sample_stop(item->channel);
		}
	    item++;
      } /* if(item->solname >=0 */
    } /* if (item) */
  }
}
开发者ID:Bremma,项目名称:pinmame,代码行数:31,代码来源:wpcsam.c


示例3: invaders_sh_port3_w

void invaders_sh_port3_w(int offset, int data)
{
	static unsigned char Sound = 0;

	if (data & 0x01 && ~Sound & 0x01)
		sample_start (0, 0, 1);

	if (~data & 0x01 && Sound & 0x01)
		sample_stop (0);

	if (data & 0x02 && ~Sound & 0x02)
		sample_start (1, 1, 0);

	if (data & 0x04 && ~Sound & 0x04)
		sample_start (2, 2, 0);

	if (~data & 0x04 && Sound & 0x04)
		sample_stop (2);

	if (data & 0x08 && ~Sound & 0x08)
		sample_start (3, 3, 0);

	if (data & 0x10 && ~Sound & 0x10)
		sample_start (4, 9, 0);

	invaders_screen_red_w(data & 0x04);

	Sound = data;
}
开发者ID:cdrr,项目名称:MAME_hack,代码行数:29,代码来源:8080bw.c


示例4: tape_set_motor

static void tape_set_motor( int bOn )
{
	if( bOn )
	{
		/* If talk track is not playing, start it. */
		if (! sample_playing( kTalkTrack ))
			sample_start( 0, kTalkTrack, 1 );

		/* Resume playback of talk track. */
		sample_set_pause( kTalkTrack, 0);


		/* If crash track is not playing, start it. */
		if (! sample_playing( kCrashTrack ))
			sample_start( 1, kCrashTrack, 1 );

		/* Resume playback of crash track. */
		sample_set_pause( kCrashTrack, 0);
	}
	else
	{
		/* Pause both the talk and crash tracks. */
		sample_set_pause( kTalkTrack, 1 );
		sample_set_pause( kCrashTrack, 1 );
	}
}
开发者ID:broftkd,项目名称:historic-mame,代码行数:26,代码来源:thief.c


示例5: invaders_sh_1_w

static void invaders_sh_1_w(int board, int data, unsigned char *last)
{
	int base_channel, base_sample;

	base_channel = 4 * board;
	base_sample  = 9 * board;

	SN76477_enable_w(board, !(data & 0x01));				/* Saucer Sound */

	if (data & 0x02 && ~*last & 0x02)
		sample_start (base_channel+0, base_sample+0, 0);	/* Shot Sound */

	if (data & 0x04 && ~*last & 0x04)
		sample_start (base_channel+1, base_sample+1, 0);	/* Base Hit */

	if (~data & 0x04 && *last & 0x04)
		sample_stop (base_channel+1);

	if (data & 0x08 && ~*last & 0x08)
		sample_start (base_channel+0, base_sample+2, 0);	/* Invader Hit */

	if (data & 0x10 && ~*last & 0x10)
		sample_start (base_channel+2, 8, 0);				/* Bonus Missle Base */

	invaders_screen_red_w(data & 0x04);

	*last = data;
}
开发者ID:AlanApter,项目名称:steamlink-sdk,代码行数:28,代码来源:8080bw.c


示例6: dragrace_start_anim

void dragrace_start_anim (void) {
	//ball_search_timer_reset();

	// TODO show graphic of racetrack starting grid or something suitable

	// ready
	lamp_tristate_on(LM_TREE_TOP_YELLOW);
	dmd_alloc_low_clean ();
	font_render_string_center (&font_supercar9, 64, 16, "READY");
	dmd_show_low ();
	sample_start (SND_RACE_STARTER_01, SL_500MS);
	task_sleep_sec(1);

	// set
	lamp_tristate_on(LM_TREE_BOTTOM_YELLOW);
	dmd_alloc_low_clean ();
	font_render_string_center (&font_supercar9, 64, 16, "SET");
	dmd_show_low ();
	sample_start (SND_RACE_STARTER_01, SL_500MS);
	task_sleep_sec(1);

	// go
	lamp_tristate_flash(LM_LEFT_TREE_GREEN);
	lamp_tristate_flash(LM_RIGHT_TREE_GREEN);
	dmd_alloc_low_clean ();
	font_render_string_center (&font_supercar9, 64, 16, "GO");
	dmd_show_low ();
	sample_start (SND_RACE_STARTER_02, SL_2S);
}
开发者ID:hydra,项目名称:freewpc,代码行数:29,代码来源:vmode_dragrace.c


示例7: invaders_sh_2_w

static void invaders_sh_2_w(int board, int data, unsigned char *last)
{
	int base_channel, base_sample;

	base_channel = 4 * board;
	base_sample  = 9 * board;

	if (data & 0x01 && ~*last & 0x01)
		sample_start (base_channel+1, base_sample+3, 0);	/* Fleet 1 */

	if (data & 0x02 && ~*last & 0x02)
		sample_start (base_channel+1, base_sample+4, 0);	/* Fleet 2 */

	if (data & 0x04 && ~*last & 0x04)
		sample_start (base_channel+1, base_sample+5, 0);	/* Fleet 3 */

	if (data & 0x08 && ~*last & 0x08)
		sample_start (base_channel+1, base_sample+6, 0);	/* Fleet 4 */

	if (data & 0x10 && ~*last & 0x10)
		sample_start (base_channel+3, base_sample+7, 0);	/* Saucer Hit */

	invaders_flip_screen_w(data & 0x20);

	*last = data;
}
开发者ID:AlanApter,项目名称:steamlink-sdk,代码行数:26,代码来源:8080bw.c


示例8: triplhnt_update_misc

static void triplhnt_update_misc(running_machine &machine, int offset)
{
	triplhnt_state *state = machine.driver_data<triplhnt_state>();
	device_t *samples = machine.device("samples");
	device_t *discrete = machine.device("discrete");
	UINT8 is_witch_hunt;
	UINT8 bit = offset >> 1;

	/* BIT0 => UNUSED      */
	/* BIT1 => LAMP        */
	/* BIT2 => SCREECH     */
	/* BIT3 => LOCKOUT     */
	/* BIT4 => SPRITE ZOOM */
	/* BIT5 => CMOS WRITE  */
	/* BIT6 => TAPE CTRL   */
	/* BIT7 => SPRITE BANK */

	if (offset & 1)
	{
		state->m_misc_flags |= 1 << bit;

		if (bit == 5)
		{
			state->m_cmos[state->m_cmos_latch] = state->m_da_latch;
		}
	}
	else
	{
		state->m_misc_flags &= ~(1 << bit);
	}

	state->m_sprite_zoom = (state->m_misc_flags >> 4) & 1;
	state->m_sprite_bank = (state->m_misc_flags >> 7) & 1;

	set_led_status(machine, 0, state->m_misc_flags & 0x02);

	coin_lockout_w(machine, 0, !(state->m_misc_flags & 0x08));
	coin_lockout_w(machine, 1, !(state->m_misc_flags & 0x08));

	discrete_sound_w(discrete, TRIPLHNT_SCREECH_EN, state->m_misc_flags & 0x04);	// screech
	discrete_sound_w(discrete, TRIPLHNT_LAMP_EN, state->m_misc_flags & 0x02);	// Lamp is used to reset noise
	discrete_sound_w(discrete, TRIPLHNT_BEAR_EN, state->m_misc_flags & 0x80);	// bear

	is_witch_hunt = input_port_read(machine, "0C09") == 0x40;
	bit = ~state->m_misc_flags & 0x40;

	/* if we're not playing the sample yet, start it */
	if (!sample_playing(samples, 0))
		sample_start(samples, 0, 0, 1);
	if (!sample_playing(samples, 1))
		sample_start(samples, 1, 1, 1);

	/* bit 6 turns cassette on/off */
	sample_set_pause(samples, 0,  is_witch_hunt || bit);
	sample_set_pause(samples, 1, !is_witch_hunt || bit);
}
开发者ID:rogerjowett,项目名称:ClientServerMAME,代码行数:56,代码来源:triplhnt.c


示例9: WRITE8_HANDLER

static WRITE8_HANDLER( tankbatt_sh_engine_w )
{
	const device_config *samples = devtag_get_device(space->machine, "samples");
	if (tankbatt_sound_enable)
	{
		if (data)
			sample_start (samples, 2, 2, 1);
		else
			sample_start (samples, 2, 1, 1);
	}
	else sample_stop (samples, 2);
}
开发者ID:Paulodx,项目名称:sdl-mame-wii,代码行数:12,代码来源:tankbatt.c


示例10: WRITE8_HANDLER

static WRITE8_HANDLER( tankbatt_sh_engine_w )
{
	tankbatt_state *state = space->machine().driver_data<tankbatt_state>();
	device_t *samples = space->machine().device("samples");
	if (state->m_sound_enable)
	{
		if (data)
			sample_start (samples, 2, 2, 1);
		else
			sample_start (samples, 2, 1, 1);
	}
	else sample_stop (samples, 2);
}
开发者ID:vikke,项目名称:mame_0145,代码行数:13,代码来源:tankbatt.c


示例11: trigger_sample

static void trigger_sample(device_t *samples, UINT8 data)
{
	gottlieb_state *state = samples->machine().driver_data<gottlieb_state>();
	/* Reactor samples */
	if (strcmp(samples->machine().system().name, "reactor") == 0)
	{
		switch (data)
		{
			case 55:
			case 56:
			case 57:
			case 59:
				sample_start(samples, 0, data - 53, 0);
				break;

			case 31:
				state->m_score_sample = 7;
				break;

			case 39:
				state->m_score_sample++;
				if (state->m_score_sample < 20)
					sample_start(samples, 0, state->m_score_sample, 0);
				break;
		}
	}

	/* Q*Bert samples */
	else
	{
		switch (data)
		{
			case 17:
			case 18:
			case 19:
			case 20:
			case 21:
				sample_start(samples, 0, (data - 17) * 8 + state->m_random_offset, 0);
				state->m_random_offset = (state->m_random_offset + 1) & 7;
				break;

			case 22:
				sample_start(samples, 0,40,0);
				break;

			case 23:
				sample_start(samples, 0,41,0);
				break;
		}
	}
}
开发者ID:cdenix,项目名称:psmame,代码行数:51,代码来源:gottlieb.c


示例12: barrier_sound_w

static void barrier_sound_w(UINT8 sound_val, UINT8 bits_changed)
{
	/* Player die - rising edge */
	if (SOUNDVAL_RISING_EDGE(0x01))
		sample_start(0, 0, 0);

	/* Player move - falling edge */
	if (SOUNDVAL_FALLING_EDGE(0x02))
		sample_start(1, 1, 0);

	/* Enemy move - falling edge */
	if (SOUNDVAL_FALLING_EDGE(0x04))
		sample_start(2, 2, 0);
}
开发者ID:CrouchingLlama,项目名称:openlase-mame,代码行数:14,代码来源:cinemat.c


示例13: gottlieb_sh_w

void gottlieb_sh_w(int offset,int data)
{
	data &= 0xff;

	if (data != 0xff)
	{
		if (Machine->gamedrv->samplenames)
		{
			/* if we have loaded samples, we must be Q*Bert */
			switch(data ^ 0xff)
			{
				case 0x12:
					/* play a sample here (until Votrax speech is emulated) */
					sample_start (0, 0, 0);
					break;

				case 0x14:
					/* play a sample here (until Votrax speech is emulated) */
					sample_start (0, 1, 0);
					break;

				case 0x16:
					/* play a sample here (until Votrax speech is emulated) */
					sample_start (0, 2, 0);
					break;

				case 0x11:
					/* play a sample here (until Votrax speech is emulated) */
					sample_start (0, 3, 0);
					break;
			}
		}

		soundlatch_w(offset,data);

		switch (cpu_gettotalcpu())
		{
		case 2:
			/* Revision 1 sound board */
			cpu_cause_interrupt(1,M6502_INT_IRQ);
			break;
		case 3:
		case 4:
			/* Revision 2 & 3 sound board */
			cpu_cause_interrupt(cpu_gettotalcpu()-1,M6502_INT_IRQ);
			cpu_cause_interrupt(cpu_gettotalcpu()-2,M6502_INT_IRQ);
			break;
		}
	}
}
开发者ID:cyberkni,项目名称:276in1JAMMA,代码行数:50,代码来源:gottlieb.cpp


示例14: trigger_sample

static void trigger_sample(const device_config *samples, UINT8 data)
{
	/* Reactor samples */
	if (strcmp(samples->machine->gamedrv->name, "reactor") == 0)
	{
		switch (data)
		{
			case 55:
			case 56:
			case 57:
			case 59:
				sample_start(samples, 0, data - 53, 0);
				break;

			case 31:
				score_sample = 7;
				break;

			case 39:
				score_sample++;
				if (score_sample < 20)
					sample_start(samples, 0, score_sample, 0);
				break;
		}
	}

	/* Q*Bert samples */
	else
	{
		switch (data)
		{
			case 17:
			case 18:
			case 19:
			case 20:
			case 21:
				sample_start(samples, 0, (data - 17) * 8 + random_offset, 0);
				random_offset = (random_offset + 1) & 7;
				break;

			case 22:
				sample_start(samples, 0,40,0);
				break;

			case 23:
				sample_start(samples, 0,41,0);
				break;
		}
	}
}
开发者ID:nitrologic,项目名称:emu,代码行数:50,代码来源:gottlieb.c


示例15: pitstop_award_deff

void pitstop_award_deff(void) {

    // must happen in the deff so it doesn't crash in test mode due to uninitialised list of items
    determine_allowable_pitstop_awards();

    U8 pitstop_award_items_remaining;
    for (pitstop_award_items_remaining = PITSTOP_AWARD_ITEMS; pitstop_award_items_remaining >= 1 ; pitstop_award_items_remaining--) {
        dbprintf("remaining items: %d\n", pitstop_award_items_remaining);
        pitstop_award_draw();
        task_sleep_sec(1);

        if (pitstop_award_items_remaining >= 3) {
            sample_start (SND_TRAFFIC_ZOOM_02, SL_4S);
            eliminate_pitstop_award();
        } else if (pitstop_award_items_remaining == 2) {
            sample_start (SND_TRAFFIC_ZOOM_05, SL_4S);
            eliminate_pitstop_award();
        } else if (pitstop_award_items_remaining == 1) {
            sample_start (SND_TRAFFIC_ZOOM_03, SL_4S);
        }
        dmd_invert_page (dmd_low_buffer);
        dmd_show_low();
        task_sleep(TIME_100MS);
    }

    // find the one remaining award

    pitstop_award = DISABLED_AWARD;
    for (pitstop_award_index = 0; pitstop_award_index < PITSTOP_AWARD_ITEMS; pitstop_award_index++) {
        if (selected_pitstop_awards[pitstop_award_index] != DISABLED_AWARD) {
            pitstop_award = selected_pitstop_awards[pitstop_award_index];
        }
    }
    dbprintf("%s\n", pitstop_award_options_titles[pitstop_award]);

    // flash the remaining award

    dmd_alloc_pair ();
    dmd_clean_page_low ();
    font_render_string_center (&font_var5, 64, 16, pitstop_award_options_titles[pitstop_award]);
    dmd_show_low ();
    dmd_copy_low_to_high ();
    dmd_invert_page (dmd_low_buffer);
    deff_swap_low_high (10, TIME_100MS);

    deff_exit (); // ball will be ejected from popper soon

}
开发者ID:hydra,项目名称:freewpc,代码行数:48,代码来源:pitstop_award.c


示例16: CALLSET_ENTRY

CALLSET_ENTRY (trivial, sw_outer_right_inlane)
{
	fh_clock_advance (CLK_5_MIN);
	score (SC_10K);
	rudy_look_straight ();
	sample_start (SND_OUTER_RIGHT_INLANE, SL_500MS);
}
开发者ID:Dave2084,项目名称:freewpc,代码行数:7,代码来源:trivial.c


示例17: cryoprison_super_jackpot_deff

/****************************************************************************
 *
 * DMD display and sound effects
 *
 ****************************************************************************/
void cryoprison_super_jackpot_deff (void) {
	U8 i;

	for (i = 0; i < 8; i++) {
		switch (i) {
				case 0: sound_start (ST_SPEECH, SPCH_AHHHGGG, SL_2S, PRI_GAME_QUICK5); break;
				case 4: sound_start (ST_SPEECH, SPCH_HURRY_UP, SL_2S, PRI_GAME_QUICK5); break;
				case 8: sound_start (ST_SPEECH, SPCH_CLOSE_ENOUGH, SL_2S, PRI_GAME_QUICK5); break;
				case 1:
				case 3:
				case 5:
				case 7: sound_start (ST_ANY, EXPLOSION1_SHORT, SL_2S, PRI_GAME_QUICK5);
			}//END OF SWITCH
			dmd_sched_transition (&trans_scroll_up);
		dmd_alloc_low_clean ();
		font_render_string_center (&font_fireball, 64, 8, "SUPER");
		font_render_string_center (&font_fireball, 64, 24, "JACKPOT");
		dmd_show_low ();
	}//end of loop
	sample_start (MACHINE14_LONG, SL_1S);
	task_sleep (TIME_500MS);

	speech_start (SPCH_SUPER_JACKPOT, SL_1S);
	task_sleep_sec (1);
	deff_exit ();
}//end of function
开发者ID:CardonaPinball,项目名称:freewpc,代码行数:31,代码来源:cryoprison.c


示例18: barrier_sound_w

static void barrier_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
	running_device *samples = machine->device("samples");

	/* Player die - rising edge */
	if (SOUNDVAL_RISING_EDGE(0x01))
		sample_start(samples, 0, 0, 0);

	/* Player move - falling edge */
	if (SOUNDVAL_FALLING_EDGE(0x02))
		sample_start(samples, 1, 1, 0);

	/* Enemy move - falling edge */
	if (SOUNDVAL_FALLING_EDGE(0x04))
		sample_start(samples, 2, 2, 0);
}
开发者ID:DarrenBranford,项目名称:MAME4iOS,代码行数:16,代码来源:cinemat.c


示例19: WRITE8_HANDLER

static WRITE8_HANDLER( seawolf2_sound_2_w )  /* Port 41 */
{
	game_on = data & 0x80;

	if (game_on)
	{
		/* data & 0x07 control dive L/R panning - not implemented */
		if (data & 0x08)
			sample_start (2, 2, 0);  /* Dive */
		if (data & 0x10)
			sample_start (8, 3, 0);  /* Right Sonar */
		if (data & 0x20)
			sample_start (3, 3, 0);  /* Left Sonar */
	}

	coin_counter_w(0, data & 0x40);    /* Coin Counter */
}
开发者ID:BirchJD,项目名称:xmame-0.103-RPi,代码行数:17,代码来源:astrocde.c


示例20: astrof_sample2_w

void astrof_sample2_w(int offset,int data)
{
	static int last = 0;

	/* Bit 0-2 Explosion select (triggered by Bit 2 of the other port */
	if (start_explosion)
	{
		if (data & 0x04)
		{
			/* This is really a compound effect, made up of I believe 3 sound
			   effects, but since our sample contains them all, disable playing
			   the other effects while the explosion is playing */
			if (!bosskill_playing)
			{
				sample_start(CHANNEL_EXPLOSION,SAMPLE_BOSSKILL,0);
				bosskill_playing = 1;
			}
		}
		else if (data & 0x02)
		{
			sample_start(CHANNEL_EXPLOSION,SAMPLE_BOSSHIT,0);
		}
		else if (data & 0x01)
		{
			sample_start(CHANNEL_EXPLOSION,SAMPLE_EKILLED,0);
		}
		else
		{
			if (!death_playing)
			{
				sample_start(CHANNEL_EXPLOSION,SAMPLE_DEATH,0);
				death_playing = 1;
			}
		}

		start_explosion = 0;
	}

	/* Bit 3 - Low Fuel Warning */
	if ((data & 0x08) && !(last & 0x08))
	{
		sample_start(CHANNEL_FUEL,SAMPLE_FUEL,0);
	}

	last = data;
}
开发者ID:OS2World,项目名称:APP-EMULATION-MAME,代码行数:46,代码来源:astrof.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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