Go Back   Cockos Confederated Forums > REAPER Forums > REAPER Developer Forum

Reply
 
Thread Tools Display Modes
Old 03-20-2011, 01:11 AM   #201
bro
Human being with feelings
 
Join Date: Mar 2011
Posts: 2
Default

Quote:
Originally Posted by shane View Post
Just execute the action:

Main_OnCommand( 40026, 0 ); //Save current project

Is a powerful API function!
Big thanx!
bro is offline   Reply With Quote
Old 03-22-2011, 03:20 AM   #202
griz lee
Human being with feelings
 
griz lee's Avatar
 
Join Date: Jul 2006
Location: in a hotel room near you
Posts: 1,176
Default

How do i...

[edit.. scrub that - i've found out the 'how do i'].

Last edited by griz lee; 03-25-2011 at 05:54 AM.
griz lee is offline   Reply With Quote
Old 04-13-2011, 02:12 AM   #203
araud
Human being with feelings
 
Join Date: Oct 2010
Posts: 102
Default P_SOURCE and PCM_SOURCE_EXT_OPENEDITOR

hi!

After I set my own P_SOURCE:

GetSetMediaItemTakeInfo(pTake, "P_SOURCE", pSource);

Built-in MIDI editor (not inline) stops coming up. Just silently ignores "CTRL+ALT+E" and "Open items in built-in MIDI editor".

It happens even if my source does nothing but delegates all calls to original source (I do not kill it but keep inside my instance).

If I call m_pOldSource->Extended(PCM_SOURCE_EXT_OPENEDITOR, ...); Reaper hangs dead.

However "Open Item Copies with built-in MIDI editor" works fine. But additional take is created.

Is this possible to link my source take with built-in MIDI editor smoothly?

Last edited by araud; 04-27-2011 at 11:07 PM. Reason: question is outdated
araud is offline   Reply With Quote
Old 07-06-2011, 06:52 PM   #204
fgcapo
Human being with feelings
 
Join Date: Jul 2011
Posts: 2
Default Reading VST chunk info

Hi guys,

I'm writing a converter from the Reaper file format to my own host. Unfortunately I can't figure out how to decode the VST state in the project file. What's the encoding scheme?

--Update--
Totally just figured it out. Base64 encoded line by line. Thanks.

Last edited by fgcapo; 07-06-2011 at 07:15 PM. Reason: figured it out
fgcapo is offline   Reply With Quote
Old 07-07-2011, 01:24 AM   #205
drew
Mobile
 
drew's Avatar
 
Join Date: Jan 2006
Location: London & São Paulo. Hardcore commercial REAPERite
Posts: 1,583
Default

Congrats fgcapo! - you solved that quickly. So how is everything else going with the converter project? Any other difficult areas?
__________________
Proudly using REAPER exclusively for professional music production at Qsonics.com and recording broadcast and narrative voiceovers at DrewWhite.com.
drew is offline   Reply With Quote
Old 07-07-2011, 06:06 PM   #206
fgcapo
Human being with feelings
 
Join Date: Jul 2011
Posts: 2
Default

Hi Drew! Yeah, the header Reaper sticks on VST state information seems to vary in length. I've seen 44, 50, a bunch of 60s, 92, and 124... Can some one clue me in as to how to interpret the header and get the size?
fgcapo is offline   Reply With Quote
Old 07-11-2011, 10:52 AM   #207
shane
Human being with feelings
 
shane's Avatar
 
Join Date: Jan 2006
Location: 61.215 -149.8925
Posts: 364
Default

Has anyone figured out how RENDER_CFG works? I'd love to be able to roll my own instead of forcing users to run a dummy render to set the config before Autorendering...
__________________
Autorender - Now part of the SWS Extension family
Batch render and tag regions while you watch cat videos
shane is offline   Reply With Quote
Old 07-31-2011, 12:33 PM   #208
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 4,701
Default Reading state of toggles...?

Does anyone know how I can read the state of toggles? I know I can toggle them (with Main_OnCommand(cmdID, flags)) but how do I know if I need to toggle or not?

Specifically, I want to toggle on the "Options: Selecting one grouped item selects group" (which is a toggle so it should be really be named as such), but if I toggle it (Main_OnCommand(41156,0)) and it is already on, it goes off...
__________________
// MVHMF
Vote for the Starter Marker FR here http://forum.cockos.com/project.php?issueid=4371
Let's finally get rid of those ugly odd time measures.
Fabian is offline   Reply With Quote
Old 07-31-2011, 01:41 PM   #209
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 835
Default

Quote:
Originally Posted by Fabian View Post
Does anyone know how I can read the state of toggles? I know I can toggle them (with Main_OnCommand(cmdID, flags)) but how do I know if I need to toggle or not?

Specifically, I want to toggle on the "Options: Selecting one grouped item selects group" (which is a toggle so it should be really be named as such), but if I toggle it (Main_OnCommand(41156,0)) and it is already on, it goes off...
Yes,
First, you need to find the variable name for the option you're toggling. Check reaper.ini to see what's changed before and after the toggle, perhaps clicking "save as default" in the project prefs dialog in between.

Then, check out this TokSeekMode example from the SWS codebase (many more toggle functions in there), referencing my utility funcion GetConfigVar. Hope this helps!
sws is offline   Reply With Quote
Old 07-31-2011, 02:22 PM   #210
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 4,701
Default

Quote:
Originally Posted by sws View Post
Yes,
First, you need to find the variable name for the option you're toggling. Check reaper.ini to see what's changed before and after the toggle, perhaps clicking "save as default" in the project prefs dialog in between.

Then, check out this TokSeekMode example from the SWS codebase (many more toggle functions in there), referencing my utility funcion GetConfigVar. Hope this helps!
Thanks for this, I'm sure it would've helped, except... nothing changes in reaper.ini when that specific option is toggled. That toggle always starts up off, and running the action to change it does not make any imprint on reaper.ini. I will have to work around this, maybe toggle it and check if selecting one item in a group also selects another item in the same group, and if not, toggle again...

Thanks.

EDIT: Of course, that way of testing (toggle, select one, see if another is also selected) only works if there are at least two items in the group. Shucks...
__________________
// MVHMF
Vote for the Starter Marker FR here http://forum.cockos.com/project.php?issueid=4371
Let's finally get rid of those ugly odd time measures.

Last edited by Fabian; 07-31-2011 at 03:04 PM.
Fabian is offline   Reply With Quote
Old 07-31-2011, 03:47 PM   #211
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 835
Default

Huh, I found it no problem, it's "projgroupsel". (The "save as project defaults" is important.)

I added "SWS: Toggle selecting one grouped item selects group" to SWS, it'll be in the next release (2.0.0 #31)

Tim
sws is offline   Reply With Quote
Old 08-16-2011, 04:13 AM   #212
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Midi automateable sends. Only via OSC.
Posts: 1,127
Default

Quote:
Originally Posted by trugschluss View Post
is there a way via python to...

2) set the bypass state of a single FX
Why can not we do this via note on/off events directly in Reaper? Is not this a basic and very important functionality?

