• @mikael said:

    v = sv.objc_instance
    for _ in range(6): v = v.superview()

    From some time (iOS 14?), these lines are no more sufficient...
    Up to 8 instead of 6 solve the problem, but I have generalized it with

    #for _ in range(8): v = v.superview() #v.gestureRecognizers()[0].setEnabled(False) UIPanGestureRecognizer = ObjCClass('UIPanGestureRecognizer') #i = 0 while v: #i+=2 #print(' '*i,v._get_objc_classname()) if v.gestureRecognizers(): for gr in v.gestureRecognizers(): # comment next line to avoid UIParallaxTransitionPanGestureRecognizer #if gr.isKindOfClass_(UIPanGestureRecognizer.ptr): if gr._get_objc_classname() == b'UIPanGestureRecognizer': #print(' '*i,gr._get_objc_classname()) gr.setEnabled(False) v = v.superview()
  • as an aside -- you shouls never create arrays like this... use np.linspace! np.linspace(0,10,1000000) is about 10x faster than list comprehension!

  • @ccc I didn’t get to update the online docs yet, will happen soon.

    @cvp It‘s fine either way. You can also report bugs on GitHub btw: https://github.com/omz/Pythonista-Issues/

  • @JonB Thanks.

    tbuf = (ctypes.c_int16*1024).from_address(outBuffer.data().value) # Not error,and using tbuf[1] can get data. # It's right ??
  • the restype is a pointer. you have a structure. you want to return a pointer to the structure.


    You may need to cast(pointer(inBuffer), c_void_p)

  • some information for structure.

    # old method class AudioComponentDescription(ctypes.Structure): _fields_=[('componentType',ctypes.c_uint32),('componentSubType',ctypes.c_uint32),('componentManufacturer',ctypes.c_uint32),('componentFlags',ctypes.c_uint32),('componentFlagsMask',ctypes.c_uint32)] # New method from collections import namedtuple AudioComponentDesc = namedtuple("AudioComponentDesc", "componentType componentSubType componentManufacturer componentFlags componentFlagsMask") anyEffect_o = AudioComponentDescription(conver_OSType('aufx'),conver_OSType('dcmp'),conver_OSType('appl'),0,0) anyEffect_n = AudioComponentDesc(conver_OSType('aufx'),conver_OSType('dcmp'),conver_OSType('appl'),0,0) # using old method call this function will error,new method it's ok. availableEffects = manager.componentsMatchingDescription_(anyEffect_n) # but objc function return it's all fail. AVAudioUnit.instantiateWithComponentDescription_options_completionHandler_(availableEffects[0].audioComponentDescription(),1,AVAudioUnitComp1) # if using this will ok AVAudioUnit.instantiateWithComponentDescription_options_completionHandler_(anyEffect,1,AVAudioUnitComp1)
  • @JonB Thanks you very much.

    Are you using Pythonista 3 new Beta version?

    I run on my iPad Pro 9.7 and Pythonista 3 (App Store Version).


    can slow down memory lost speed, total 240s audio file play,eat about 20M memory.

  • Also, as I said above, the options argument is an integer, not an array. [] and ns([]) does not work, you need to use 0 here.

  • @wolf71 , great. The call to super is a Python 3 construct. But it's nice, because it's generic. It just calls the base class without having to refer to it absolutely. In the Python 2 version, you can see calling ui.View.init() by name. It may seem like a small difference, but it really can make life a lot easier if you chop,and change your code object model. I am just thinking about small things here. But on a medium to large project I am sure it can have a profound impact. I can only speculate as I have never done a large project in Python.

    My comments above are about when you are inheriting from just one base class. You have to think a little harder(aka, have more understanding) if your are inheriting from multiple base classes (multiple inheritance).

  • @JonB It's work. :-)

  • The code you copied this from was in the context of another Object, like perhaps the application's main delegate object, etc. in your case, just thing of it as a place to store your audioengine,.. global is probably fine, depending on what you are doing.

    (in real objc, while blocks do have a hidden self parameter, I don't think you can normally access it without introspection... )

    your problem seems to be you have not created your AVAudioEngine or AVAudioPlayerNode.
    Your code is using those as globals, which is fine here, but those globals better exist!

  • @wolf71 In this case you need to pass both arguments using byref. The first argument (buffer) is a pointer-to-pointer-to-char, and aabuf is a pointer-to-char, so you need to use byref to make it a pointer-to-pointer. Same with the next one - len needs to be a pointer-to-long, and aalen is a long, so you need to put it through byref to make it a pointer.

  • @Webmaster4o , I know your heart was in the right place. It just sounded hash.

  • @robertiii, seems to be an Apple-defined limit, that may be driven by Bluetooth LE limits. It is now hard to find concrete current information in Apple docs, but I wanted to make that limit visible so that you get warned before embarking on an ambitious project targeting hundreds of peers in one session.

  • Python 2.7

  • If so, please add Cmd+# for un/commenting too. Not only because it makes more sense in Python, but because on the German keyboard, # has its own key, but / is Shift+7. ;)

  • It's ok. Thanks.
    The Pythonista 3 it's greate. upgrade from Pythonista 2.

Internal error.

Oops! Looks like something went wrong!