def __setattr__(self, name, value) : if name not in self.strings : return object.__setattr__(self, name, value) stringid = self.strings.index(name) error = _lib.sf_set_string(self._sndfile, stringid, value) if error : print ValueError( self.strings[stringid], error, _lib.sf_error_number(error))
def __setattr__(self, name, value): if name not in self.strings: return object.__setattr__(self, name, value) stringid = self.strings.index(name) error = _lib.sf_set_string(self._sndfile, stringid, value) if error: print ValueError(self.strings[stringid], error, _lib.sf_error_number(error))
def __init__(self, filename, samplerate = 0, channels = 0, format = 0, ) : self._info = SF_INFO( samplerate = samplerate, channels = channels, format = format ) self._sndfile = _lib.sf_open(filename, OPEN_MODES.SFM_READ, self._info) if _lib.sf_error(self._sndfile) : raise IOError("Error opening '%s': %s"%( filename, _lib.sf_error_number(_lib.sf_error(self._sndfile)))) assert self._sndfile, "Null sndfile handle but no error status" self._metadata = WaveMetadata(self._sndfile)