port.channel.note.0..127 --> changing the bypass state of an fx, after doing a midi mapping

Unfortunately this is not possible in Reaper, as far as I know.

UPDATE: No this is possible, but not in a way I wished it would work. I would prefer a toggling strategy, incoming note on with velocity > 0, should toggle the bypass state. This has the advantage, that you, the user, do NOT need to know what the CURRENT bypass state is, but can STILL ALWAYS invert the bypass state correctly! Otherwise, each time you open a new project, where you mapped maybe hundreds of bypass controls, you need to know from each of those in which CURRENT STATE those are. This is the problem. Just a simple toggling removes this problem, as no matter what the current state is, it will invert correctly, EACH TIME, IMMEDIATELY. So you get the expected behaviour. Now this is not possible.

[X] Problem solved. Thanks Cockos team.

Last edited by TonE; 04-24-2012 at 10:56 PM. Reason: see toggle option during midi mapping.
TonE is offline   Reply With Quote
Old 08-18-2011, 03:05 PM   #213
G__ROW
Human being with feelings
 
Join Date: Oct 2010
Posts: 7
Default Open track in MIDI editor

How can I open a selected track in a MIDI editor now in v4? Before I was doing:
Main_OnCommand(40904, 0);

but it doesn't seem to work anymore.

Thanks
G__ROW is offline   Reply With Quote
Old 08-18-2011, 03:47 PM   #214
gofer
-blänk-
 
