Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4ab6ff8

Browse files
AWARE.py: New file with definitions for Aware Inc.'s compression
algorithms in cl module. aifc.py: fixed a small bug.
1 parent 6f5afc9 commit 4ab6ff8

3 files changed

Lines changed: 114 additions & 4 deletions

File tree

Lib/aifc.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,8 @@ def readframes(self, nframes):
506506
return ''
507507
data = self._ssnd_chunk.read(nframes * self._framesize)
508508
if self._decomp and data:
509-
self._decomp.SetParam(CL.FRAME_BUFFER_SIZE, len(data) * 2)
509+
dummy = self._decomp.SetParam(CL.FRAME_BUFFER_SIZE, \
510+
len(data) * 2)
510511
data = self._decomp.Decompress(len(data) / self._nchannels, data)
511512
self._soundpos = self._soundpos + len(data) / (self._nchannels * self._sampwidth)
512513
return data
@@ -638,7 +639,7 @@ def aifc(self):
638639
def setnchannels(self, nchannels):
639640
if self._nframeswritten:
640641
raise Error, 'cannot change parameters after starting to write'
641-
dummy = _convert(nchannels, _nchannelslist)
642+
dummy = _convert2(nchannels, _nchannelslist)
642643
self._nchannels = nchannels
643644

644645
def getnchannels(self):
@@ -756,8 +757,9 @@ def writeframesraw(self, data):
756757
self._write_header(len(data))
757758
nframes = len(data) / (self._sampwidth * self._nchannels)
758759
if self._comp:
759-
self._comp.SetParam(CL.FRAME_BUFFER_SIZE, len(data))
760-
self._comp.SetParam(CL.COMPRESSED_BUFFER_SIZE, \
760+
dummy = self._comp.SetParam(CL.FRAME_BUFFER_SIZE, \
761+
len(data))
762+
dummy = self._comp.SetParam(CL.COMPRESSED_BUFFER_SIZE,\
761763
len(data))
762764
data = self._comp.Compress(nframes, data)
763765
self._file.write(data)

Lib/irix5/AWARE.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#
2+
# Copyright (c) 1992 Aware, Inc. All rights reserved.
3+
#
4+
# Copyright Unpublished, Aware Inc. All Rights Reserved.
5+
# This software contains proprietary and confidential
6+
# information of Aware, Inc. Use, disclosure or
7+
# reproduction is prohibited without the prior express
8+
# written consent of Aware, Inc.
9+
#
10+
#
11+
12+
#
13+
# awareAudio.h - Aware Compression Library Parameter Header
14+
#
15+
# 01/21/92 Original Version by Brian Knittel and Jonathon Devine
16+
#
17+
18+
import CL
19+
20+
# Aware Audio Specific Parameters - For both MPEG Audio and Multirate
21+
CL.CHANNEL_POLICY = CL.NUMBER_OF_PARAMS + 0
22+
CL.NOISE_MARGIN = CL.NUMBER_OF_PARAMS + 1
23+
CL.BITRATE_POLICY = CL.NUMBER_OF_PARAMS + 2
24+
25+
# Additional parameters for MPEG Audio
26+
CL.BITRATE_TARGET = CL.NUMBER_OF_PARAMS + 3
27+
CL.LAYER = CL.NUMBER_OF_PARAMS + 4
28+
29+
# read/write for compression configuration
30+
# read for state during compression/decompression
31+
32+
#
33+
# Channel Policy
34+
#
35+
AWCMP_STEREO = 1
36+
AWCMP_JOINT_STEREO = 2
37+
AWCMP_INDEPENDENT = 3
38+
39+
#
40+
# read/write for compression configuration,
41+
# read for state during compression
42+
#
43+
#
44+
# Bit-rate Policy
45+
#
46+
AWCMP_FIXED_RATE = 1
47+
AWCMP_CONST_QUAL = 2
48+
AWCMP_LOSSLESS = 4
49+
50+
#
51+
# Layer values
52+
#
53+
AWCMP_MPEG_LAYER_I = 1
54+
AWCMP_MPEG_LAYER_II = 2

Lib/plat-irix5/AWARE.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#
2+
# Copyright (c) 1992 Aware, Inc. All rights reserved.
3+
#
4+
# Copyright Unpublished, Aware Inc. All Rights Reserved.
5+
# This software contains proprietary and confidential
6+
# information of Aware, Inc. Use, disclosure or
7+
# reproduction is prohibited without the prior express
8+
# written consent of Aware, Inc.
9+
#
10+
#
11+
12+
#
13+
# awareAudio.h - Aware Compression Library Parameter Header
14+
#
15+
# 01/21/92 Original Version by Brian Knittel and Jonathon Devine
16+
#
17+
18+
import CL
19+
20+
# Aware Audio Specific Parameters - For both MPEG Audio and Multirate
21+
CL.CHANNEL_POLICY = CL.NUMBER_OF_PARAMS + 0
22+
CL.NOISE_MARGIN = CL.NUMBER_OF_PARAMS + 1
23+
CL.BITRATE_POLICY = CL.NUMBER_OF_PARAMS + 2
24+
25+
# Additional parameters for MPEG Audio
26+
CL.BITRATE_TARGET = CL.NUMBER_OF_PARAMS + 3
27+
CL.LAYER = CL.NUMBER_OF_PARAMS + 4
28+
29+
# read/write for compression configuration
30+
# read for state during compression/decompression
31+
32+
#
33+
# Channel Policy
34+
#
35+
AWCMP_STEREO = 1
36+
AWCMP_JOINT_STEREO = 2
37+
AWCMP_INDEPENDENT = 3
38+
39+
#
40+
# read/write for compression configuration,
41+
# read for state during compression
42+
#
43+
#
44+
# Bit-rate Policy
45+
#
46+
AWCMP_FIXED_RATE = 1
47+
AWCMP_CONST_QUAL = 2
48+
AWCMP_LOSSLESS = 4
49+
50+
#
51+
# Layer values
52+
#
53+
AWCMP_MPEG_LAYER_I = 1
54+
AWCMP_MPEG_LAYER_II = 2

0 commit comments

Comments
 (0)