当前位置: 首页>>代码示例>>Python>>正文


Python Song类代码示例

本文整理汇总了Python中Song的典型用法代码示例。如果您正苦于以下问题:Python Song类的具体用法?Python Song怎么用?Python Song使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Song类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

  def run(self, ticks):
    SceneClient.run(self, ticks)

    if not self.wizardStarted:
      self.wizardStarted = True

      if not self.songName:
        while True:
          self.libraryName, self.songName = \
            Dialogs.chooseSong(self.engine, \
                               selectedLibrary = Config.get("game", "selected_library"),
                               selectedSong    = Config.get("game", "selected_song"))
        
          if not self.songName:
            self.session.world.finishGame()
            return

          Config.set("game", "selected_library", self.libraryName)
          Config.set("game", "selected_song",    self.songName)
          
          info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
          d = Dialogs.chooseItem(self.engine, info.difficulties,
                                 _("Choose a difficulty:"), selected = self.player.difficulty)
          if d:
            self.player.difficulty = d
            break
      else:
        info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)

      # Make sure the difficulty we chose is available
      if not self.player.difficulty in info.difficulties:
        self.player.difficulty = info.difficulties[0]
        
      self.session.world.deleteScene(self)
      self.session.world.createScene("GuitarScene", libraryName = self.libraryName, songName = self.songName)
开发者ID:fretsonfire,项目名称:fof-python,代码行数:35,代码来源:SongChoosingScene.py

示例2: checkParts

 def checkParts(self):
     info = Song.loadSongInfo(self.engine, self.songName, library=self.libraryName)
     guitars = []
     drums = []
     vocals = []
     for part in info.parts:
         if part.id == 4 or part.id == 7:
             drums.append(part)
         elif part.id == 5:
             vocals.append(part)
         else:
             guitars.append(part)
     if len(drums) == 0 and self.engine.input.gameDrums > 0:
         Dialogs.showMessage(
             self.engine, _("There are no drum parts in this song. Change your controllers to play.")
         )
         return False
     if len(guitars) == 0 and self.engine.input.gameGuitars > 0:
         Dialogs.showMessage(
             self.engine, _("There are no guitar parts in this song. Change your controllers to play.")
         )
         return False
     if len(vocals) == 0 and self.engine.input.gameMics > 0:
         Dialogs.showMessage(
             self.engine, _("There are no vocal parts in this song. Change your controllers to play.")
         )
         return False
     return True
开发者ID:paulhayes,项目名称:fofix,代码行数:28,代码来源:SongChoosingScene.py

示例3: previewSong

    def previewSong(self):
        self.previewLoaded = True
        if isinstance(self.selectedItem, Song.SongInfo):
            song = self.selectedItem.songName  # TODO: SongDB
        else:
            return

        if self.careerMode and self.selectedItem.getLocked():  # TODO: SongDB
            if self.song:
                self.song.fadeout(1000)
            return
        if self.songLoader:
            try:
                self.songLoader.stop()
            except:
                self.songLoader = None

        self.songLoader = self.engine.resource.load(
            self,
            None,
            lambda: Song.loadSong(self.engine, song, playbackOnly=True, library=self.library),
            synch=True,
            onLoad=self.songLoaded,
            onCancel=self.songCanceled,
        )
开发者ID:paulhayes,项目名称:fofix,代码行数:25,代码来源:SongChoosingScene.py

示例4: createClient

  def createClient(self, libraryName, songName, players = None):
    self.libraryName     = libraryName
    self.songName        = songName
    self.stars           = [0 for i in players]
    self.accuracy        = [0 for i in players]
    self.counter         = 0
    self.showHighscores  = False
    self.highscoreIndex  = [None for i in players]
    self.taunt           = None
    self.uploadingScores = False
    self.nextScene       = None
    self.offset          = None
    self.pauseScroll     = None
    self.scorePart       = None
    self.scoreDifficulty = None
    self.playerList      = players

    self.spinnyDisabled   = self.engine.config.get("game", "disable_spinny")    

    items = [
      (_("Replay"),            self.replay),
      (_("Change Song"),       self.changeSong),
      (_("Quit to Main Menu"), self.quit),
    ]
    self.menu = Menu(self.engine, items, onCancel = self.quit, pos = (.2, .5))
      
    self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True, part = [player.part for player in self.playerList]), onLoad = self.songLoaded)
    self.engine.loadSvgDrawing(self, "background", "gameresults.svg")

    phrase = random.choice(Theme.resultsPhrase.split(","))
    if phrase == "None":
      phrase = _("Chilling...")
    Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = phrase)
开发者ID:broccoliftw,项目名称:workingfofwindows8,代码行数:33,代码来源:GameResultsScene.py

