Exemplo n.º 1
0
void CDraw::drawStaves(float startX, float endX)
{
    int i;

    glLineWidth (Cfg::staveThickness());

    /* select colour for all lines  */
    drColour ((m_displayHand != PB_PART_left) ? Cfg::staveColour() : Cfg::staveColourDim());
    glBegin(GL_LINES);

    for (i = -4; i <= 4; i+=2 )
    {
        CStavePos pos = CStavePos(PB_PART_right, i);
        glVertex2f (startX, pos.getPosY());
        glVertex2f (endX, pos.getPosY());
    }
    drColour ((m_displayHand != PB_PART_right) ? Cfg::staveColour() : Cfg::staveColourDim());
    for (i = -4; i <= 4; i+=2 )
    {
        CStavePos pos = CStavePos(PB_PART_left, i);
        glVertex2f (startX, pos.getPosY());
        glVertex2f (endX,   pos.getPosY());
    }
    glEnd();
}
Exemplo n.º 2
0
void CPiano::addPianistNote(whichPart_t part, CMidiEvent midiNote, bool good)
{
    CStavePos stavePos;
    float posY;

    if ( midiNote.velocity() == -1 )
        return;

    int note = midiNote.note();

    stavePos.notePos(part, note);

    if (stavePos.getStaveIndex() >= MAX_STAVE_INDEX || stavePos.getStaveIndex() <= MIN_STAVE_INDEX )
        return;

    if (good == true)
        m_goodChord.addNote(part, note);
    else
        m_badChord.addNote(part, note);


    posY = stavePos.getPosYAccidental();
    addNoteNameItem(posY, note, 0);
}
Exemplo n.º 3
0
void CPiano::drawPianoInputLines(CChord* chord, CColour colour, int lineLength)
{
    int i;

    drColour(colour);

    CStavePos stavePos;


    for ( i = 0; i < chord->length(); i++)
    {
        if (!m_rhythmTapping)
        {
            int pitch = chord->getNote(i).pitch();
            stavePos.notePos(chord->getNote(i).part(), pitch);

            glLineWidth (3.0);

            if (stavePos.getAccidental() != 0)
            {
                glEnable (GL_LINE_STIPPLE);
                glLineStipple (1, 0x0f0f);  /*  dashed  */
                glLineWidth (3.0);
            }

            float posY;
            posY = stavePos.getPosYAccidental();

            oneLine(Cfg::playZoneX() - lineLength, posY, Cfg::playZoneX(), posY);
            glDisable (GL_LINE_STIPPLE);
        }
        else
        {
            // draw a vertical line instead
            whichPart_t hand  = chord->getNote(i).part();
            CStavePos top = CStavePos(hand, 6);
            CStavePos bottom = CStavePos(hand, -6);
            glLineWidth (3.0);
            oneLine(Cfg::playZoneX(), top.getPosY(), Cfg::playZoneX(), bottom.getPosY());
        }
    }
}