Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
Aifc_read Class Reference

Public Member Functions

def initfp
 
def __init__
 
def getfp
 
def rewind
 
def close
 
def tell
 
def getnchannels
 
def getnframes
 
def getsampwidth
 
def getframerate
 
def getcomptype
 
def getcompname
 

Detailed Description

Definition at line 245 of file aifc.py.

Constructor & Destructor Documentation

def __init__ (   self,
  f 
)

Definition at line 336 of file aifc.py.

337  def __init__(self, f):
338  if type(f) == type(''):
339  f = __builtin__.open(f, 'rb')
340  # else, assume it is an open file object already
341  self.initfp(f)

Member Function Documentation

def close (   self)

Definition at line 352 of file aifc.py.

353  def close(self):
354  if self._decomp:
355  self._decomp.CloseDecompressor()
356  self._decomp = None
357  self._file = None
def getcompname (   self)

Definition at line 376 of file aifc.py.

377  def getcompname(self):
378  return self._compname
def getcomptype (   self)

Definition at line 373 of file aifc.py.

374  def getcomptype(self):
375  return self._comptype
def getfp (   self)

Definition at line 345 of file aifc.py.

346  def getfp(self):
347  return self._file
def getframerate (   self)

Definition at line 370 of file aifc.py.

371  def getframerate(self):
372  return self._framerate
def getnchannels (   self)

Definition at line 361 of file aifc.py.

362  def getnchannels(self):
363  return self._nchannels
def getnframes (   self)

Definition at line 364 of file aifc.py.

365  def getnframes(self):
366  return self._nframes
def getsampwidth (   self)

Definition at line 367 of file aifc.py.

368  def getsampwidth(self):
369  return self._sampwidth
def initfp (   self,
  file 
)

Definition at line 281 of file aifc.py.

282  def initfp(self, file):
283  self._version = 0
284  self._decomp = None
285  self._convert = None
286  self._markers = []
287  self._soundpos = 0
288  self._file = Chunk(file)
289  if self._file.getname() != 'FORM':
290  raise Error, 'file does not start with FORM id'
291  formdata = self._file.read(4)
292  if formdata == 'AIFF':
293  self._aifc = 0
294  elif formdata == 'AIFC':
295  self._aifc = 1
296  else:
297  raise Error, 'not an AIFF or AIFF-C file'
298  self._comm_chunk_read = 0
299  while 1:
300  self._ssnd_seek_needed = 1
301  try:
302  chunk = Chunk(self._file)
303  except EOFError:
304  break
305  chunkname = chunk.getname()
306  if chunkname == 'COMM':
307  self._read_comm_chunk(chunk)
308  self._comm_chunk_read = 1
309  elif chunkname == 'SSND':
310  self._ssnd_chunk = chunk
311  dummy = chunk.read(8)
312  self._ssnd_seek_needed = 0
313  elif chunkname == 'FVER':
314  self._version = _read_long(chunk)
315  elif chunkname == 'MARK':
316  self._readmark(chunk)
317  elif chunkname in _skiplist:
318  pass
319  else:
320  raise Error, 'unrecognized chunk type '+chunk.chunkname
321  chunk.skip()
322  if not self._comm_chunk_read or not self._ssnd_chunk:
323  raise Error, 'COMM chunk and/or SSND chunk missing'
324  if self._aifc and self._decomp:
325  import cl
326  params = [cl.ORIGINAL_FORMAT, 0,
327  cl.BITS_PER_COMPONENT, self._sampwidth * 8,
328  cl.FRAME_RATE, self._framerate]
329  if self._nchannels == 1:
330  params[1] = cl.MONO
331  elif self._nchannels == 2:
332  params[1] = cl.STEREO_INTERLEAVED
333  else:
334  raise Error, 'cannot compress more than 2 channels'
335  self._decomp.SetParams(params)
def rewind (   self)

Definition at line 348 of file aifc.py.

349  def rewind(self):
350  self._ssnd_seek_needed = 1
351  self._soundpos = 0
def tell (   self)

Definition at line 358 of file aifc.py.

359  def tell(self):
360  return self._soundpos

The documentation for this class was generated from the following file: