I'm updating the AudioRecorder.py to record as a wav (so that
wavemodule can get raw samples for plotting/visualization). Also, I wanted to use
I'm trying to understand how to pass an argument to the function. The prototype is:
typedef double NSTimeInterval;
I thought in
ctypesI would use this as follows:
started_recording=msg(recorder, c_bool, 'recordForDuration',[c_double], 1.0)
to record for 1 second. Is this the right way to pass a double into this function?
This call crashes pythonista. Strangely, after I reopen pythonista, the recorded file is exactly 1 second, so it seems like it is working, but just also crashing.
Haven't tried this myself yet, so there might be other problems, but your selector string is incorrect, it should be
'recordForDuration:'(with a colon at the end).
Thanks. That may have helped. What finally worked, sort of, is that I had to ensure the object stayed in scope long enough for the record to complete (I.e sleep).
Does garbage collection have some way of knowing that a
ctypesobject can't be gc'd yet? Or do we sort of need to manage our own references? I guess in this case I also need to wait until it is done so I can
releasethe object, since I'm guessing ctypes has no way of knowing which objects need to be explicitly released by objc?