本文整理汇总了C++中TIME_IN_HZ函数的典型用法代码示例。如果您正苦于以下问题:C++ TIME_IN_HZ函数的具体用法?C++ TIME_IN_HZ怎么用?C++ TIME_IN_HZ使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TIME_IN_HZ函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tdr_to_shift
void tdr_to_shift(int which)
{
acia_6850 *acia_p = &acia[which];
int bitrate = acia_p->rx_clock / acia_p->divide;
acia_p->tx_shift = acia[which].tdr;
acia_p->status &= ~STATUS_TDRE;
/* Start the transmit timer */
timer_adjust(acia_p->tx_timer, TIME_IN_HZ(bitrate), which, TIME_IN_HZ(bitrate));
}
示例2: WRITE_HANDLER
static WRITE_HANDLER(play2s_ctrl_w) {
if (!sndlocals.enSn && (data & 1)) { // sound on to full volume
timer_adjust(sndlocals.timer, TIME_NEVER, 0, 0);
if (!mixer_is_sample_playing(sndlocals.channel)) {
mixer_play_sample(sndlocals.channel, (signed char *)squareWave, sizeof(squareWave), 2950000.0 / 4 / (sndlocals.freq + 1), 1);
}
sndlocals.volume = 100;
mixer_set_volume(sndlocals.channel, sndlocals.volume);
} else if (!(data & 1) && sndlocals.enSn) { // start fading
timer_adjust(sndlocals.timer, TIME_IN_HZ(120), 0, TIME_IN_HZ(120));
}
sndlocals.enSn = data & 1;
}
示例3: MACHINE_INIT
static MACHINE_INIT(taito) {
memset(&TAITOlocals, 0, sizeof(TAITOlocals));
TAITOlocals.pDisplayRAM = memory_region(TAITO_MEMREG_CPU) + 0x4080;
TAITOlocals.pCommandsDMA = memory_region(TAITO_MEMREG_CPU) + 0x4090;
TAITOlocals.timer_irq = timer_alloc(timer_irq);
timer_adjust(TAITOlocals.timer_irq, TIME_IN_HZ(TAITO_IRQFREQ), 0, TIME_IN_HZ(TAITO_IRQFREQ));
if (core_gameData->hw.soundBoard)
sndbrd_0_init(core_gameData->hw.soundBoard, TAITO_SCPU, memory_region(TAITO_MEMREG_SCPU), NULL, NULL);
TAITOlocals.vblankCount = 1;
}
示例4: WRITE8_HANDLER
static WRITE8_HANDLER( audio_dac_w)
{
UINT8 *rom = memory_region(REGION_CPU1);
int dac_address = ( data & 0xf0 ) << 8;
int sel = ( ( (~data) >> 1 ) & 2 ) | ( data & 1 );
if ( cur_dac_address != dac_address )
{
cur_dac_address_index = 0;
cur_dac_address = dac_address;
}
else
{
cur_dac_address_index++;
}
if ( sel & 1 )
dac_address += 0x10000;
if ( sel & 2 )
dac_address += 0x10000;
dac_address += 0x10000;
DAC_data_w( 0, rom[dac_address+cur_dac_address_index] );
timer_set( TIME_IN_HZ( 16000 ), 0, dac_irq );
}
示例5: st300_sh_start
static int st300_sh_start(const struct MachineSound *msound) {
int mixing_levels[3] = {30,30,30};
int i;
int s = 0;
memset(&st300loc, 0, sizeof(st300loc));
for (i = 0;i < 9;i++) {
snddatst300.ax[i] = 0;
snddatst300.axb[i] = 0;
snddatst300.c0 = 0;
}
for (i = 0;i < 32000;i++) {
s = (s ? 0 : 1);
if (s) {
sineWaveext[i] = rand();
} else
sineWaveext[i] = 0-rand();
}
st300loc.channel = mixer_allocate_channels(3, mixing_levels);
mixer_set_name (st300loc.channel, "MC6840 #Q2"); // 6840 Output timer 2 (q2) is easy wave + volume from q3
mixer_set_volume(st300loc.channel,0);
mixer_set_name (st300loc.channel+1, "MC6840 #Q1"); // 6840 Output timer 1 (q1) is easy wave + volume always 100
mixer_set_volume(st300loc.channel+1,70*ST300_VOL);
mixer_set_name (st300loc.channel+2, "EXT TIM"); // External Timer (U10) is Noise geneartor + volume from q3
mixer_set_volume(st300loc.channel+2,0);
timer_pulse(TIME_IN_HZ(ST300_INTCLOCK),0x02,st300_pulse); // start internal clock
return 0;
}
示例6: TMS34061_start
int TMS34061_start(struct TMS34061interface *interface)
{
intf = interface;
/* Initialize registers to their default values from the manual */
regs[REG_HORENDSYNC] = 0x10;
regs[REG_HORENDBLNK] = 0x20;
regs[REG_HORSTARTBLNK] = 0x1f0;
regs[REG_HORTOTAL] = 0x200;
regs[REG_VERENDSYNC] = 0x04;
regs[REG_VERENDBLNK] = 0x10;
regs[REG_VERSTARTBLNK] = 0xf0;
regs[REG_VERTOTAL] = 0x100;
regs[REG_DISPUPDATE] = 0x00;
regs[REG_DISPSTART] = 0x00;
regs[REG_VERINT] = 0x00;
regs[REG_CONTROL1] = 0x7000;
regs[REG_CONTROL2] = 0x600;
regs[REG_STATUS] = 0x00;
regs[REG_XYOFFSET] = 0x10;
regs[REG_XYADDRESS] = 0x00;
regs[REG_DISPADDRESS] = 0x00;
regs[REG_VERCOUNTER] = 0x00;
/* Start vertical interrupt timer. */
timer = timer_pulse(TIME_IN_HZ (Machine->drv->frames_per_second),
intf->cpu, TMS34061_intcallback);
return !timer;
}
示例7: Dave_Init
void Dave_Init(void)
{
int i;
//logerror("dave init\n");
Dave_reset();
/* temp! */
nick_virq = 0;
/* initialise 1khz timer */
dave.int_latch = 0;
dave.int_input = 0;
dave.int_enable = 0;
dave.timer_irq = 0;
dave.fifty_hz_state = 0;
dave.one_khz_state = 0;
dave.fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD;
dave.one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD;
timer_pulse(TIME_IN_HZ(1000), 0, dave_1khz_callback);
for (i=0; i<3; i++)
{
dave.Period[i] = ((STEP * Machine->sample_rate)/125000);
dave.Count[i] = ((STEP * Machine->sample_rate)/125000);
dave.level[i] = 0;
}
}
示例8: MSM5205_playmode_w
void MSM5205_playmode_w(int num,int select)
{
struct MSM5205Voice *voice = sndti_token(SOUND_MSM5205, num);
static const int prescaler_table[4] = {96,48,64,0};
int prescaler = prescaler_table[select & 3];
int bitwidth = (select & 4) ? 4 : 3;
if( voice->prescaler != prescaler )
{
stream_update(voice->stream,0);
voice->prescaler = prescaler;
/* timer set */
if( prescaler )
{
double period = TIME_IN_HZ(voice->clock / prescaler);
timer_adjust_ptr(voice->timer, period, period);
}
else
timer_adjust_ptr(voice->timer, TIME_NEVER, 0);
}
if( voice->bitwidth != bitwidth )
{
stream_update(voice->stream,0);
voice->bitwidth = bitwidth;
}
}
示例9: mcr68_common_init
static void mcr68_common_init(void)
{
int i;
/* reset the 6840's */
m6840_status = 0x00;
m6840_status_read_since_int = 0x00;
m6840_msb_buffer = m6840_lsb_buffer = 0;
for (i = 0; i < 3; i++)
{
m6840_state[i].control = 0x00;
m6840_state[i].latch = 0xffff;
m6840_state[i].count = 0xffff;
m6840_state[i].timer = timer_alloc(counter_fired_callback);
m6840_state[i].timer_active = 0;
m6840_state[i].period = m6840_counter_periods[i];
}
/* initialize the clock */
m6840_internal_counter_period = TIME_IN_HZ(Machine->drv->cpu[0].cpu_clock / 10);
/* reset cocktail flip */
mcr_cocktail_flip = 0;
/* initialize the sound */
pia_unconfig();
mcr_sound_init();
}
示例10: mc146818_init
void mc146818_init(MC146818_TYPE type)
{
mc146818 = auto_malloc(sizeof(*mc146818));
memset(mc146818, 0, sizeof(*mc146818));
mc146818->type = type;
mc146818->last_refresh = timer_get_time();
timer_pulse(TIME_IN_HZ(1.0), 0, mc146818_timer);
}
示例11: blstroid_int1_callback
void blstroid_int1_callback (int param)
{
/* generate the interrupt */
cpu_cause_interrupt (0, 1);
/* set ourselves up to go off next frame */
int1_timer[param] = timer_set (TIME_IN_HZ (Machine->drv->frames_per_second), param, blstroid_int1_callback);
}
示例12: WRITE8_HANDLER
static WRITE8_HANDLER( sound_nmi_rate_w )
{
/* rate is controlled by the value written here */
/* this value is latched into up-counters, which are clocked at the */
/* input clock / 256 */
double input_clock = TIME_IN_HZ(4000000/16);
double nmi_rate = input_clock * 256 * (256 - data);
timer_adjust(sound_nmi_timer, nmi_rate, 0, nmi_rate);
}
示例13: cpu_getscanlinetime
double cpu_getscanlinetime(int scanline)
{
double scantime = timer_starttime(refresh_timer) + (double)scanline * scanline_period;
double abstime = timer_get_time();
double result;
/* if we're already past the computed time, count it for the next frame */
if (abstime >= scantime)
scantime += TIME_IN_HZ(Machine->drv->frames_per_second);
/* compute how long from now until that time */
result = scantime - abstime;
/* if it's small, just count a whole frame */
if (result < TIME_IN_NSEC(1))
result += TIME_IN_HZ(Machine->drv->frames_per_second);
return result;
}
示例14: sega_usb_reset
void sega_usb_reset(UINT8 t1_clock_mask)
{
/* halt the USB CPU at reset time */
cpunum_set_input_line(usb.cpunum, INPUT_LINE_RESET, ASSERT_LINE);
/* start the clock timer */
timer_pulse(TIME_IN_HZ(USB_2MHZ_CLOCK / 256), 0, increment_t1_clock);
usb.t1_clock_mask = t1_clock_mask;
}
示例15: cpu_init_refresh_timer
void cpu_init_refresh_timer(void)
{
/* allocate an infinite timer to track elapsed time since the last refresh */
refresh_period = TIME_IN_HZ(Machine->drv->frames_per_second);
refresh_period_inv = 1.0 / refresh_period;
refresh_timer = timer_alloc(NULL);
/* while we're at it, compute the scanline times */
cpu_compute_scanline_timing();
}