gofer's Avatar
 
Join Date: Jun 2008
Posts: 10,211
Default

There are three different versions of "Item: Open all track MIDI in..." Try either 40133, 40134 or 40194, depending on what you want to happen exactly. I guess it's because the "reuse MIDI editor" options are a thing of the past.
gofer is offline   Reply With Quote
Old 08-19-2011, 09:34 AM   #215
G__ROW
Human being with feelings
 
Join Date: Oct 2010
Posts: 7
Default

Thanks gofer, those command codes do seem to open the editor, but it's not opening the selected track I set with the API. If I manually select a track it will open that track, but not if I set the selected with code.

Here is what I'm doing:

m_pREAPER->SetTrackSelected(m_pREAPER->CSurf_TrackFromID(nIndex, true), true);
m_pREAPER->Main_OnCommand(40194, 0);

I can see that the track index being sent into CSurf_TrackFromID() is getting selected, but Main_OnCommand(40194, 0) is opening the last manually selected track.
G__ROW is offline   Reply With Quote
Old 08-19-2011, 11:47 AM   #216
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 835
Default

Ah yeah, the ol' last touched track issue. Use the action "Track: Set first sel to last touched" ID 40914 as needed.
sws is offline   Reply With Quote
Old 08-19-2011, 12:35 PM   #217
G__ROW
Human being with feelings
 
Join Date: Oct 2010
Posts: 7
Default

Still no go I even tried doing "Track: Select last touched track 40505" after set first sel to last touched.

m_pREAPER->SetTrackSelected(m_pREAPER->CSurf_TrackFromID(nIndex, true), true);
m_pREAPER->Main_OnCommand(40914, 0); // set first sel to last touched
m_pREAPER->Main_OnCommand(40505, 0); // select last touched
m_pREAPER->Main_OnCommand(40194, 0); // open MIDI editor

I did notice that the selected track doesn't seem to change until after the MIDI window opens. I'm not sure if this is just a latency issue while rendering. I did try adding a Sleep() after I set the selected track, but that didn't seem to help.
G__ROW is offline   Reply With Quote
Old 08-19-2011, 12:39 PM   #218
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 835
Default

Hmm, try Tracklist_AdjustWindows(false), or less likely perhaps UpdateTimeline()? Both force refreshes in the TCP and Arrange window respectively.
sws is offline   Reply With Quote
Old 08-19-2011, 12:58 PM   #219
G__ROW
Human being with feelings
 
Join Date: Oct 2010
Posts: 7
Default

Neither of those functions seemed to do it. Even with them the selected track wasn't changing until after the MIDI window opened. It's still opening the last manually touched track.
G__ROW is offline   Reply With Quote
Old 08-31-2011, 04:08 PM   #220
OldTimerNewComer
Human being with feelings
 
Join Date: Aug 2011
Posts: 40
Default How Do I?...

Hope this is the right place to post this...I am a complete virgin to scripting. I'm a Songwriter/Producer, and Id rather be doing that. I find, however that some functionality I need is supported in Reaper,
(the short story is I want to trigger some Reaper Actions using a Microphone as an interface) so after doing some research I am here to ask a couple of general questions...

1) How Do I define a command/name/function/etc.?
Or...how to not get THIS msg?
NameError: name 'RPR_Main_OnCommand' is not defined

2) How Do I Register Reaper functions/commands in another scripting language?
(EX. C++/python/perl)

3) How Do I Register said command/name/function/etc. with Reaper so
that the program will accept said commands?

4) In C++, am i making my own defines described as Reaper Functions or is
there a list? I don't want to accidently blow anything up.

5) How do I Address a Post or SendMessage Command to Reaper, and how
do I Find/Know which hWnd I'm sending to?

I have more questions but these will get me well started.
I am not asking anyone to do anything for me... I just need to know WHAT I
need to know...you know?

