I’d like to make a class “Sound” to use it like this:
playingNote = Sound(instr, track, note, vel) – to trigger a note or, if the note already playing, change it
playingNote = nil – to stop note
Is it possible? For now I have
class "Sound"
function Sound:__init( instr, track, note, vel)
self.instr = instr
self.track = track
self.note = note
self.vel = vel
client:send(renoise.Osc.Message("/renoise/trigger/note_on", {{ tag = "i", value = instr},{ tag = "i", value = track},{ tag = "i", value = note},{ tag = "i", value = vel}}))
end
function Sound:off()
client:send(renoise.Osc.Message("/renoise/trigger/note_off", {{ tag = "i", value = self.instr},{ tag = "i", value = self.track},{ tag = "i", value = self.note}}))
end
I didn’t find how to make function in class that executes when you make variable nil. So I had to make function “off”
And to change note, I have to write:
playingNote:off()
playingNote = Sound(instr, track, note, vel)
It works, but I just would like to make it oneliner.