MCPcopy Create free account
hub / github.com/audacity/audacity / SendEnvelopes

Method SendEnvelopes

src/commands/GetInfoCommand.cpp:553–592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553bool GetInfoCommand::SendEnvelopes(const CommandContext &context)
554{
555 auto &tracks = TrackList::Get( context.project );
556 int i=0;
557 int j=0;
558 context.StartArray();
559 for (auto t : tracks) {
560 t->TypeSwitch([&](WaveTrack &waveTrack) {
561 auto ptrs = waveTrack.SortedIntervalArray();
562 j = 0;
563 for (auto &pClip : ptrs) {
564 context.StartStruct();
565 context.AddItem((double)i, "track");
566 context.AddItem((double)j, "clip");
567 context.AddItem(pClip->GetPlayStartTime(), "start");
568 const auto pEnv = &pClip->GetEnvelope();
569 context.StartField("points");
570 context.StartArray();
571 double offset = pEnv->GetOffset();
572 for (size_t k = 0; k < pEnv->GetNumberOfPoints(); k++)
573 {
574 context.StartStruct();
575 context.AddItem((*pEnv)[k].GetT() + offset, "t");
576 context.AddItem((*pEnv)[k].GetVal(), "y");
577 context.EndStruct();
578 }
579 context.EndArray();
580 context.EndField();
581 context.AddItem(pClip->GetPlayEndTime(), "end");
582 context.EndStruct();
583 j++;
584 }
585 });
586 // Per track numbering counts all tracks
587 i++;
588 }
589 context.EndArray();
590
591 return true;
592}
593
594
595bool GetInfoCommand::SendLabels(const CommandContext &context)

Callers

nothing calls this directly

Calls 15

GetFunction · 0.85
SortedIntervalArrayMethod · 0.80
GetNumberOfPointsMethod · 0.80
GetTMethod · 0.80
GetValMethod · 0.80
StartArrayMethod · 0.45
StartStructMethod · 0.45
AddItemMethod · 0.45
GetPlayStartTimeMethod · 0.45
StartFieldMethod · 0.45
GetOffsetMethod · 0.45
EndStructMethod · 0.45

Tested by

no test coverage detected