summaryrefslogtreecommitdiff
path: root/Demo/sgi
diff options
context:
space:
mode:
authorSjoerd Mullender <sjoerd@acm.org>1993-12-22 11:44:49 +0000
committerSjoerd Mullender <sjoerd@acm.org>1993-12-22 11:44:49 +0000
commitd6b9ce961e314a4a980be0affaa9795553dbd8fc (patch)
tree70815c6592c1ae1306e9e368c2ae6b67784bbe16 /Demo/sgi
parent7d6aa51b56c6337ad5b1cb880f7c075290777f51 (diff)
downloadcpython-git-d6b9ce961e314a4a980be0affaa9795553dbd8fc.tar.gz
Fixed use of aifc module.
Diffstat (limited to 'Demo/sgi')
-rwxr-xr-xDemo/sgi/video/Vrec.py14
-rwxr-xr-xDemo/sgi/video/Vrecb.py14
2 files changed, 10 insertions, 18 deletions
diff --git a/Demo/sgi/video/Vrec.py b/Demo/sgi/video/Vrec.py
index 57b628c31f..b3660e2e06 100755
--- a/Demo/sgi/video/Vrec.py
+++ b/Demo/sgi/video/Vrec.py
@@ -378,12 +378,12 @@ AQSIZE = 8000 # XXX should be a user option
def initaudio(filename, stop, done):
import thread, aifc
afile = aifc.open(filename, 'w')
- afile.nchannels = AL.MONO
- afile.sampwidth = AL.SAMPLE_8
+ afile.setnchannels(AL.MONO)
+ afile.setsampwidth(AL.SAMPLE_8)
params = [AL.INPUT_RATE, 0]
al.getparams(AL.DEFAULT_DEVICE, params)
print 'audio sampling rate =', params[1]
- afile.samprate = params[1]
+ afile.setframerate(params[1])
c = al.newconfig()
c.setchannels(AL.MONO)
c.setqueuesize(AQSIZE)
@@ -394,16 +394,12 @@ def initaudio(filename, stop, done):
# Thread to record audio samples
-# XXX should use writesampsraw for efficiency, but then destroy doesn't
-# XXX seem to set the #samples in the header correctly
-
def audiorecord(afile, aport, stop, done):
while not stop:
data = aport.readsamps(AQSIZE/2)
-## afile.writesampsraw(data)
- afile.writesamps(data)
+ afile.writesampsraw(data)
del data
- afile.destroy()
+ afile.close()
print 'Done writing audio'
done.release_lock()
diff --git a/Demo/sgi/video/Vrecb.py b/Demo/sgi/video/Vrecb.py
index f5687791b7..ca81753ae6 100755
--- a/Demo/sgi/video/Vrecb.py
+++ b/Demo/sgi/video/Vrecb.py
@@ -391,12 +391,12 @@ AQSIZE = 8*8000 # XXX should be a user option
def initaudio(filename, stop, start, done):
import thread, aifc
afile = aifc.open(filename, 'w')
- afile.nchannels = AL.MONO
- afile.sampwidth = AL.SAMPLE_8
+ afile.setnchannels(AL.MONO)
+ afile.setsampwidth(AL.SAMPLE_8)
params = [AL.INPUT_RATE, 0]
al.getparams(AL.DEFAULT_DEVICE, params)
print 'audio sampling rate =', params[1]
- afile.samprate = params[1]
+ afile.setframerate(params[1])
c = al.newconfig()
c.setchannels(AL.MONO)
c.setqueuesize(AQSIZE)
@@ -407,9 +407,6 @@ def initaudio(filename, stop, start, done):
# Thread to record audio samples
-# XXX should use writesampsraw for efficiency, but then destroy doesn't
-# XXX seem to set the #samples in the header correctly
-
def audiorecord(afile, aport, stop, start, done):
start.release_lock()
leeway = 4
@@ -417,10 +414,9 @@ def audiorecord(afile, aport, stop, start, done):
if stop:
leeway = leeway - 1
data = aport.readsamps(AQSIZE/8)
-## afile.writesampsraw(data)
- afile.writesamps(data)
+ afile.writesampsraw(data)
del data
- afile.destroy()
+ afile.close()
print 'Done writing audio'
done.release_lock()