metrasynth / radiant-voices

Work with SunVox file format tools (create, modify, read, write)
https://radiant-voices.rtfd.io/
Other
40 stars 3 forks source link

Detach module ? #20

Closed jhw closed 5 years ago

jhw commented 5 years ago

Hi,

How do u detach a module from a project and attach it to another one ? Does it need to be explicitly detached / cloned to remove the original module index ? I get the following -

 File "/home/justin/work/seavox/lib/python3.6/site-packages/rv/project.py", line 70, in attach_module
    module.index = self.module_index(module)
AttributeError: 'str' object attribute 'index' is read-only

so wondering if there is any support for such a thing.

Thx!

matthewryanscott commented 5 years ago

@jhw do you still need help with this?

You can clone modules like so:

from rv.api import Project, m
p, p2 = Project(), Project()
amp = p.new_module(m.Amplifier)
amp2 = p2.attach_module(amp.clone())

I think you may have shed light on a missing API though... Project.detach_module(module) should let you detach a module just as you can attach one. Detaching a module would also mean disconnecting it from all other modules.

Also, I don't think already-attached modules should be able to be attached to other projects without first being detached, as this could cause problems.

In light of this, I'm going to reopen this issue and take care of those issues soon.

matthewryanscott commented 5 years ago

@jhw you can now try this if you like 😄

from rv.api import Project, m
p, p2 = Project(), Project()
amp = p.new_module(m.Amplifier)
assert amp.parent is p
p2.attach_module(p.detach_module(amp))
assert amp.parent is p2
jhw commented 5 years ago

Yeah I closed it as I got round it by simply creating a new module with the same controller values. But yeah, I think a detach() API is a nice addition. Will try it, many thanks!

On Thu, 21 Feb 2019 at 03:24, Matthew R. Scott notifications@github.com wrote:

@jhw https://github.com/jhw you can now try this if you like 😄

from rv.api import Project, m

p, p2 = Project(), Project()

amp = p.new_module(m.Amplifier) assert amp.parent is p

p2.attach_module(p.detach_module(amp)) assert amp.parent is p2

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/metrasynth/radiant-voices/issues/20#issuecomment-465847336, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAilN2Lv8fpBBKm3AkMTdZ7P0j1Wv1wks5vPhGFgaJpZM4bGFNh .

jhw commented 5 years ago

Working on this

https://github.com/jhw/seavox/blob/master/README.md

I will probably have some pull requests for Radiant Voices shortly

On Thu, 21 Feb 2019 at 07:25, justin worrall justin.worrall@gmail.com wrote:

Yeah I closed it as I got round it by simply creating a new module with the same controller values. But yeah, I think a detach() API is a nice addition. Will try it, many thanks!

On Thu, 21 Feb 2019 at 03:24, Matthew R. Scott notifications@github.com wrote:

@jhw https://github.com/jhw you can now try this if you like 😄

from rv.api import Project, m

p, p2 = Project(), Project()

amp = p.new_module(m.Amplifier) assert amp.parent is p

p2.attach_module(p.detach_module(amp)) assert amp.parent is p2

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/metrasynth/radiant-voices/issues/20#issuecomment-465847336, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAilN2Lv8fpBBKm3AkMTdZ7P0j1Wv1wks5vPhGFgaJpZM4bGFNh .

jhw commented 5 years ago

Also this, related

https://github.com/jhw/sunbeam/blob/master/README.md

U might want to watch the two of them and I'll do the same for RV

On Thu, 21 Feb 2019 at 12:38, justin worrall justin.worrall@gmail.com wrote:

Working on this

https://github.com/jhw/seavox/blob/master/README.md

I will probably have some pull requests for Radiant Voices shortly

On Thu, 21 Feb 2019 at 07:25, justin worrall justin.worrall@gmail.com wrote:

Yeah I closed it as I got round it by simply creating a new module with the same controller values. But yeah, I think a detach() API is a nice addition. Will try it, many thanks!

On Thu, 21 Feb 2019 at 03:24, Matthew R. Scott notifications@github.com wrote:

@jhw https://github.com/jhw you can now try this if you like 😄

from rv.api import Project, m

p, p2 = Project(), Project()

amp = p.new_module(m.Amplifier) assert amp.parent is p

p2.attach_module(p.detach_module(amp)) assert amp.parent is p2

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/metrasynth/radiant-voices/issues/20#issuecomment-465847336, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAilN2Lv8fpBBKm3AkMTdZ7P0j1Wv1wks5vPhGFgaJpZM4bGFNh .