本文整理汇总了C++中attotime::as_double方法的典型用法代码示例。如果您正苦于以下问题:C++ attotime::as_double方法的具体用法?C++ attotime::as_double怎么用?C++ attotime::as_double使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类attotime
的用法示例。
在下文中一共展示了attotime::as_double方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sync_separator
int fixedfreq_device::sync_separator(attotime time, double newval)
{
int last_vsync = m_sig_vsync;
int last_comp = m_sig_composite;
int ret = 0;
m_vint += ((double) last_comp - m_vint) * (1.0 - exp(-time.as_double() * m_mult));
m_sig_composite = (newval < m_sync_threshold) ? 1 : 0 ;
m_sig_vsync = (m_vint > m_int_trig) ? 1 : 0;
if (!last_vsync && m_sig_vsync)
{
/* TODO - time since last hsync and field detection */
ret |= 1;
}
if (last_vsync && !m_sig_vsync)
{
m_sig_field = last_comp; /* force false-progressive */
m_sig_field = (m_sig_field ^ 1) ^ last_comp; /* if there is no field switch, auto switch */
VERBOSE_OUT(("Field: %d\n", m_sig_field));
}
if (!last_comp && m_sig_composite)
{
/* TODO - time since last hsync and field detection */
ret |= 2;
}
if (last_comp && !m_sig_composite)
{
/* falling composite */
ret |= 4;
}
return ret;
}
示例2: calc_plunger_pos
double mgolf_state::calc_plunger_pos()
{
return (machine().time().as_double() - m_time_released.as_double()) * (m_time_released.as_double() - m_time_pushed.as_double() + 0.2);
}
示例3: run_test
static messtest_result_t run_test(int flags, messtest_results *results)
{
const game_driver *driver;
messtest_result_t rc;
clock_t begin_time;
double real_run_time;
astring *fullpath = NULL;
const char *device_opt;
const char *fake_argv[2];
core_options *opts;
/* lookup driver */
driver = driver_get_name(current_testcase.driver);
/* cannot find driver? */
if (driver == NULL)
{
report_message(MSG_FAILURE, "Cannot find driver '%s'", current_testcase.driver);
return MESSTEST_RESULT_STARTFAILURE;
}
/* prepare testing state */
current_command = current_testcase.commands;
state = STATE_READY;
test_flags = flags;
screenshot_num = 0;
runtime_hash = 0;
had_failure = FALSE;
//videoram = NULL;
//videoram_size = 0;
/* set up options */
opts = mame_options_init(win_mess_opts);
options_set_string(opts, OPTION_GAMENAME, driver->name, OPTION_PRIORITY_CMDLINE);
if( current_testcase.bios )
options_set_string(opts, OPTION_BIOS, current_testcase.bios, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_SKIP_GAMEINFO, TRUE, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_THROTTLE, FALSE, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_DEBUG, FALSE, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_DEBUG_INTERNAL, FALSE, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_WRITECONFIG, FALSE, OPTION_PRIORITY_CMDLINE);
if (current_testcase.ram != 0)
{
options_set_int(opts, OPTION_RAMSIZE, current_testcase.ram, OPTION_PRIORITY_CMDLINE);
}
/* ugh... hideous ugly fake arguments */
fake_argv[0] = "MESSTEST";
fake_argv[1] = driver->name;
options_parse_command_line(opts, ARRAY_LENGTH(fake_argv), (char **) fake_argv, OPTION_PRIORITY_CMDLINE,TRUE);
/* preload any needed images */
while(current_command->command_type == MESSTEST_COMMAND_IMAGE_PRELOAD)
{
/* get the path */
fullpath = assemble_software_path(astring_alloc(), driver, current_command->u.image_args.filename);
/* get the option name */
device_opt = device_config_image_interface::device_typename(current_command->u.image_args.device_ident.type);
/* set the option */
options_set_string(opts, device_opt, astring_c(fullpath), OPTION_PRIORITY_CMDLINE);
/* cleanup */
astring_free(fullpath);
fullpath = NULL;
/* next command */
current_command++;
}
/* perform the test */
report_message(MSG_INFO, "Beginning test (driver '%s')", current_testcase.driver);
begin_time = clock();
mame_set_output_channel(OUTPUT_CHANNEL_ERROR, messtest_output_error, NULL, NULL, NULL);
mame_set_output_channel(OUTPUT_CHANNEL_WARNING, mame_null_output_callback, NULL, NULL, NULL);
mame_set_output_channel(OUTPUT_CHANNEL_INFO, mame_null_output_callback, NULL, NULL, NULL);
mame_set_output_channel(OUTPUT_CHANNEL_DEBUG, mame_null_output_callback, NULL, NULL, NULL);
mame_set_output_channel(OUTPUT_CHANNEL_LOG, mame_null_output_callback, NULL, NULL, NULL);
test_osd_interface osd;
mame_execute(osd, opts);
real_run_time = ((double) (clock() - begin_time)) / CLOCKS_PER_SEC;
/* what happened? */
switch(state)
{
case STATE_ABORTED:
report_message(MSG_FAILURE, "Test aborted");
rc = MESSTEST_RESULT_RUNTIMEFAILURE;
break;
case STATE_DONE:
if (had_failure)
{
report_message(MSG_FAILURE, "Test failed (real time %.2f; emu time %.2f [%i%%])",
real_run_time, final_time.as_double(), (int) ((final_time.as_double() / real_run_time) * 100));
rc = MESSTEST_RESULT_RUNTIMEFAILURE;
}
else
//.........这里部分代码省略.........