示例5: createClient

  def createClient(self, libraryName, songName, players = 1): #players = None
    Log.debug("GameResultsSceneClient class init...")
    self.libraryName     = libraryName
    self.songName        = songName
    self.stars           = [0 for i in players]
    self.accuracy        = [0 for i in players]
    self.counter         = 0
    self.showHighscores  = False
    self.highscoreIndex  = [-1 for i in players]
    self.taunt           = None
    self.uploadingScores = False
    self.uploadResult    = None
    self.nextScene       = None
    self.offset          = None
    self.pauseScroll     = None
    self.scorePart       = None
    self.scoreDifficulty = None
    self.playerList      = players
    self.spinnyDisabled   = True#NO SPINNY!!!    

    #myfingershurt: reordering so default is Change Song.
    items = [
      (_("Continue"),       self.changeSong),
      (_("Replay"),            self.replay),
      (_("Quit"), self.quit),
    ]
    self.menu = Menu(self.engine, items, onCancel = self.quit, pos = (.2, .5))
      
    self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True, part = [player.part for player in self.playerList]), onLoad = self.songLoaded)

    #Get theme
    themename = self.engine.data.themeLabel
    #now theme determination logic is only in data.py:
    self.theme = self.engine.data.theme
      
    self.starScoring = self.engine.config.get("game", "star_scoring")#MFH
    self.Congratphrase = self.engine.config.get("game", "congrats")#blazingamer

    self.resultCheerLoop = self.engine.config.get("game", "result_cheer_loop")#MFH
    self.cheerLoopDelay = self.engine.config.get("game", "cheer_loop_delay")#MFH
    self.cheerLoopCounter = self.cheerLoopDelay   #MFH - starts out ready to cheer
      
    self.engine.loadImgDrawing(self, "background", os.path.join("themes",themename,"gameresults.png"))

    phrase = random.choice(Theme.resultsPhrase.split("_"))
    if phrase == "None":
      i = random.randint(0,5)
      if i == 0:
        phrase = _("Relax, it was an excellent show.")
      elif i == 1:
        phrase = _("Truly Amazing!")
      elif i == 2:
        phrase = _("Thanks for playing!")
      elif i == 3:
        phrase = _("One more song can't hurt, can it?")
      elif i == 4:
        phrase = _("What an amazing performance!")
      else:
        phrase = _("That's how it's done!")
    Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = phrase)
开发者ID:Gamer125,项目名称:fofix,代码行数:60,代码来源:GameResultsScene.py

示例6: loadSongs

 def loadSongs(self, libraries):
     Log.debug("Loading songs in %s" % self.library)
     self.engine.resource.load(
         self,
         "songs",
         lambda: Song.getAvailableSongsAndTitles(self.engine, self.library, progressCallback=self.progressCallback),
         onLoad=self.prepareSetlist,
         synch=True,
     )
开发者ID:paulhayes,项目名称:fofix,代码行数:9,代码来源:SongChoosingScene.py

示例7: loadLibrary

 def loadLibrary(self):
   Log.debug("Loading libraries in %s" % self.library)
   self.loaded = False
   self.tiersPresent = False
   if self.splash:
     Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Browsing Collection..."))
   else:
     self.splash = Dialogs.showLoadingSplashScreen(self.engine, _("Browsing Collection..."))
     self.loadStartTime = time.time()
   self.engine.resource.load(self, "libraries", lambda: Song.getAvailableLibraries(self.engine, self.library), onLoad = self.loadSongs, synch = True)
开发者ID:cherbib,项目名称:fofix,代码行数:10,代码来源:SongChoosingScene.py

示例8: startQueue

 def startQueue(self):
    firstSong = self.songQueue.nextSong(0)
    Config.set("game", "selected_song", firstSong[0])
    Config.set("game", "selected_library", firstSong[1])
    Config.set("game", "selected_players", firstSong[2])
    self.player.difficulty = firstSong[3]
    self.player2.difficulty =  firstSong[4]
    self.player.part = firstSong[5]
    self.player2.part = firstSong[6]
    self.info = Song.loadSongInfo(self.engine, firstSong[0])
    self.songName = firstSong[0]
    self.startGame(queueCounter =  1)
开发者ID:Gamer125,项目名称:fofix,代码行数:12,代码来源:SongChoosingScene.py

示例9: startQueue

 def startQueue(self):
   #obviously a fair amount of work to be done on this anyway... But note that startGame will not work.
   firstSong = self.songQueue.nextSong(0)
   Config.set("game", "selected_song", firstSong[0])
   Config.set("game", "selected_library", firstSong[1])
   Config.set("game", "selected_players", firstSong[2])
   self.player.difficulty = firstSong[3]
   self.player2.difficulty =  firstSong[4]
   self.player.part = firstSong[5]
   self.player2.part = firstSong[6]
   self.info = Song.loadSongInfo(self.engine, firstSong[0])
   self.songName = firstSong[0]
   self.startGame(queueCounter =  1)
开发者ID:zelurker,项目名称:fofix,代码行数:13,代码来源:SongChoosingScene.py

