<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Jari,<br>
    <br>
    thanks for the hint ! <br>
    But: FCNote:CalcActualDisplacement() seems to return wrong results
    for percussion staves. <br>
    When using NoteEntry:CalcHighestPercussionNote
    ():CalcActualDisplacement()<br>
    it seems to ignore percussion layout. Notes on the same staff pos,
    but with different<br>
    MIDI values return different positions.<br>
    <br>
    And the standard note results do not have the same range as
    percussion note results <br>
    (which have staff position 6 on the middle line,
    CalcActualDisplacement<br>
    returns -4 on middle line).<br>
    <br>
    Attached below are my own functions that deliver the same staff
    position<br>
    for both standard and percussion staves. They seem to work fine,<br>
    although I probably should switch to FCNote:CalcActualDisplacement()
    <br>
    and add range adjust, as it probably has had more testing yet.<br>
    <br>
    function GetPercPitch(staff,note)<br>
         local layerinstrdef=staff:CreateLayerInstrumentDef(1)<br>
         local percmapnotes=layerinstrdef:CreatePercussionMapNotes()<br>
         local percID=staff:CalcPercussionLayoutID(0)<br>
         local perclayoutnotes=finale.FCPercussionLayoutNotes()<br>
         perclayoutnotes:LoadAllForItem(percID)<br>
         return
    perclayoutnotes:FindMidiNote(note,percmapnotes):GetStaffPosition()<br>
    end<br>
    <br>
    function GetStaffPos(entry,staff)<br>
        --calc note position in staff, rests return 0<br>
        local staffpos=0<br>
    <br>
        -- Get clef, key signature, major/minor and measure<br>
        local clef=finale.FCClefDef()<br>
        clef:Load(entry:GetClefIndex())<br>
        local measure=finale.FCMeasure()<br>
        measure:Load(entry.Measure)<br>
        local key=measure:GetKeySignature()<br>
        local minor=0<br>
        if key:IsMinor() then<br>
           minor=-2           <br>
        end <br>
    <br>
        local percussionhighestnote=entry:CalcHighestPercussionNote ()<br>
        if percussionhighestnote~= nil then<br>
           
    staffpos=GetPercPitch(staff,percussionhighestnote:CalcMIDIKey())<br>
        elseif entry:IsRest() or (entry.Duration==0) then -- return 0 on
    rests<br>
             staffpos=0<br>
        else<br>
            staffpos=entry:CalcHighestNote(NULL):GetDisplacement()     
    --  replace with FCNote:CalcActualDisplacement() <br>
                           +clef:GetVerticalAdjust() <br>
                           +staff:GetTransposeInterval()<br>
                           +key:CalcRootRelationIndex()<br>
                           +minor  <br>
                           +10           -- make range compatible with
    percussion staves<br>
        end<br>
        return staffpos<br>
    end<br>
    <br>
    <br>
    Jan<br>
    <br>
    <blockquote
cite="mid:trinity-a82fa924-8feb-4880-934b-b1a182ba1a15-1404721264351@msvc010"
      type="cite">
      <div class="gmail_quote">Jari Williamsson
        <a class="moz-txt-link-rfc2396E" href="mailto:jari.williamsson@mailbox.swipnet.se"><jari.williamsson@mailbox.swipnet.se></a> schrieb:
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;"> On 2014-07-02 17:03, Jan Angermüller
          wrote:<br>
          > Does anyone know if there is GetStaffPosition for a
          "normal" note entry ?<br>
          <br>
          Sounds like FCNote:CalcActualDisplacement() is what you're
          looking for.<br>
          <br>
          <br>
          Best regards,<br>
          <br>
          Jari Williamsson<br>
          <br>
          <br>
          _______________________________________________<br>
          JWLua mailing list<br>
          <a class="moz-txt-link-abbreviated" href="mailto:JWLua@jwmusic.nu">JWLua@jwmusic.nu</a><br>
          <a moz-do-not-send="true"
            href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu"
            target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>