|
|
|
04-20-2021, 06:48 PM
|
#1
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 654
|
Is there an API for setting the note display mode?
Is there an API for setting the note display mode? Rectangle, triangle, diamond
|
|
|
04-21-2021, 02:37 AM
|
#2
|
Human being with feelings
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
|
probably like this
Code:
midieditor = reaper.MIDIEditor_GetActive()
reaper.MIDIEditor_OnCommand(midieditor, 40450) -- View: Show events as diamonds (drum mode)
reaper.MIDIEditor_OnCommand(midieditor, 40449) -- View: Show events as rectangles (normal mode)
reaper.MIDIEditor_OnCommand(midieditor, 40448) -- View: Show events as triangles (drum mode)
|
|
|
04-21-2021, 06:25 AM
|
#3
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 654
|
Thank you for your reply. Sorry I didn't make it clear. I want to define the note shape of multiple items at one time.
|
|
|
04-21-2021, 03:59 PM
|
#4
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
It would be possible with state-chunk-manipulation, even for items, that aren't currently opened in the MIDI-Editor.
CFGEDIT seem to be the entry of the item-statechunk, that you would need to manipulate.
But it's undocumented to my knowledge.
As far as I can see, it's the sixth entry in the line, which is either:
1 - rectangles
9 - triangles
17 - diamonds
Though it looks more like
&8=0 and &16=0 - rectangles
&8=8 and &16=0 - triangles
&8=0 and &16=16 - diamonds.
So if you want to go into item-statechunk-manipulation and string-replacement, it is actually possible. Otherwise, you can only set the ones currently opened in the Midi-Editor, as far as I can see using the method shown by Yanick.
If you use JS-extension, you can get the HWND-identifier of all opened Midi-editors as well, so you could set the shape for all of them.
You can get the adresses for them using JS_MIDIEditor_ListAll and need split and convert them later on.
https://mespotin.uber.space/Ultrasch...Editor_ListAll
But: you can not find out, which item is actually opened in a specific Midi-Editor, so if you want to manipulate only some of them, you'll probably have difficulties to differentiate between those you want to alter and those you don't want to.
tl;dr; if you want to set the shapes for items in a simple and easy way, you're out of luck, it seems.
|
|
|
04-21-2021, 11:03 PM
|
#5
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 654
|
Thank you for your reply!
I used it reaper.GetItemStateChunk This API gets the following characters,But I can't see which line represents the shape of the note?
"<ITEM
POSITION 7.94461000688639
SNAPOFFS 0
LENGTH 174.8790022675737
LOOP 0
ALLTAKES 0
FADEIN 1 0.01 0 1 0 0 0
FADEOUT 1 0.01 0 1 0 0 0
MUTE 0 0
SEL 0
IGUID {0A4E7646-A57B-44DE-B7E3-A65D0824CE2F}
IID 267
NAME 308543-20210405-04.mp3
VOLPAN 1 0 1 -1
SOFFS 0
|
|
|
04-22-2021, 03:00 AM
|
#6
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Your statechunk is incomplete. It must end with a > or otherwise is missing parts.
How did you retrieve it so you could post it here? Easiest is to output it in the ReaScript-console using reaper.ShowConsoleMsg()
The entry in question is CFGEDIT but it's only available for Midi-items, not any other.
|
|
|
04-22-2021, 09:35 PM
|
#7
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 654
|
Thank you for your reply. I've found it,It looks like it's going to be successful ~! What's more, I'm surprised to find that there are many parameters that can't be GetSet before.
|
|
|
04-23-2021, 03:00 AM
|
#8
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 654
|
I still didn't succeed. Although I changed the data, the note mode didn't change.
Code:
item=reaper.GetMediaItem(0,0)
retval, str = reaper.GetItemStateChunk(item, '', false)
str1,str2,str3,str4,str5,str6,str7=string.match(str, '(CFGEDIT) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+)')
str7=0 str_new=str1..' '..str2..' '..str3..' '..str4..' '..str5..' '..str6..' '..str7
str_out=string.gsub(str,'CFGEDIT %d+ %d+ %d+ %d+ %d+ %d+',str_new,1)
bool=reaper.SetItemStateChunk(item,str_out,false)
reaper.ShowConsoleMsg(str_out)
|
|
|
04-23-2021, 03:00 AM
|
#9
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
There are tons in statechunks that can only be set via statechunks.
One of the reasons why I try to write such get/set functions for statechunks in my Ultraschall-Api.
Just hadn't time yet to do some for CFGEDIT, otherwise I would have suggested installing Ultraschall-Api.
|
|
|
04-23-2021, 03:01 AM
|
#10
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Quote:
Originally Posted by dangguidan
I still didn't succeed. Although I changed the data, the note mode didn't change.
Code:
item=reaper.GetMediaItem(0,0)
retval, str = reaper.GetItemStateChunk(item, '', false)
str1,str2,str3,str4,str5,str6,str7=string.match(str, '(CFGEDIT) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+)')
str7=0 str_new=str1..' '..str2..' '..str3..' '..str4..' '..str5..' '..str6..' '..str7
str_out=string.gsub(str,'CFGEDIT %d+ %d+ %d+ %d+ %d+ %d+',str_new,1)
bool=reaper.SetItemStateChunk(item,str_out,false)
reaper.ShowConsoleMsg(str_out)
|
You might need to close and reopen the Midi-editor for this.
The statechunk approach probably only helps for items not opened in the Midieditor. For opened items, you might need to use Yannik's approach.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:26 AM.
|