Browse Source

Refactored some demo code to avoid a problem when using String::formatted when Strings are UTF-32

tags/2021-05-28
jules 9 years ago
parent
commit
09d6409644
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      examples/audio plugin demo/Source/PluginEditor.cpp

+ 6
- 6
examples/audio plugin demo/Source/PluginEditor.cpp View File

@@ -136,14 +136,14 @@ void JuceDemoPluginAudioProcessorEditor::timerCallback()
// quick-and-dirty function to format a timecode string // quick-and-dirty function to format a timecode string
static String timeToTimecodeString (double seconds) static String timeToTimecodeString (double seconds)
{ {
const int millisecs = roundToInt (std::abs (seconds * 1000.0));
const int millisecs = roundToInt (seconds * 1000.0);
const int absMillisecs = std::abs (millisecs);
return String::formatted ("%s%02d:%02d:%02d.%03d",
seconds < 0 ? "-" : "",
return String::formatted ("%02d:%02d:%02d.%03d",
millisecs / 360000, millisecs / 360000,
(millisecs / 60000) % 60,
(millisecs / 1000) % 60,
millisecs % 1000);
(absMillisecs / 60000) % 60,
(absMillisecs / 1000) % 60,
absMillisecs % 1000);
} }
// quick-and-dirty function to format a bars/beats string // quick-and-dirty function to format a bars/beats string


Loading…
Cancel
Save