View Single Post
Old 09-23-2013, 12:44 PM   #55
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

I guess this function should be added to "select all notes in MIDI-editor":

Code:
    def selAllNotes(self,command_id=40003, islistviewcommand=0):
        """ Select all notes"""
        RPR_MIDIEditor_LastFocused_OnCommand(command_id, islistviewcommand)
(self.selAllNotesTselection() selects all notes in time selection)

...and self.selAllNotesTselection() should be replaced with self.selAllNotes():
Code:
    def drawMidi(self,mood,inKey,scale,structure,chordattack,highlight,layout):
        self.msg('RC.drawMidi - Enter')
        p, bpm, bpi = RPR_GetProjectTimeSignature2(0, 0, 0)
        bps = 60/bpm
        barLength = bps * bpi
        self.beatsInBar = bpi
        self.msg("wtf")
##        self.selAllNotesTselection()
        self.selAllNotes()
edit. "MIDI ticks per quarter note" can be set from Preferences -> Media -> MIDI. It's probably better to use "SNM_GetIntConfigVar("miditicksperbeat", -1)" to get that value from reaper.ini:
Code:
        [70,73,76, 'A#dim'], #34 A#dim
        [71,74,77, 'Bdim' ]  #35 Bdim
    ]

    ############### end of static data ##################

    def __init__(self):
        #init stuff here
        self.rt = RegionToolbox()  #small class at end of this file

##        self.quartNoteLength = 960 #quarter note length in ticks
        # get "miditicksperbeat" from reaper.ini -> return -1 if failed
        # (set it from Preferences -> Media -> MIDI)
        self.quartNoteLength = int(SNM_GetIntConfigVar("miditicksperbeat", -1))


and these lines should be edited/added:

drawMidi()
Code:
##        randPos = [0,480,960]
        randPos = [0, int(self.quartNoteLength / 2), self.quartNoteLength]
drawMelody()
Code:
##        randPos = [0,480,960]
        randPos = [0, int(self.quartNoteLength / 2), self.quartNoteLength]
drawChords()
Code:
        self.msg('--- take allocated:' + str(midiTake))
##        AttackStep0 = 120
##        AttackStep1 = 240
##        AttackStep2 = 480
##        AttackStep3 = 960
        AttackStep0 = int(self.quartNoteLength / 8)
        AttackStep1 = int(self.quartNoteLength / 4)
        AttackStep2 = int(self.quartNoteLength / 2)
        AttackStep3 = self.quartNoteLength

Last edited by spk77; 09-23-2013 at 01:30 PM.
spk77 is offline   Reply With Quote