Exemplo n.º 1
0
    def preload(self):
        """Preload stimulus to memory."""

        if not self._is_preloaded:
        # Due to a bug in handling file names in PyGame 1.9.2, we pass a file
        # handle to PyGame. See also:
        # https://github.com/expyriment/expyriment/issues/81
            with open(self._filename, 'rb') as f:
                self._file = mixer.Sound(f)
            self._is_preloaded = True
Exemplo n.º 2
0
 def load(self):
     self.unload()
     if self.source is None:
         return
     self._data = mixer.Sound(self.source)
Exemplo n.º 3
0
 def load(self):
     self.unload()
     if self.filename is None:
         return
     self._data = mixer.Sound(self.filename)
Exemplo n.º 4
0
    def preload(self):
        """Preload stimulus to memory."""

        if not self._is_preloaded:
            self._file = mixer.Sound(unicode2str(self._filename, fse=True))
            self._is_preloaded = True