Author Topic: Display-Specific Music?  (Read 3045 times)

calle81

  • Sr. Member
  • ****
  • Posts: 153
    • View Profile
Re: Display-Specific Music?
« Reply #15 on: March 17, 2018, 12:51:26 PM »
Second, let me understand what you are asking... you want unique music on a per-title basis? So like Galaga has it's own song, and Ms. Pacman has another song?

I will only use it for the displays menu. So Nes, snes etc can have music that overrides the video snaps music. I found a simple workaround:

////////////////
//Background Music
////////////
local bgMusic = fe.add_sound("")
function bgmusic_transitions( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition.FromOldSelection:
           bgMusic.playing=false
         bgMusic.file_name = "../../music/"+fe.game_info(Info.Title)+".mp3"
            bgMusic.playing=true
            bgMusic.loop=true
  break;
  case Transition.ToGame:
  case Transition.ToNewList:
         bgMusic.playing=false
         bgMusic.file_name = "../../music/"+fe.game_info(Info.Title)+".mp3"
            bgMusic.playing=true
            bgMusic.loop=true
  break;
  }
 return false;
}

iOtero

  • Sr. Member
  • ****
  • Posts: 235
    • View Profile
Re: Display-Specific Music?
« Reply #16 on: November 26, 2018, 05:44:09 AM »
I will only use it for the displays menu. So Nes, snes etc can have music that overrides the video snaps music. I found a simple workaround:

////////////////
//Background Music
////////////
local bgMusic = fe.add_sound("")
function bgmusic_transitions( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition.FromOldSelection:
           bgMusic.playing=false
         bgMusic.file_name = "../../music/"+fe.game_info(Info.Title)+".mp3"
            bgMusic.playing=true
            bgMusic.loop=true
  break;
  case Transition.ToGame:
  case Transition.ToNewList:
         bgMusic.playing=false
         bgMusic.file_name = "../../music/"+fe.game_info(Info.Title)+".mp3"
            bgMusic.playing=true
            bgMusic.loop=true
  break;
  }
 return false;
}

Nice code, i'll take it... Thanks  8)
I love that on my laptop the eyes shine to the Alien every time i access the ssd... :D

calle81

  • Sr. Member
  • ****
  • Posts: 153
    • View Profile
Re: Display-Specific Music?
« Reply #17 on: November 26, 2018, 11:13:29 PM »
Quote
Nice code, i'll take it... Thanks  8)

Cool! Oomek helped me get this right :) Be aware that there is currently a bug that makes AM crash when a song ends and loop is set to true:

https://github.com/mickelson/attract/issues/510

iOtero

  • Sr. Member
  • ****
  • Posts: 235
    • View Profile
Re: Display-Specific Music?
« Reply #18 on: November 27, 2018, 03:40:25 AM »
Quote
Nice code, i'll take it... Thanks  8)

Cool! Oomek helped me get this right :) Be aware that there is currently a bug that makes AM crash when a song ends and loop is set to true:

https://github.com/mickelson/attract/issues/510

Ok. Thanks.  ;D
I love that on my laptop the eyes shine to the Alien every time i access the ssd... :D