Commits

illume committed 074f57d

Updated comments for def sound_from_pos(...)

  • Participants
  • Parent commits 496dfe9

Comments (0)

Files changed (1)

File examples/sound_array_demos.py

          start_pos - in seconds from the begining.
          samples_per_second - 
     """
+
+    # see if we want to reuse the sound data or not.
     if inplace:
         a1 = pygame.sndarray.samples(sound)
     else:
         a1 = pygame.sndarray.array(sound)
 
+    # see if samples per second has been given.  If not, query the mixer.
+    #   eg. it might be set to 22050
     if samples_per_second is None:
         samples_per_second = pygame.mixer.get_init()[0]
 
+    # figure out the start position in terms of samples.
     start_pos_in_samples = int(start_pos * samples_per_second)
+
+    # cut the begining off the sound at the start position.
     a2 = a1[start_pos_in_samples:]
+
+    # make the Sound instance from the array.
     sound2 = pygame.sndarray.make_sound(a2)
 
     return sound2