void KeyboardWidget::CopyNotes() { const char *comma = ", "; const char *semi = ";\r\n"; // const char *obrack = "{"; const char *cbrack = "}"; RecNote *note; bsString pitches; if (recGroup) { bsString rhythms; bsString volumes; pitches = "{ "; rhythms = "{ "; volumes = "{ "; while ((note = recHead->next) != recTail) { PitchString(note->key, pitches); RhythmString(note->dur, rhythms); NumberString(note->vol, volumes); note->Remove(); delete note; if (recHead->next == recTail) break; pitches += comma; rhythms += comma; volumes += comma; } pitches += cbrack; pitches += comma; pitches += rhythms; pitches += cbrack; pitches += comma; pitches += volumes; pitches += cbrack; pitches += semi; } else { while ((note = recHead->next) != recTail) { PitchString(note->key, pitches); pitches += comma; RhythmString(note->dur, pitches); pitches += comma; NumberString(note->vol, pitches); pitches += semi; note->Remove(); delete note; } } CopyToClipboard(pitches); }
string MuNote::CsString(void) { string cs_string; char buff[10]; MuParamBlock pBlock; float paramVal = 0; short numberOfParams = 0; MuError err(MuERROR_NONE); cs_string += "i"; sprintf(buff,"%d",Instr()); cs_string += buff; cs_string += "\t"; sprintf(buff,"%.3f",Start()); cs_string += buff; cs_string += "\t"; sprintf(buff,"%.3f",Dur()); cs_string += buff; cs_string += "\t"; cs_string += PitchString(); cs_string += "\t\t"; sprintf(buff,"%.3f",Amp()); cs_string += buff; cs_string += "\t"; pBlock = Params(); numberOfParams = pBlock.Num(); if( numberOfParams != 0) { for(short k = 0; k < numberOfParams; k++) { err = pBlock.Val(k, ¶mVal); if(err.Get() != MuERROR_NONE) cout << err.Message(); else { sprintf(buff,"%.3f",paramVal); cs_string += buff; cs_string += "\t"; } } } return cs_string; }