Audacity 3.2.0
Classes | Enumerations | Functions | Variables
anonymous_namespace{MIDIPlay.cpp} Namespace Reference

Classes

struct  InitializeTime
 

Enumerations

enum  { MIDI_MINIMAL_LATENCY_MS = 1 }
 

Functions

static double util_GetTime (void)
 
static double SystemTime (bool usingAlsa)
 
PmTimestamp MidiTime (void *pInfo)
 

Variables

static int usePerformanceCounter_
 
static double secondsPerTick_
 
static struct anonymous_namespace{MIDIPlay.cpp}::InitializeTime initializeTime
 
static double streamStartTime = 0
 
AudioIOExt::RegisteredFactory sMIDIPlayFactory
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MIDI_MINIMAL_LATENCY_MS 

Definition at line 476 of file MIDIPlay.cpp.

476 {
477 // This is the least positive latency we can
478 // specify to Pm_OpenOutput, 1 ms, which prevents immediate
479 // scheduling of events:
481};

Function Documentation

◆ MidiTime()

PmTimestamp anonymous_namespace{MIDIPlay.cpp}::MidiTime ( void *  pInfo)

Definition at line 608 of file MIDIPlay.cpp.

609{
610 return static_cast<MIDIPlay*>(pInfo)->MidiTime();
611}
Callbacks that AudioIO uses, to synchronize audio and MIDI playback.
PmTimestamp MidiTime(void *pInfo)
Definition: MIDIPlay.cpp:608

References MidiTime().

Referenced by MidiTime().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SystemTime()

static double anonymous_namespace{MIDIPlay.cpp}::SystemTime ( bool  usingAlsa)
static

Definition at line 486 of file MIDIPlay.cpp.

487{
488#ifdef __WXGTK__
489 if (usingAlsa) {
490 struct timespec now;
491 // CLOCK_MONOTONIC_RAW is unaffected by NTP or adj-time
492#if defined(CLOCK_MONOTONIC_RAW)
493 clock_gettime(CLOCK_MONOTONIC_RAW, &now);
494#else
495 clock_gettime(CLOCK_REALTIME, &now);
496#endif
497 //return now.tv_sec + now.tv_nsec * 0.000000001;
498 return (now.tv_sec + now.tv_nsec * 0.000000001) - streamStartTime;
499 }
500#else
501 static_cast<void>(usingAlsa);//compiler food.
502#endif
503
504 return util_GetTime() - streamStartTime;
505}
static double util_GetTime(void)
Definition: MIDIPlay.cpp:420

References streamStartTime, and util_GetTime().

Referenced by anonymous_namespace{MIDIPlay.h}::MIDIPlay::ComputeOtherTimings(), anonymous_namespace{MIDIPlay.h}::MIDIPlay::MidiTime(), and anonymous_namespace{MIDIPlay.h}::MIDIPlay::StartOtherStream().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ util_GetTime()

static double anonymous_namespace{MIDIPlay.cpp}::util_GetTime ( void  )
static

Definition at line 420 of file MIDIPlay.cpp.

421{
422 LARGE_INTEGER time;
423
425 {
426 /*
427 Note: QueryPerformanceCounter has a known issue where it can skip forward
428 by a few seconds (!) due to a hardware bug on some PCI-ISA bridge hardware.
429 This is documented here:
430 http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q274323&
431
432 The work-arounds are not very paletable and involve querying GetTickCount
433 at every time step.
434
435 Using rdtsc is not a good option on multi-core systems.
436
437 For now we just use QueryPerformanceCounter(). It's good, most of the time.
438 */
439 QueryPerformanceCounter( &time );
440 return time.QuadPart * secondsPerTick_;
441 }
442 else
443 {
444 #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
445 return GetTickCount64() * .001;
446 #else
447 return timeGetTime() * .001;
448 #endif
449 }
450}

References secondsPerTick_, and usePerformanceCounter_.

Referenced by SystemTime().

Here is the caller graph for this function:

Variable Documentation

◆ initializeTime

struct anonymous_namespace{MIDIPlay.cpp}::InitializeTime anonymous_namespace{MIDIPlay.cpp}::initializeTime
static

◆ secondsPerTick_

double anonymous_namespace{MIDIPlay.cpp}::secondsPerTick_
static

◆ sMIDIPlayFactory

AudioIOExt::RegisteredFactory anonymous_namespace{MIDIPlay.cpp}::sMIDIPlayFactory
Initial value:
{
[](const auto &playbackSchedule){
return std::make_unique<MIDIPlay>(playbackSchedule);
}
}

Definition at line 510 of file MIDIPlay.cpp.

◆ streamStartTime

double anonymous_namespace{MIDIPlay.cpp}::streamStartTime = 0
static

◆ usePerformanceCounter_

int anonymous_namespace{MIDIPlay.cpp}::usePerformanceCounter_
static