Thanks in advance to EVERYONE.
__________________
700w PSU/ASUS Sabretooth Z77 mb/Core i7 Quad-Core 2600k 3.4Ghz
Corsair Vengeance DDR3 1600Mhz (16 Gb)/Radeon HD 6450(6 Gb)
Focusrite Saffire Pro 40/Crucial 128 Gb SSD/WD 500 GB SATA HD
OldTimerNewComer is offline   Reply With Quote
Old 09-02-2011, 07:18 AM   #221
OldTimerNewComer
Human being with feelings
 
Join Date: Aug 2011
Posts: 40
Default Mayhap we are all too good to help newbies...

...I really don't see the point of a 'how to' thread no one replies to.
I watch this forum pretty closely as I am a new Reaper customer, and it seems to me that there are some pretty active helpers on this forum.

"How Do I" get in the club seems to be appropriate.

Thanks, for?
__________________
700w PSU/ASUS Sabretooth Z77 mb/Core i7 Quad-Core 2600k 3.4Ghz
Corsair Vengeance DDR3 1600Mhz (16 Gb)/Radeon HD 6450(6 Gb)
Focusrite Saffire Pro 40/Crucial 128 Gb SSD/WD 500 GB SATA HD
OldTimerNewComer is offline   Reply With Quote
Old 09-02-2011, 07:37 AM   #222
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 835
Default

Haha, sorry OldTimerNewComer. In my particular case I actually started a nice long post for you and lost it in a comp crash. Here's take #2 in a shorthand manner.

To summarize: Have you exhausted all the resources at http://reaper.fm/reference.php? Lots of links at the bottom to ReaScript support, example C++ SDK project. There's also my open source project (linked in my sig) but it's probably too much to digest for a beginner.

1) No idea.
2) See example SDK.
3) See example SDK for C++, for ReaScript add to the actions list.
4) See example SDK, or the SWS code.
5) You can send action Ids to the main reaper window, yes. SendMessage(reaperHwnd, WM_COMMAND, id, 0) == Main_OnCommand(id, 0)
sws is offline   Reply With Quote
Old 09-02-2011, 12:55 PM   #223
OldTimerNewComer
Human being with feelings
 
Join Date: Aug 2011
Posts: 40
Default

Quote:
Originally Posted by sws View Post
Haha, sorry OldTimerNewComer. In my particular case I actually started a nice long post for you and lost it in a comp crash. Here's take #2 in a shorthand manner.

To summarize: Have you exhausted all the resources at http://reaper.fm/reference.php? Lots of links at the bottom to ReaScript support, example C++ SDK project. There's also my open source project (linked in my sig) but it's probably too much to digest for a beginner.

1) No idea.
2) See example SDK.
3) See example SDK for C++, for ReaScript add to the actions list.
4) See example SDK, or the SWS code.
5) You can send action Ids to the main reaper window, yes. SendMessage(reaperHwnd, WM_COMMAND, id, 0) == Main_OnCommand(id, 0)

Just wanted to say thank you. I'm doing most of the things you suggested, in fact searching for this info has led to me d'loading visual C++, Python, Perl, Open Watcom, Au3... and completely baffling myself in the process.

My only interest in these languages is their relationship to REAPER commands/plugins/extensions...
The wiki is helpful as far as end-result info, but not implementation.

EX: I have the Reaper SDK, and C++... but I don't know how to compile.

I kind of need a step-by-step of how a script needs to be structured (Test) in order for it to access
actions/(python/Perl), or Plugins-Extensions/(C+).

This may sound stupid but I am only interested in learning enough of these languages to be able to get around REAPER really well.

Any help in focusing this issue for me would be appreciated.

Thanks again, SWS.


P.S. Sorry about your crash, hope all's well.
__________________
700w PSU/ASUS Sabretooth Z77 mb/Core i7 Quad-Core 2600k 3.4Ghz
Corsair Vengeance DDR3 1600Mhz (16 Gb)/Radeon HD 6450(6 Gb)
Focusrite Saffire Pro 40/Crucial 128 Gb SSD/WD 500 GB SATA HD

Last edited by OldTimerNewComer; 09-02-2011 at 12:59 PM. Reason: p.s.
OldTimerNewComer is offline   Reply With Quote
Old 10-18-2011, 04:39 AM   #224
Teddy
Human being with feelings
 
Join Date: Sep 2011
Posts: 62
Default

