Squashed an unnecessary copy in the parser callbacks
This commit is contained in:
parent
8008f51e45
commit
b15bed8c48
4 changed files with 7 additions and 7 deletions
|
|
@ -27,7 +27,7 @@ public:
|
||||||
void disableRecursiveIncludeGuard() { recursiveIncludeGuard = false; }
|
void disableRecursiveIncludeGuard() { recursiveIncludeGuard = false; }
|
||||||
void enableRecursiveIncludeGuard() { recursiveIncludeGuard = true; }
|
void enableRecursiveIncludeGuard() { recursiveIncludeGuard = true; }
|
||||||
protected:
|
protected:
|
||||||
virtual void callback(std::string_view header, std::vector<Opcode> members) = 0;
|
virtual void callback(std::string_view header, const std::vector<Opcode>& members) = 0;
|
||||||
std::filesystem::path rootDirectory { std::filesystem::current_path() };
|
std::filesystem::path rootDirectory { std::filesystem::current_path() };
|
||||||
private:
|
private:
|
||||||
bool recursiveIncludeGuard { false };
|
bool recursiveIncludeGuard { false };
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ public:
|
||||||
int getNumMasters() const noexcept { return numMasters; }
|
int getNumMasters() const noexcept { return numMasters; }
|
||||||
int getNumCurves() const noexcept { return numCurves; }
|
int getNumCurves() const noexcept { return numCurves; }
|
||||||
protected:
|
protected:
|
||||||
void callback(std::string_view header, std::vector<sfz::Opcode> members [[maybe_unused]]) final
|
void callback(std::string_view header, const std::vector<sfz::Opcode>& members [[maybe_unused]]) final
|
||||||
{
|
{
|
||||||
switch (hash(header))
|
switch (hash(header))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
void sfz::Synth::callback(std::string_view header, std::vector<Opcode> members)
|
void sfz::Synth::callback(std::string_view header, const std::vector<Opcode>& members)
|
||||||
{
|
{
|
||||||
switch (hash(header))
|
switch (hash(header))
|
||||||
{
|
{
|
||||||
case hash("global"):
|
case hash("global"):
|
||||||
// We shouldn't have multiple global headers in file
|
// We shouldn't have multiple global headers in file
|
||||||
ASSERT(!hasGlobal);
|
ASSERT(!hasGlobal);
|
||||||
globalOpcodes = std::move(members);
|
globalOpcodes = members;
|
||||||
hasGlobal = true;
|
hasGlobal = true;
|
||||||
break;
|
break;
|
||||||
case hash("control"):
|
case hash("control"):
|
||||||
|
|
@ -20,11 +20,11 @@ void sfz::Synth::callback(std::string_view header, std::vector<Opcode> members)
|
||||||
hasControl = true;
|
hasControl = true;
|
||||||
break;
|
break;
|
||||||
case hash("master"):
|
case hash("master"):
|
||||||
masterOpcodes = std::move(members);
|
masterOpcodes = members;
|
||||||
numMasters++;
|
numMasters++;
|
||||||
break;
|
break;
|
||||||
case hash("group"):
|
case hash("group"):
|
||||||
groupOpcodes = std::move(members);
|
groupOpcodes = members;
|
||||||
numGroups++;
|
numGroups++;
|
||||||
break;
|
break;
|
||||||
case hash("region"):
|
case hash("region"):
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ public:
|
||||||
void tempo(int delay, float secondsPerQuarter);
|
void tempo(int delay, float secondsPerQuarter);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void callback(std::string_view header, std::vector<Opcode> members) final;
|
void callback(std::string_view header, const std::vector<Opcode>& members) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Voice* findFreeVoice()
|
Voice* findFreeVoice()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue