예제 #1
0
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);
}
예제 #2
0
파일: MuNote.cpp 프로젝트: abreubacelar/MuM
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, &paramVal);
			if(err.Get() != MuERROR_NONE)
				cout << err.Message();
			else
			{
				sprintf(buff,"%.3f",paramVal);
				cs_string += buff;
				cs_string += "\t";
			}
		}
	}
	
	return cs_string;
}