How do I get what tracks are currently displayed by my controller? I have a bcf2000 running in Mackie Sonar mode, and it would be great to be able to fetch what tracks it's currently showing (e.g. 2-9 or 1-4).

Couldn't find a CSurf function for it.
Teddy is online now   Reply With Quote
Old 10-19-2011, 03:01 PM   #225
Klinke
Human being with feelings
 
Klinke's Avatar
 
Join Date: Jul 2008
Location: Berlin / Germany
Posts: 596
Default

Quote:
Originally Posted by Teddy View Post
How do I get what tracks are currently displayed by my controller? I have a bcf2000 running in Mackie Sonar mode, and it would be great to be able to fetch what tracks it's currently showing (e.g. 2-9 or 1-4).

Couldn't find a CSurf function for it.
The extension must manage this by itself, Reaper doesn't know anything about the controller and the communication between the controller and the extension. To get a MediaTrack* from a track index, you can use the CSurf_TrackFromID method.
Klinke is offline   Reply With Quote
Old 10-19-2011, 03:39 PM   #226
Teddy
Human being with feelings
 
Join Date: Sep 2011
Posts: 62
Default

Quote:
Originally Posted by Klinke View Post
The extension must manage this by itself, Reaper doesn't know anything about the controller and the communication between the controller and the extension. To get a MediaTrack* from a track index, you can use the CSurf_TrackFromID method.
Thanks for the reply, Klinke. But since I'm using the native mackie emulation mode in Reaper, there is no way for me to implement this into the extension being used, right?
Teddy is online now   Reply With Quote
Old 10-20-2011, 01:38 AM   #227
Klinke
Human being with feelings
 
Klinke's Avatar
 
Join Date: Jul 2008
Location: Berlin / Germany
Posts: 596
Default

I don't understand what to you want to implement where. What is your goal?
Klinke is offline   Reply With Quote
Old 10-20-2011, 02:43 AM   #228
Teddy
Human being with feelings
 
Join Date: Sep 2011
Posts: 62
Default

Quote:
Originally Posted by Klinke View Post
I don't understand what to you want to implement where. What is your goal?
I'm trying to use this extension as a display for my hardware controller. To do this, I need to know which bank of tracks the controller is currently showing, and send the IDs to the webcontroller-extension.

But there is no way for me to implement this function (send showing Track IDs) to the mackie emulation mode built into Reaper, right? I could use the CSurf-extension written for bcf2000, and implement it there, but I don't think it's as good as the Mackie emulation mode. I'm on a mac, so I don't have that many options.

Hope I made more sense this time.
Teddy is online now   Reply With Quote
Old 10-20-2011, 03:21 AM   #229
Klinke
Human being with feelings
 
Klinke's Avatar
 
Join Date: Jul 2008
Location: Berlin / Germany
Posts: 596
Default

This is a little bit complicated, because you would need a direct communication between two extensions, one that is controlling the BCF and the Reaper_WWW extension. For both you have the source code, so you could create a named pipe or a socket to enable the communication between the extensions.

In CSurf_MCU the offset (of the leftmost shown track of a specific hardware) is calculated by adding m_allmcus_bank_offset (the offset for all conected MCUs/BCFs/Extenders/..., this is the value that is modified when you press the select next/previous bank buttons) and m_offset (a fixed value that is given by the user via the Control Surface Settings). When this offset is changing, you must transmit a message to the WWW extension. I'm unfamiliaer with the WWW extension code, but after a short look, it seems that there you must modify the last for loop in the ProcessCommand method. Instead of

if (minv<0) minv=0;
if (maxv>nt) maxv=nt;
for (;minv<maxv;minv++)

you would need

minv = the offset value you got from the MCU extension
if (maxv>nt) maxv=nt;
if (maxv>minv+8) maxv=minv+8; (assuming you have only one hardware unit and want to show only 8 channels)
for ...

If you use the "Show only the tracks that are also shown in the Mixer" feature, you must also communicate g_csurf_mcpmode from the MCU extension and use it's state as second parameter in CSurf_TrackFromID in the for loop of the www extension.
Klinke is offline   Reply With Quote
Old 10-20-2011, 09:44 AM   #230
Teddy
Human being with feelings
 
Join Date: Sep 2011
Posts: 62
Default

Thank you for a very informative answer, Klinke! I appreciate it.

