void PSDRV_AFM2C(const AFM *afm) { char buffer[256]; FILE *of; int i; lstrcpynA(buffer, afm->FontName, sizeof(buffer) - 2); for (i = 0; i < strlen(buffer); ++i) if (buffer[i] == '-') buffer[i] = '_'; buffer[i] = '.'; buffer[i + 1] = 'c'; buffer[i + 2] = '\0'; MESSAGE("writing '%s'\n", buffer); of = fopen(buffer, "w"); if (of == NULL) { ERR("error opening '%s' for writing\n", buffer); return; } buffer[i] = '\0'; writeHeader(of, afm, buffer); writeMetrics(of, afm, buffer); writeAFM(of, afm, buffer); fclose(of); }
void ardutouch_setup( Synth *x ) { synth = x; // set global ptr to runtime synth console_setup( (Mode *) x ); // initialize console module audio_setup(); // initialize audio module bufsPerScan = audioRate / (scanRate * audioBufSz); scanDC = bufsPerScan; /* initialize buttons */ for ( byte i = 0; i < NumButs; i++ ) pinMode( butPin[i], INPUT ); // set corresponding digital pin as input /* get initial positions of pots */ for ( byte i = 0; i < NumPots; i++ ) #ifdef CLOCKWISE_POTS potVal[i] = analogRead( potPin[i] ); #else potVal[i] = 1023 - analogRead( potPin[i] ); #endif #ifndef USE_SERIAL_PORT /* initialize LEDs */ for ( byte i = 0; i < NumLEDs; i++ ) { pinMode( LEDPin[i], OUTPUT ); digitalWrite( LEDPin[i], LED_OFF ); } #endif x->config(); // configure the synth x->reset(); // reset the synth audio::enable(); // enable audio output x->welcome(); // execute any post-reset code #ifdef AUTO_METRICS // for developers only! audio::wait(100); // run the synth for a bit writeMetrics(); // write processor metrics to NVS #endif }
void TestSystem::finishCurrentSubtest() { if (cur_subtest_is_empty_) // There is no need to print subtest statistics { return; } double cpu_time = cpu_elapsed_ / getTickFrequency() * 1000.0; double gpu_time = gpu_elapsed_ / getTickFrequency() * 1000.0; double gpu_full_time = gpu_full_elapsed_ / getTickFrequency() * 1000.0; double speedup = static_cast<double>(cpu_elapsed_) / std::max(1.0, gpu_elapsed_); speedup_total_ += speedup; double fullspeedup = static_cast<double>(cpu_elapsed_) / std::max(1.0, gpu_full_elapsed_); speedup_full_total_ += fullspeedup; if (speedup > top_) { speedup_faster_count_++; } else if (speedup < bottom_) { speedup_slower_count_++; } else { speedup_equal_count_++; } if (fullspeedup > top_) { speedup_full_faster_count_++; } else if (fullspeedup < bottom_) { speedup_full_slower_count_++; } else { speedup_full_equal_count_++; } // compute min, max and std::sort(gpu_times_.begin(), gpu_times_.end()); double gpu_min = gpu_times_.front() / getTickFrequency() * 1000.0; double gpu_max = gpu_times_.back() / getTickFrequency() * 1000.0; double deviation = 0; if (gpu_times_.size() > 1) { double sum = 0; for (size_t i = 0; i < gpu_times_.size(); i++) { int64 diff = gpu_times_[i] - static_cast<int64>(gpu_elapsed_); double diff_time = diff * 1000 / getTickFrequency(); sum += diff_time * diff_time; } deviation = std::sqrt(sum / gpu_times_.size()); } printMetrics(is_accurate_, cpu_time, gpu_time, gpu_full_time, speedup, fullspeedup); writeMetrics(cpu_time, gpu_time, gpu_full_time, speedup, fullspeedup, gpu_min, gpu_max, deviation); num_subtests_called_++; resetCurrentSubtest(); }