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

Method getInstrumentCount

interfaces/CsoundFile.cpp:808–843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

806}
807
808int CsoundFile::getInstrumentCount() const
809{
810 int beginDefinition = 0;
811 int endDefinition = 0;
812 int index;
813 for(index = 0; true; )
814 {
815 beginDefinition = findToken(orchestra, "instr", beginDefinition);
816 if(beginDefinition == -1)
817 {
818 return index;
819 }
820 endDefinition = findToken(orchestra, "endin", beginDefinition);
821 if(endDefinition == -1)
822 {
823 return index;
824 }
825 endDefinition += 6;
826 std::string definition = orchestra.substr(beginDefinition,
827 endDefinition - beginDefinition);
828 std::string pre;
829 std::string id;
830 std::string name;
831 std::string post;
832 if(parseInstrument(definition, pre, id, name, post))
833 {
834 index++;
835 beginDefinition++;
836 }
837 else
838 {
839 break;
840 }
841 }
842 return index;
843}
844
845bool CsoundFile::getInstrument(int number, std::string &definition_) const
846{

Callers

nothing calls this directly

Calls 2

findTokenFunction · 0.85
parseInstrumentFunction · 0.85

Tested by

no test coverage detected