Beads audio library in Python mode

Isn’t setting python.security.respectJavaAccessibility to false a potentially easier option? At least, if it works it doesn’t involve code changes.

Other than that either forking the library or starting a conversation on the mailing list are the ways forward. I believe a protected getter should also work?

I’ve got no idea on how to do that for Processing’s Python Mode! :confused:

Even if we could hack the Python Mode to include that setting, that’d work only for folks who did it as well! Extremely impractical! :roll_eyes:

You believe wrongly. As I have stated here a couple of times already: :face_with_monocle:

I’ve said members; which include fields, methods and constructors! :open_mouth:

That’s not what the docs say though.

Dunno which “docs” you’d be reading which would imply that protected methods are OK to access freely while protected fields aren’t! :face_with_raised_eyebrow:

Here’s some test sketch in order to check whether protected methods got a free pass or not. :test_tube:

In this test, public method AudioContext::isRunning() is invoked:
BeadsProject.net/doc/net/beadsproject/beads/core/AudioContext.html#isRunning--

Then followed by protected method AudioContext::update():
BeadsProject.net/doc/net/beadsproject/beads/core/AudioContext.html#update--

Lo & behold: “AttributeError: ‘beads.AudioContext’ object has no attribute ‘update’” :see_no_evil:

add_library('beads')

ac = AudioContext()

print ac.isRunning() # public method (works!)

# AttributeError: 'beads.AudioContext' object has no attribute 'update'
ac.update() # protected method (doesn't work!)

exit()

http://www.jython.org/archive/21/docs/subclassing.html

I think your code is wrong.

And this is all going around in circles unless someone posts on the Beads mailing list with what (you think) is required here. I’m not interested in arguing how Jython works, or doesn’t! :smile:

You’re right this time! Indeed methods got a free pass in Jython, while fields don’t! :dizzy_face:

Here’s a more extensive test which proves that: :woozy_face:

add_library('beads')

def setup():
    ac = MyAudio()
    ac.test()
    ac.update() # protected method access

    f = MyFunct(WavePlayer(ac, 5.0, Buffer.SINE))
    f.test()

    exit()


class MyAudio(AudioContext):
    def test(self):
        print self.isRunning() # public method access
        self.update() # protected method access



class MyFunct(Function):
    def test(self):
        # AttributeError: 'MyFunct' object has no attribute 'x'
        print len(self.x) # protected field access