+ def is_playing(self):
+ return self.channel().get_busy()
+
+ def is_paused(self):
+ return self.flag_paused
+
+ def play(self, fade_in = 0, volume = 100, start_at = 0):
+ self.channel().set_endevent()
+ self.channel().set_endevent(pygame.USEREVENT)
+ self.set_volume(volume)
+
+ if start_at > 0:
+ raw_data_length = len(self.raw_data)
+ start_offset = int((raw_data_length / self.sound_duration) * start_at)
+ start_offset = start_offset - (start_offset % 2)
+ sound = pygame.mixer.Sound(self.raw_data[start_offset:])
+ else:
+ sound = pygame.mixer.Sound(self.raw_data)
+
+ self.channel().play(sound, fade_ms = int(fade_in * 1000))
+ self.flag_paused = False