diff options
author | Vas Crabb <vas@vastheman.com> | 2016-03-09 18:02:13 +1100 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2016-03-09 23:04:12 +1100 |
commit | 5aea0893a03648efe27025f88d6b98cd48129869 (patch) | |
tree | a60611742f99e96efd2bf0106a8aac1356fbdaad /src/devices/sound | |
parent | 262fc7035a2f5328b97adea11cae1a7d58cd8653 (diff) |
Use type-safe printf for core_file and emu_file, surprisingly few knock-on effects
Properly fix up a couple of places I64FMT was being used, still more to deal with
Diffstat (limited to 'src/devices/sound')
-rw-r--r-- | src/devices/sound/discrete.cpp | 17 | ||||
-rw-r--r-- | src/devices/sound/esqpump.cpp | 10 |
2 files changed, 13 insertions, 14 deletions
diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp index dc66910707f..e09c47c9bf0 100644 --- a/src/devices/sound/discrete.cpp +++ b/src/devices/sound/discrete.cpp @@ -39,6 +39,7 @@ #include "sound/wavwrite.h" #include "discrete.h" #include <atomic> +#include <iostream> /* for_each collides with c++ standard libraries - include it here */ #define for_each(_T, _e, _l) for (_T _e = (_l)->begin_ptr() ; _e <= (_l)->end_ptr(); _e++) @@ -647,15 +648,15 @@ void discrete_device::display_profiling(void) total = list_run_time(m_node_list); count = m_node_list.count(); /* print statistics */ - printf("%s",string_format("Total Samples : %16I64d\n", m_total_samples).c_str()); + util::stream_format(std::cout, "Total Samples : %16d\n", m_total_samples); tresh = total / count; - printf("%s",string_format("Threshold (mean): %16I64d\n", tresh / m_total_samples).c_str()); + util::stream_format(std::cout, "Threshold (mean): %16d\n", tresh / m_total_samples ); for_each(discrete_base_node **, node, &m_node_list) { discrete_step_interface *step; if ((*node)->interface(step)) if (step->run_time > tresh) - printf("%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), (double) step->run_time / (double) total * 100.0, ((double) step->run_time) / (double) m_total_samples); + util::stream_format(std::cout, "%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), double(step->run_time) / double(total) * 100.0, double(step->run_time) / double(m_total_samples)); } /* Task information */ @@ -663,10 +664,10 @@ void discrete_device::display_profiling(void) { tt = step_list_run_time((*task)->step_list); - printf("Task(%d): %8.2f %15.2f\n", (*task)->task_group, tt / (double) total * 100.0, tt / (double) m_total_samples); + util::stream_format(std::cout, "Task(%d): %8.2f %15.2f\n", (*task)->task_group, tt / double(total) * 100.0, tt / double(m_total_samples)); } - printf("Average samples/double->update: %8.2f\n", (double) m_total_samples / (double) m_total_stream_updates); + util::stream_format(std::cout, "Average samples/double->update: %8.2f\n", double(m_total_samples) / double(m_total_stream_updates)); } @@ -737,7 +738,7 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) task->task_group = block->initial[0]; if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS) fatalerror("discrete_dso_task: illegal task_group %d\n", task->task_group); - //printf("task group %d\n", task->task_group); + //util::stream_format(std::cout, "task group %d\n", task->task_group); task_list.add(task); } break; @@ -870,7 +871,6 @@ void discrete_device::device_start() //m_stream = machine().sound().stream_alloc(*this, 0, 2, 22257); const discrete_block *intf_start = m_intf; - char name[128]; /* If a clock is specified we will use it, otherwise run at the audio sample rate. */ if (this->clock()) @@ -884,9 +884,8 @@ void discrete_device::device_start() m_total_stream_updates = 0; /* create the logfile */ - sprintf(name, "discrete%s.log", this->tag()); if (DISCRETE_DEBUGLOG) - m_disclogfile = fopen(name, "w"); + m_disclogfile = fopen(util::string_format("discrete%s.log", this->tag()).c_str(), "w"); /* enable profiling */ m_profiling = 0; diff --git a/src/devices/sound/esqpump.cpp b/src/devices/sound/esqpump.cpp index e9ad6cedf85..9873029e056 100644 --- a/src/devices/sound/esqpump.cpp +++ b/src/devices/sound/esqpump.cpp @@ -112,7 +112,7 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample e[(ei + 0x1d0f) % 0x4000] = e_next; if (l != e[ei]) { - fprintf(stderr, "expected (%d) but have (%d)\n", e[ei], l); + util::stream_format(std::cerr, "expected (%d) but have (%d)\n", e[ei], l); } ei = (ei + 1) % 0x4000; #endif @@ -133,9 +133,9 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample bool silence = silent_for >= 500; if (was_silence != silence) { if (!silence) { - fprintf(stderr, ".-*\n"); + util::stream_format(std::cerr, ".-*\n"); } else { - fprintf(stderr, "*-.\n"); + util::stream_format(std::cerr, "*-.\n"); } was_silence = silence; } @@ -148,7 +148,7 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample { osd_ticks_t elapsed = now - last_ticks; osd_ticks_t tps = osd_ticks_per_second(); - fprintf(stderr, "%s",string_format("Pump: %d samples in %I64d ticks for %f Hz\n", last_samples, elapsed, last_samples * (double)tps / (double)elapsed).c_str()); + util::stream_format(std::cerr, "Pump: %d samples in %d ticks for %f Hz\n", last_samples, elapsed, last_samples * (double)tps / (double)elapsed); last_ticks = now; while (next_report_ticks <= now) { next_report_ticks += tps; @@ -156,7 +156,7 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample last_samples = 0; #if !PUMP_FAKE_ESP_PROCESSING - fprintf(stderr, "%s",string_format(" ESP spent %I64d ticks on %d samples, %f ticks per sample\n", ticks_spent_processing, samples_processed, (double)ticks_spent_processing / (double)samples_processed).c_str()); + util::stream_format(std::cerr, " ESP spent %d ticks on %d samples, %f ticks per sample\n", ticks_spent_processing, samples_processed, (double)ticks_spent_processing / (double)samples_processed); ticks_spent_processing = 0; samples_processed = 0; #endif |