mirror of
https://github.com/python/cpython.git
synced 2025-11-13 07:26:31 +00:00
Fixed example
This commit is contained in:
parent
e8ea21b0fe
commit
6601964f7b
1 changed files with 6 additions and 1 deletions
|
|
@ -89,8 +89,12 @@ class Play_Audio_mac:
|
||||||
import audioop
|
import audioop
|
||||||
return audioop.ulaw2lin(data, 2)
|
return audioop.ulaw2lin(data, 2)
|
||||||
|
|
||||||
def test(fn = 'f:just samples:just.aif'):
|
def test():
|
||||||
import aifc
|
import aifc
|
||||||
|
import macfs
|
||||||
|
fss, ok = macfs.PromptGetFile("Select an AIFF soundfile", "AIFF")
|
||||||
|
if not ok: return
|
||||||
|
fn = fss.as_pathname()
|
||||||
af = aifc.open(fn, 'r')
|
af = aifc.open(fn, 'r')
|
||||||
print af.getparams()
|
print af.getparams()
|
||||||
p = Play_Audio_mac()
|
p = Play_Audio_mac()
|
||||||
|
|
@ -102,6 +106,7 @@ def test(fn = 'f:just samples:just.aif'):
|
||||||
data = af.readframes(BUFSIZ)
|
data = af.readframes(BUFSIZ)
|
||||||
if not data: break
|
if not data: break
|
||||||
p.writeframes(data)
|
p.writeframes(data)
|
||||||
|
print 'wrote', len(data), 'space', p.getfillable()
|
||||||
p.wait()
|
p.wait()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue