This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from objc_util import * | |
import weakref | |
import functools | |
''' Attempt at making more natural objc class in pythonista. | |
decorate python class with @objclass to create an ObjCClass. | |
set superclass and protocols class attributes, if desired. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui | |
class PointShowingView(ui.View): | |
def __init__(self,*args,**kwargs): | |
ui.View.__init__(self,*args,**kwargs) | |
self.p=(150,150) | |
self.color=(0.5,0.5,.5) | |
def draw(self): | |
ui.set_color(self.color) | |
ui.Path.rect(*self.p,100,100).fill() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from objc_util import * | |
import ui | |
def printMethods(whichObject): | |
#print (dir(whichObject)) | |
for method in dir(whichObject): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sound | |
import ui | |
from math import floor | |
class RecorderView(ui.View): | |
'''simple metering view, attached to a recorder''' | |
def __init__(self, filename, callback=None, *args,**kwargs): | |
ui.View.__init__(self,*args,**kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sound | |
import ui | |
from math import floor | |
class RecorderView(ui.View): | |
'''simple metering view, attached to a recorder''' | |
def __init__(self, filename, *args,**kwargs): | |
ui.View.__init__(self,*args,**kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from objc_util import * | |
import console | |
from functools import partial | |
NSNotificationCenter=ObjCClass('NSNotificationCenter') | |
#logging.basicConfig(filename='log.txt',format='%(levelname)s:%(message)s', level=logging.DEBUG) | |
class NotificationObserver(object): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import * | |
from objc_util import c | |
AudioUnitRenderActionFlags=c_uint32 | |
OSStatus=c_int32 | |
OSType=c_uint32 | |
class SMPTETimeType(c_uint32): | |
kSMPTETimeType24 = 0 | |
kSMPTETimeType25 = 1 | |
kSMPTETimeType30Drop = 2 | |
kSMPTETimeType30 = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from objc_util import * | |
from ctypes import * | |
from coreaudioconstants import * | |
import time | |
import numpy as np | |
''' Adapted from https://www.cocoawithlove.com/2010/10/ios-tone-generator-introduction-to.html | |
''' | |
AudioUnitRenderActionFlags=c_uint32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from objc_util import * | |
from ctypes import * | |
from coreaudioconstants import * | |
import time | |
import numpy as np | |
''' Adapted from https://www.cocoawithlove.com/2010/10/ios-tone-generator-introduction-to.html | |
''' | |
AudioUnitRenderActionFlags=c_uint32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from objc_util import * | |
from ctypes import * | |
from contextlib import contextmanager | |
import ui | |
import numpy as np | |
''' define ctypes signatures''' | |
IOSurfaceCreate=c.IOSurfaceCreate | |
IOSurfaceCreate.argtypes=[c_void_p] | |
IOSurfaceCreate.restype=c_void_p |