bastibe/PySoundCard

callback examples in README don't work

Closed this issue · 3 comments

I'm running in OSX, and copy/pasting the callback-style examples straight up does not work for me.

TypeError: 'long' object does not support item assignment
From callback <function callback_stub at 0x1018f4d70>:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pysoundcard.py", line 424, in callback_stub
time_info, status_flags)
File "fivesecondslivecallback.py", line 7, in callback
out_data[:] = in_data

Thank you for the bug report!

We are currently working on the next major release, and we updated the README too early.

The correct example for the old version would be:

def callback(in_data, time_info, status):
    return (in_data, continue_flag)

As you can see, the old code passed recorded data into the callback, and the callback should return data for playback. The current code passes both recorded data and playback data into the callback.

Sorry for the confusion.

I just updated the README accordingly.

Thanks!