Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 05-17-2012, 08:25 AM   #1
drew
Mobile
 
drew's Avatar
 
Join Date: Jan 2006
Location: London & São Paulo. Hardcore commercial REAPERite
Posts: 1,669
Default ReaScript - RPR_format_timestr_pos - not all formats working?

Hello ReaScripters..

I'm able to get RPR_format_timestr_pos to convert a time to samples and H:M:S:F, but can't find a way to return minutes:seconds or measures.beats. If I try using -1,0,1 or 2 I get the value back in seconds (which is the value I have passed it).

I'm assuming this wiki line shows correct values to use:

time formatting mode overrides: -1=proj default. 0=time 1=measures:beats + time 2=measures:beats 3=seconds 4=samples 5=h:m:s:f


Incidentally that list of values is also shown on this entry: http://wiki.cockos.com/wiki/index.ph...format_timestr which doesn't have that modeoverride parameter, or am I just confused?
__________________
Proudly using REAPER exclusively for...
* Media and event music composition & production, sound design + auto-processing at Qsonics.com
* Broadcast branding, promos, education & training and narration voice-overs at DrewWhite.com
drew is offline   Reply With Quote
Old 05-17-2012, 10:56 AM   #2
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,812
Default

That function returns information in the parameter list (the returned string is the 2nd parameter). In order to access the parameter list from ReaScript, you need to use the list syntax:

str=""
(a,str,b,c)=RPR_format_timestr_pos(pos, str, 512, 2)

Then str will hold the formatted position in bars.beats.
schwa is offline   Reply With Quote
Old 05-17-2012, 11:16 AM   #3
drew
Mobile
 
drew's Avatar
 
Join Date: Jan 2006
Location: London & São Paulo. Hardcore commercial REAPERite
Posts: 1,669
Default

Great!

I was using RPR_format_timestr_pos(pos,0,0,4)[1] to get samples, which worked fine..

now RPR_format_timestr_pos(pos,"",512,0)[1] is working for time

Thanks!
__________________
Proudly using REAPER exclusively for...
* Media and event music composition & production, sound design + auto-processing at Qsonics.com
* Broadcast branding, promos, education & training and narration voice-overs at DrewWhite.com
drew is offline   Reply With Quote
Old 04-18-2014, 12:39 AM   #4
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default

What will be the right syntax for this in EEL? Anyone pls?
Viente is offline   Reply With Quote
Old 04-18-2014, 02:01 AM   #5
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Viente View Post
What will be the right syntax for this in EEL? Anyone pls?
Code:
function format_timestr_pos()
(
  /*
  time formatting mode overrides: -1=proj default.
  0=time
  1=measures.beats + time
  2=measures.beats
  3=seconds
  4=samples
  5=h:m:s:f
  */
  
  tpos = GetCursorPosition();
  modeoverride = 4; // 4=samples
  #buf = "";
  format_timestr_pos(tpos, #buf, modeoverride);
  ShowConsoleMsg(#buf);
);

format_timestr_pos();
spk77 is offline   Reply With Quote
Old 04-18-2014, 03:59 AM   #6
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default

Thanks!
Viente 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 10:22 PM.


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