Jump to content


Photo

Phrase Iterator - Object ?


  • Please log in to reply
5 replies to this topic

#1 RachmanEnough

RachmanEnough

    Advanced Member

  • Normal Members
  • PipPipPip
  • 92 posts
  • Gender:Male
  • Location:Not far from the c-base

Posted 24 March 2014 - 15:30

Hi,

I've just begun digging into the scripting. And I found a pattern iterator object but no phrase iterator. :smashed:

Moreover I'd like to know, how I can print out all members (methods and properties) of an object.

I wrote :


local newphrase = renoise.song().instruments[6]:insert_phrase_at(1)

--rprint(newphrase)

for key,value in pairs(getmetatable(newphrase)) do
    print("member:" .. key);
end



And what I got was (snippet, cause I cannot copy/paste from the renoise terminal) :


member: 1
member: __eq
member: __call
member: __concat
...

I think some properties are missing ? So my question would be, how can I display all (Renoise API)-properties of an object ?

Thanks for the input. :badteeth:

#2 vV

vV

    God's or Borg's Chief and Ruler of All Species

  • Moderator
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 16855 posts
  • Gender:Male
  • Location:Netherlands

Posted 24 March 2014 - 15:51

You can quickly use oprint and rprint in the terminal viewer.
Spoiler

Vv....


cpu Intel Core i7-4820K @3.70GHz
chipset Intel X79 chipset
mem 32 Gb 2400Mhz
os Win 7 64-bit SP1, DirectX 11
audio ESI ESP1010e - > Driver rev:2.0.6.0
video nVidia Geforce GTX780 - > Driver rev:335.23


Renoise Official Manual

#3 RachmanEnough

RachmanEnough

    Advanced Member

  • Normal Members
  • PipPipPip
  • 92 posts
  • Gender:Male
  • Location:Not far from the c-base

Posted 24 March 2014 - 16:20

You rock ! :yeah:

#4 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7174 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 27 June 2014 - 18:22

I've just begun digging into the scripting. I found a pattern iterator object but no phrase iterator.


Me too.

I need the functional equivalent of

iter = renoise.song().pattern_iterator:lines_in_pattern(
      renoise.song().selected_pattern_index)

But for the phrase editor. What are my options? The Api 3 to 4 post mentions:

enoise.song().instruments[].phrases[]:lines_in_range(index_from, index_to)
  -> [array of renoise.PatternLine objects]

But I don't need and `array of renoise.PatternLine objects`, insteadI need an `[iterator with pos, line (renoise.PatternTrackLine object)]`, or are these the same thing?

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#5 Conner_Bw

Conner_Bw

    Probably More God or Borg Than Human Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 7174 posts
  • Gender:Male
  • Location:Montreal, Quebec, Canada

Posted 27 June 2014 - 20:35

Never mind, I figured it out.

I just have to use ipairs() on the result and the behaviour I want is the same, Ie.

iter = renoise.song().selected_phrase:lines_in_range(1, renoise.song().selected_phrase.number_of_lines)  
for pos,line in ipairs(iter) do
 -- ...

Good times.

cpu Lenovo X220, Intel i7-2640M @ 2.80GHz ×4 os Windows 10 / Ubuntu 16.04 LTS
My Homepage » : My Renoise Tools » : Normalize Your Sig » : MBC Archives »


#6 taktik

taktik

    Renoise Developer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 15040 posts
  • Gender:Male
  • Location:Berlin, Germany
  • Interests:füße waschen

Posted 28 June 2014 - 11:47

The pattern iterators are implemented in Lua, based on the existing C++ wrappers. See below for the implementation, which could be tweaked to support phrases too.

Iter's pos would be a pos = { phrase, line } table then. There's no "track" in phrases and "pattern" index should be "phrase" index then.

Spoiler



Also no need to use 'lines_in_range' here, so this can be simplified to:

for index,line in pairs(renoise.song().selected_phrase.lines) do
  print(index, line)
end

  • Conner_Bw, joule, .xrns and 1 other like this