def loadAcceptSounds(self): if self.fileExists( os.path.join("themes", self.themeLabel, "sounds", "accept1.ogg")): return [ Sound( self.resource.fileName( os.path.join("themes", self.themeLabel, "sounds", "accept%d.ogg") % i)) for i in range(1, 11) ] else: if self.theme == 0 or self.theme == 1: #GH2 or GH3 return [ Sound( self.resource.fileName( os.path.join("themes", self.themeLabel, "sounds", "in.ogg"))) ] elif self.theme == 2: return [ Sound( self.resource.fileName( os.path.join("themes", self.themeLabel, "sounds", "action.ogg"))) ]
def loadAcceptSounds(self): soundPathTheme = os.path.join("themes",self.themeLabel,"sounds") soundPathData = "sounds" soundPath = soundPathTheme soundPrefix = "accept" numSounds = self.determineNumSounds(soundPath, soundPrefix) if numSounds > 0: return self.getSoundObjectList(soundPath, soundPrefix, numSounds) else: if self.theme == 0 or self.theme == 1:#GH2 or GH3 return [Sound(self.resource.fileName(os.path.join("themes",self.themeLabel,"sounds","in.ogg")))] elif self.theme == 2: return [Sound(self.resource.fileName(os.path.join("themes",self.themeLabel,"sounds","action.ogg")))]
def loadSoundEffect(self, target, name, fileName): volume = Config.get("audio", "guitarvol") fileName = self.resource.fileName(fileName) self.resource.load(target, name, lambda: Sound(fileName), onLoad=lambda s: s.setVolume(volume))
def loadSoundEffect(self, target, name, fileName): volume = self.sfxVolume fileName = self.resource.fileName(fileName) self.resource.load(target, name, lambda: Sound(fileName), onLoad=lambda s: s.setVolume(volume))
def songLoaded(self, song): song.difficulty = self.player.difficulty notes = len([ 1 for time, event in song.track.getAllEvents() if isinstance(event, Song.Note) ]) if notes: # 5 stars at 95%, 4 stars at 75% f = float(self.player.notesHit) / notes self.stars = int(5.0 * (f + .05)) self.accuracy = int(100.0 * f) taunt = None if self.player.score == 0: taunt = "jurgen1.ogg" elif self.accuracy >= 99.0: taunt = "myhero.ogg" elif self.stars in [0, 1]: taunt = random.choice([ "jurgen2.ogg", "jurgen3.ogg", "jurgen4.ogg", "jurgen5.ogg" ]) elif self.stars == 5: taunt = random.choice( ["perfect1.ogg", "perfect2.ogg", "perfect3.ogg"]) if taunt: self.engine.resource.load( self, "taunt", lambda: Sound(self.engine.resource.fileName(taunt)))
def loadBackSounds(self): #MFH - adding optional support for random choice between two back sounds soundPathTheme = os.path.join("themes",self.themeLabel,"sounds") soundPathData = "sounds" soundPath = soundPathTheme soundPrefix = "back" numSounds = self.determineNumSounds(soundPath, soundPrefix) if numSounds > 0: return self.getSoundObjectList(soundPath, soundPrefix, numSounds) else: return [Sound(self.resource.fileName(os.path.join("themes",self.themeLabel,"sounds","out.ogg")))]
def loadScrewUpsoundsDrums(self): #MFH - adding support for optional theme-specific screwup sounds: if self.fileExists( os.path.join("themes", self.themeLabel, "sounds", "drumscw1.ogg")): return [ Sound( self.resource.fileName( os.path.join("themes", self.themeLabel, "sounds", "drumscw%d.ogg") % i)) for i in range(1, 8) ] else: return [ Sound( self.resource.fileName( os.path.join("sounds", "drumscw%d.ogg") % i)) for i in range(1, 8) ]
def songLoaded(self, song): for i, player in enumerate(self.playerList): song.difficulty[i] = player.difficulty notes = player.totalStreakNotes if notes: # ShiekOdaSandz: Determines the number of stars received at the end of the song; I modified Coffee's settings f = float(player.notesHit) / notes #self.stars[i] = int(5.0 * (f + .05)) self.stars[i] = player.stars self.accuracy[i] = 100.0 * f self.hits = player.notesHit self.totalnotes = notes taunt = None #MFH TODO - utilize new functions in self.engine.data to automatically enumerate any number of the following soundfiles automatically, for issue 73 if self.Congratphrase: if player.score == 0 or player.cheating == True: taunt = os.path.join("sounds", "jurgen1.ogg") elif self.accuracy[ i] == 100.0: #MFH - this will only play when you 100% a song taunt = random.choice([ os.path.join("sounds", "100pct1.ogg"), os.path.join("sounds", "100pct2.ogg"), os.path.join("sounds", "100pct3.ogg") ]) elif self.accuracy[ i] >= 99.0: #MFH - these 3 sounds will only play when you get > 99.0% taunt = random.choice([ os.path.join("sounds", "99pct1.ogg"), os.path.join("sounds", "99pct2.ogg"), os.path.join("sounds", "99pct3.ogg") ]) elif self.stars[i] in [0, 1]: taunt = random.choice([ os.path.join("sounds", "jurgen2.ogg"), os.path.join("sounds", "jurgen3.ogg"), os.path.join("sounds", "jurgen4.ogg"), os.path.join("sounds", "jurgen5.ogg") ]) elif self.stars[i] == 5: taunt = random.choice([ os.path.join("sounds", "perfect1.ogg"), os.path.join("sounds", "perfect2.ogg"), os.path.join("sounds", "perfect3.ogg") ]) if taunt: try: self.engine.resource.load( self, "taunt", lambda: Sound(self.engine.resource.fileName(taunt))) except IOError: taunt = None
def getSoundObjectList(self, soundPath, soundPrefix, numSounds, soundExtension=".ogg"): #MFH Log.debug( str(numSounds) + " " + soundPrefix + " sounds found in " + soundPath + ": " + soundPrefix + "1" + soundExtension + " - " + soundPrefix + str(numSounds) + soundExtension) return [ Sound( self.resource.fileName( os.path.join(soundPath, "%s%d%s" % (soundPrefix, i, soundExtension)))) for i in range(1, numSounds + 1) ]
def songLoaded(self, song): for i,player in enumerate(self.playerList): song.difficulty[i] = player.difficulty ##myfingershurt: drum notes need to be counted individually! #if player.part.text == "Drums": # notes = len([1 for time, event in song.track[i].getAllEvents() if isinstance(event, Song.Note)]) #else: # # glorandwarf: changed to count chords as one note (should match streak) # notes = len(set(time for time, event in song.track[i].getAllEvents() if isinstance(event, Song.Note))) ##MFH - so chords aren't counted as single notes when average multiplier / score is concerned: #singleNotes = len([1 for time, event in song.track[i].getAllEvents() if isinstance(event, Song.Note)]) notes = player.totalStreakNotes #singleNotes = player.totalNotes if notes:# ShiekOdaSandz: Determines the number of stars received at the end of the song; I modified Coffee's settings f = float(player.notesHit) / notes #self.stars[i] = int(5.0 * (f + .05)) self.stars[i] = player.stars self.accuracy[i] = 100.0 * f self.hits=player.notesHit self.totalnotes=notes taunt = None if self.Congratphrase: if player.score == 0 or player.cheating == True: taunt = os.path.join("sounds","jurgen1.ogg") elif self.accuracy[i] == 100.0: #MFH - this will only play when you 100% a song taunt = random.choice([os.path.join("sounds","100pct1.ogg"), os.path.join("sounds","100pct2.ogg"), os.path.join("sounds","100pct3.ogg")]) elif self.accuracy[i] >= 99.0: #MFH - these 3 sounds will only play when you get > 99.0% taunt = random.choice([os.path.join("sounds","99pct1.ogg"), os.path.join("sounds","99pct2.ogg"), os.path.join("sounds","99pct3.ogg")]) elif self.stars[i] in [0, 1]: taunt = random.choice([os.path.join("sounds","jurgen2.ogg"), os.path.join("sounds","jurgen3.ogg"), os.path.join("sounds","jurgen4.ogg"), os.path.join("sounds","jurgen5.ogg")]) elif self.stars[i] == 5: taunt = random.choice([os.path.join("sounds","perfect1.ogg"), os.path.join("sounds","perfect2.ogg"), os.path.join("sounds","perfect3.ogg")]) if taunt: try: self.engine.resource.load(self, "taunt", lambda: Sound(self.engine.resource.fileName(taunt))) except IOError: taunt = None
def loadScrewUpSounds(self): return [ Sound(self.resource.fileName("fiba%d.ogg" % i)) for i in range(1, 7) ]
def loadSyncsounds(self): return [Sound(self.resource.fileName("sync%d.ogg" % i)) for i in range(1, 2)]
def loadBackSounds(self): #MFH - adding optional support for random choice between two back sounds if self.fileExists(os.path.join("themes",self.themeLabel,"sounds","back1.ogg")): return [Sound(self.resource.fileName(os.path.join("themes",self.themeLabel,"sounds","back%d.ogg") % i)) for i in range(1, 3)] else: return [Sound(self.resource.fileName(os.path.join("themes",self.themeLabel,"sounds","out.ogg")))]