Old 03-10-2011, 11:39 PM   #1
joost
Human being with feelings
 
Join Date: Dec 2010
Posts: 16
Default A track's midi events?

How do I get to a track's midi events (note on/off and such) and how can I make modifications to these events?

joost
joost is offline   Reply With Quote
Old 03-11-2011, 12:11 AM   #2
RuairiAU
Human being with feelings
 
RuairiAU's Avatar
 
Join Date: Sep 2010
Location: Perth, Australia
Posts: 438
Default

Either record some MIDI first or insert a new MIDI item from the track menu. Then double click the item to open the MIDI editor.
__________________
Download AlphaTrack Pro
RuairiAU is offline   Reply With Quote
Old 03-11-2011, 01:18 AM   #3
gofer
-blänk-
 
gofer's Avatar
 
Join Date: Jun 2008
Posts: 11,359
Default

Retreiving an item's MIDI events via API is said to be a pain. I don't know enough about coding, but can give you the following hints:

GetSetItemState http://wiki.cockos.com/wiki/index.ph...etSetItemState replies with a bunch of text, similar to what you find as item descriptions in *.rpp files. For MIDI items it includes all event data in the HASDATA part.

This is where my bit of wisdom stops. I have no idea how to use/alter that data, but it is possible as fellow member fingers has shown with his MIDI groove quantize code.

Here is some more info about the "state chunks": http://wiki.cockos.com/wiki/index.ph...dRppMidiFormat


I hope this helps.
gofer is offline   Reply With Quote
Old 03-11-2011, 08:57 AM   #4
joost
Human being with feelings
 
Join Date: Dec 2010
Posts: 16
Default

Quote:
Originally Posted by gofer View Post
GetSetItemState http://wiki.cockos.com/wiki/index.ph...etSetItemState replies with a bunch of text, similar to what you find as item descriptions in *.rpp files. For MIDI items it includes all event data in the HASDATA part.
Yeah, (long sigh :-) I have been eyeing that function for a while but hoped there is/was something more intelligent. Bummer. This means either a lot of time I will need to spend here or I just walk away from my "little" project (grin:-)

joost
joost is offline   Reply With Quote
Old 03-11-2011, 11:47 PM   #5
joost
Human being with feelings
 
Join Date: Dec 2010
Posts: 16
Default a little bit of pseudo code...

I am a newbie to the reaper API, would anyone knowledable mind helping me check if I am on the right path getting to extracting midi info from a track with this little bit of pseudo code:

n = GetNumTracks()

for( i = 0; i < n; i++ )
mediaTrack = CSurf_TrackFromID( i + 1, false )
m = GetTrackNumMediaItems( mediaTrack )

for ( j = 0; j < m; j++ )
mediaItem = GetTrackMediaItem( mediaTrack, j );
str = ""
len = 0
GetSetItemState( mediaItem, str, len )


At this point str holds an "rpp chunk", correct? Is there a way to determine if mediaItem is a audio or midi item before calling GetSetItemState()?

There is no possibility of loading more than 1 project at the time in Reaper is there? There functions mentioned in the online doc which require a project pointer of sorts (such as MediaTrack* GetTrack(ReaProject* proj, int trackidx) Is "proj" a real thing or just always set to zero?

By the way, I cannot seem to find GetTrack() in the include files, whats up with that?
joost 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 01:28 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.