Quote:
Originally Posted by Klinke View Post
This is a little bit complicated, because you would need a direct communication between two extensions, one that is controlling the BCF and the Reaper_WWW extension. For both you have the source code, so you could create a named pipe or a socket to enable the communication between the extensions.
I think this is too difficult for me at the moment. Maybe I'll come back for some more info on this later. But for now, I think I'll just write to a textfile and poll it with javascript. Just out of curiosity: do you know of any extensions that uses sockets/pipes? It would be nice to have some code to look at.
Teddy is online now   Reply With Quote
Old 10-20-2011, 11:00 AM   #231
Klinke
Human being with feelings
 
Klinke's Avatar
 
Join Date: Jul 2008
Location: Berlin / Germany
Posts: 596
Default

I don't think that an existing Reaper extension is using some kind of interprocess communication. I have done it once for a private project, but for a more complex topology (one server, many clients) and using the JUCE libary, which would be an overkill to add into your extensions just to get a pipe. So i think that this code wouldn't be useful for you.
Klinke is offline   Reply With Quote
Old 11-13-2011, 12:25 PM   #232
drew
Mobile
 
drew's Avatar
 
Join Date: Jan 2006
Location: London & São Paulo. Hardcore commercial REAPERite
Posts: 1,583
Default

Hi extension-makers!

I've been trying to find a way to smoothly move the play cursor at a certain point during playback without any noticeable jump in the audio... and... I've failed!

The goal is to be able to set a toggle to "play regions" which would allow me to start from anywhere (inside or outside a region) and when it gets to the end of a numbered region, skip playback to the start of the next (which may be earlier in the track), to be able to prototype structures & sequences before moving things around on the timeline.

Now I'm wondering - am I wasting my time trying? I have a suspicion that this may not be achievable in an extension (maybe unless it is running a very short timer which may compromise performance).

Additionally I'd love to be able to render that way too but now I think I'm really hoping for too much! The batch render functionality now built in is great, but I had hoped I'd be able to ask it to render a single file made up of all regions in order. That almost certainly wouldn't be possible with play cursor manipulation from an extension!

Any thoughts welcome
__________________
Proudly using REAPER exclusively for professional music production at Qsonics.com and recording broadcast and narrative voiceovers at DrewWhite.com.
drew is offline   Reply With Quote
Old 11-13-2011, 02:59 PM   #233
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 835
Default

Yo Drew,

Yeah, to make seamless non-sequential playback you need tight hooks into the playback engine, which the extensions don't have. If you think about it, imagine the "work" that goes on behind the scenes in Reaper just to make looping work. You basically have to fill the first part of the audio buffer with data from one place in the project, and then the rest from somewhere else. And with all the prebuffering and anticipative FX processing going on, I can imagine this gets a little complex.

However, I've often wondered if you could make a little hack that uses the action "Play: skipping time selection". You'd setup a "moving" time selection to jump ahead in time and a loop selection to move back in time. You'd need link loop/time sel off and seek on time sel change off too, and perhaps lock the selection so the user couldn't break things during playback. It wouldn't work for render either...

Last edited by sws; 11-13-2011 at 08:38 PM.
sws is offline   Reply With Quote
Old 12-10-2011, 08:48 PM   #234
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 1,202
Default

is there a way to get GUID for a project (like you do for a track) with ReaScript?

I want to store some data related to a project in the file and I do it in location I get with RPR_GetProjectPath.
However, when the project is unsaved it get`s saved to C:\Users\Breeder\Documents\REAPER Media

When I resave, my file doesn`t get moved with the rest of the project.

Instead of creating another script that moves the file around when resaving (which would be painful for a user..I want to make it noob-proof so user doesnt has to worry about stuff like this) I would like to create a file with paths in resource folder. And I guess I would need project GUID for that. Unless there is a way to notify reaper that a certain file is now part of the project and it should follow it when getting resaved? :S

