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

Method getInstrumentNames

interfaces/CsoundFile.cpp:919–949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

917}
918
919std::map<int, std::string> CsoundFile::getInstrumentNames() const
920{
921 std::map<int, std::string> instrumentNames;
922 int beginDefinition = 0;
923 int endDefinition = 0;
924 for(int index = 0; true; index++)
925 {
926 beginDefinition = findToken(orchestra, "instr", beginDefinition);
927 if(beginDefinition == -1)
928 {
929 return instrumentNames;
930 }
931 endDefinition = findToken(orchestra, "endin", beginDefinition);
932 if(endDefinition == -1)
933 {
934 return instrumentNames;
935 }
936 endDefinition += 6;
937 std::string definition = orchestra.substr(beginDefinition,
938 endDefinition - beginDefinition);
939 std::string pre;
940 std::string id;
941 std::string name;
942 std::string post;
943 if(parseInstrument(definition, pre, id, name, post))
944 {
945 instrumentNames[atof(id.c_str())] = name;
946 }
947 beginDefinition++;
948 }
949}
950
951//bool CsoundFile::getInstrumentNumber(int number_, std::string &definition_) const
952//{

Callers

nothing calls this directly

Calls 2

findTokenFunction · 0.85
parseInstrumentFunction · 0.85

Tested by

no test coverage detected