MCPcopy Create free account
hub / github.com/csound/csound / getInstrumentNumber

Method getInstrumentNumber

interfaces/CsoundFile.cpp:1025–1059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1023}
1024
1025double CsoundFile::getInstrumentNumber(std::string name_) const
1026{
1027 trim(name_);
1028 int beginDefinition = 0;
1029 int endDefinition = 0;
1030 for(;;)
1031 {
1032 beginDefinition = findToken(orchestra, "instr", beginDefinition);
1033 if(beginDefinition == -1)
1034 {
1035 return false;
1036 }
1037 endDefinition = findToken(orchestra, "endin", beginDefinition);
1038 if(endDefinition == -1)
1039 {
1040 return false;
1041 }
1042 endDefinition += 6;
1043 std::string definition = orchestra.substr(beginDefinition,
1044 endDefinition - beginDefinition);
1045 std::string pre;
1046 std::string id;
1047 std::string name;
1048 std::string post;
1049 if(parseInstrument(definition, pre, id, name, post))
1050 {
1051 if(name_.compare(name) == 0 || id.compare(name) == 0)
1052 {
1053 return atof(id.c_str());
1054 }
1055 }
1056 beginDefinition++;
1057 }
1058 return -1.0;
1059}
1060
1061bool CsoundFile::exportForPerformance() const
1062{

Callers

nothing calls this directly

Calls 4

trimFunction · 0.85
findTokenFunction · 0.85
parseInstrumentFunction · 0.85
compareMethod · 0.80

Tested by

no test coverage detected