I thought about creating temp file with info on last used project path but that could create mistakes. Ie: I create a temp file that points to REAPER Media folder. But the project doesn`t get saved. Next time a new project is created it will use the same file from REAPER media folder which has data that is invalid for that project. Putting project name in filename would also not be good since user can name different project with the same name.

And sorry for silly questions...this is my first attempt at python in general (I only learned Pascal when I was a kid)


edit: I noticed now that extensions can write to project file. Surely there must be a way to do that with reascript? :S If not...it definitely should be!


Thank you!
btw, using 4.14pre5 if that makes any difference (due to recent ReaScript changes)

Last edited by Breeder; 12-11-2011 at 03:05 AM.
Breeder is offline   Reply With Quote
Old 02-27-2012, 07:29 PM   #235
KarlLai
Human being with feelings
 
KarlLai's Avatar
 
Join Date: Feb 2012
Posts: 26
Default

Is there a way to attach some userdata onto a note for midi items?

For example, if I want to store some extra strings for a note, is there an action/extension/API function to do that? I noticed that there is a midi_message[3] in MIDI_event_t struct not used by reaper, but if I try to change the size of MIDI_event_t to 4 and add some flags to midi_message[3], the midi editor doesn't take it as a valid note anymore...
KarlLai is offline   Reply With Quote
Old 02-28-2012, 04:53 PM   #236
KarlLai
Human being with feelings
 
KarlLai's Avatar
 
Join Date: Feb 2012
Posts: 26
Default

Quote:
Originally Posted by KarlLai View Post
Is there a way to attach some userdata onto a note for midi items?

For example, if I want to store some extra strings for a note, is there an action/extension/API function to do that? I noticed that there is a midi_message[3] in MIDI_event_t struct not used by reaper, but if I try to change the size of MIDI_event_t to 4 and add some flags to midi_message[3], the midi editor doesn't take it as a valid note anymore...
Okay, Justin from Reaper had a good solution: (copied from his email reply)

normally the MIDI_event_t are dynamically sized, when stored in the lists, so that sysex/text/etc type messages can be stored. I.e. if you want to have a structure that had additional data, you can do:

struct myEvent {
MIDI_event_t evt;
unsigned char extra_data[1]; // can be whatever size you like
};

Then, if you wish to add an event, you can do:

myEvent e; e.evt.size = 4; e.evt.frame_offset = ...; e.evt.midi_message[3] = 1; // note at this point index [3] maps to extra_data[0].

then, list->AddItem(&e.evt);

...this is the preferred way of dealing with larger events.


Edit: Actually, after getting more knowledge about MIDI format, I found I dont have to do this. :P

MIDI format itself provide enough freedom to store userdata already.

Last edited by KarlLai; 04-16-2012 at 12:21 PM.
KarlLai is offline   Reply With Quote
Old 04-24-2012, 03:15 PM   #237
Diogo Azevedo
Human being with feelings
 
Join Date: Mar 2010
Location: Brazil
Posts: 42
Default

Howto Get/Set MidiIn on the track?
Diogo Azevedo is offline   Reply With Quote
Old 05-01-2012, 06:29 AM   #238
jnif
Human being with feelings
 
jnif's Avatar
 
Join Date: Dec 2008
Posts: 1,928
Default

How do I save and restore clipboard contents?

Many scripts and macros use clipboard for internal cut/copy/paste operations. This means that executing those macros and scripts will "corrupt" the clipboard. It would be nice to be able to save clipboard in the beginning and restore it back in the end so that internal clipboard usage would be hidden.

jnif
jnif is offline   Reply With Quote
Old 05-01-2012, 06:41 AM   #239
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Midi automateable sends. Only via OSC.
Posts: 1,127
Default

In Windows, you can use AutoHotkey for that.
__________________
Volume mixing via jogwheeling with mouseovering. Yeah!
Check my Reaper real-time usage ideas.
boreg made it, never hanging notes in Reaper again! Thanks boreg! boreg & bang.
TonE is offline   Reply With Quote
Old 05-06-2012, 07:30 AM   #240
Jeffos
Mortal
 
Jeffos's Avatar
 
Join Date: Dec 2008
Location: France
Posts: 1,761
Default

Quote:
Originally Posted by Diogo Azevedo View Post
Howto Get/Set MidiIn on the track?
Quote:
Originally Posted by jnif View Post
How do I save and restore clipboard contents?
There are such C++ examples in the SWS open source: http://code.google.com/p/sws-extensi...e/browse/trunk
Jeffos is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:30 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.