示例10: AutoMusic

    def AutoMusic(self, parent, page_type, loadpic, waitpic,
                  incontainer, outcontainer, records, music):
        """
            This is a callback function for 'Generate' button.
            It takes the selected inputs from the listbox,
            make an AutoComposeSong object, and execute its functions
            to output a MIDI file.
            
            * See 'AutoComposeSong.py' for the detailed explanation
            on how these methods work.            
        """

        genre = self.genreList[int(self.gr_listbox.curselection()[0])]
        key = eval(self.keyList[int(self.key_listbox.curselection()[0])])
        cp = self.cpList[int(self.cp_listbox.curselection()[0])]
        title = self.title.get()
        
        mode = Tonics
        numPhrase = 4
        beat = 72

        if self.entry_field.get() == '':
            userInput = []
        else:
            userInput = Song()
            userInput.reset()
            userInputMelody = wrapNote(self.entry_field.get().split('-'))
            userInputTimes = constant_times(userInputMelody, 2, beat)
            userInput.wrapNotesAndTimes(userInputMelody, userInputTimes)
        
        autoSong = AutoComposeSong()
        autoSong.reset()
        autoSong.setTitle(title)
        autoSong.setup(genre, key, mode, cp, numPhrase, beat, userInput)
        autoSong.exportMidi(1, 'Output MIDIs/' + title + '.mid')

        self.page_factory(parent, page_type, loadpic, waitpic,
                          incontainer, outcontainer, records, autoSong)
开发者ID:shanemoon,项目名称:AutoMusic,代码行数:38,代码来源:Main.py

示例11: playSelectedSong

  def playSelectedSong(self):
    song = self.getSelectedSong()
    if not song:
      return
    
    if self.songLoader:
      self.songLoader.cancel()
      # Don't start a new song loader until the previous one is finished
      if self.songLoader.isAlive():
        self.songCountdown = 256
        return

    if self.song:
      self.song.fadeout(1000)

    self.songLoader = self.engine.resource.load(self, None, lambda: Song.loadSong(self.engine, song, playbackOnly = True, library = self.library),
                                                onLoad = self.songLoaded)
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:17,代码来源:Dialogs.py

示例12: createClient

 def createClient(self, libraryName, songName):
   self.libraryName     = libraryName
   self.songName        = songName
   self.stars           = 0
   self.accuracy        = 0
   self.counter         = 0
   self.showHighscores  = False
   self.highscoreIndex  = None
   self.taunt           = None
   self.uploadingScores = False
   self.nextScene       = None
   
   items = [
     (_("Replay"),            self.replay),
     (_("Change Song"),       self.changeSong),
     (_("Quit to Main Menu"), self.quit),
   ]
   self.menu = Menu(self.engine, items, onCancel = self.quit, pos = (.2, .5))
     
   self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True), onLoad = self.songLoaded)
   self.engine.loadSvgDrawing(self, "background", "keyboard.svg")
   Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = _("Chilling..."))
开发者ID:fretsonfire,项目名称:fof-python,代码行数:22,代码来源:GameResultsScene.py

示例13: libraryListLoaded

 def libraryListLoaded(self, libraries):
   self.engine.resource.load(self, "songs",     lambda: Song.getAvailableSongs(self.engine, self.library), onLoad = self.songListLoaded)
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:2,代码来源:Dialogs.py

示例14: initialSongUI

from NoteSequence import *
from MidiNote import *

def initialSongUI():
    trackCount = raw_input('Enter track count: ')
    tempo = raw_input('Enter a tempo: ')
    key = raw_input('Enter a key: ')
    length = raw_input('Enter a song length: ')
    return (int(trackCount), int(tempo), str(key), str(length))

#Supports up to four tracks
#TODO: Make this a little more elegant
def determineVoice(currentTrackCount):
    if currentTrackCount == 0: return ALTO
    if currentTrackCount == 1: return BASS
    if currentTrackCount == 2: return SOPRANO
    if currentTrackCount == 3: return TENOR

if __name__ == '__main__':
    choices = initialSongUI()
    song = Song(choices[0],         #Track Count
                choices[1])         #Tempo
    key = choices[2]                #Key
    length = int(choices[3])        #Length
    for i in range(song.trackCount):
        seq = NoteSequence(key, determineVoice(i), length)
        seq.writeSequenceToTrack(song, i)

    song.markSongEnd()
    midi.write_midifile("example.mid", song.pattern)
开发者ID:nfadili,项目名称:ProceduralMusicProject,代码行数:30,代码来源:main.py

示例15: loadCollection

 def loadCollection(self):
   self.loaded = False
   self.engine.resource.load(self, "libraries", lambda: Song.getAvailableLibraries(self.engine, self.library), onLoad = self.libraryListLoaded)
   showLoadingScreen(self.engine, lambda: self.loaded, text = _("Browsing Collection..."))
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:4,代码来源:Dialogs.py


注:本文中的Song类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。