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 477 of file MIDIPlay.cpp.

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

Function Documentation

◆ MidiTime()

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

Definition at line 609 of file MIDIPlay.cpp.

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

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 487 of file MIDIPlay.cpp.

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

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 421 of file MIDIPlay.cpp.

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

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 511 of file MIDIPlay.cpp.

◆ streamStartTime

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

◆ usePerformanceCounter_

int anonymous_namespace{MIDIPlay.cpp}::usePerformanceCounter_
static