mickelson / attract

A graphical front-end for command line emulators that hides the underlying operating system and is intended to be controlled with a joystick or gamepad.
http://attractmode.org
GNU General Public License v3.0
397 stars 115 forks source link

Memory access violation after playing a MP3 as background music #510

Open Mangaclub opened 5 years ago

Mangaclub commented 5 years ago

System: Raspberry Pi 3 OS- Retropie Attract mode 2.5.1 linux is up to date Theme used: AMGPS_Menu

After palying a music as background music in the titlescreen attract mode crashes with a acces violation error when the music finished playing.

It sure is Theme related but worth a look into

Mangaclub commented 5 years ago

edit: only happens when loops is activated

calle81 commented 5 years ago

OK, so this code used to work but now whenever a song ends and loop is true AM crashes. It's from the HyperPie2 theme:

////////////////
//Background Music
////////////
local bgMusic = fe.add_sound("")
if ( my_config["enable_backgroundmusic"] == "Per Title" ) {

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.StartLayout:
            bgMusic.playing=false
            bgMusic.file_name = "../../music/"+fe.game_info(Info.Title)+".mp3"
            bgMusic.playing=true
            bgMusic.loop=true
  break;
  }
 return false;
}
fe.add_transition_callback( "bgmusic_transitions" );
}
if ( my_config["enable_backgroundmusic"] == "Per Display" ) {
function bgmusic_transitions( ttype, var, ttime ) {
 switch ( ttype ) {

  case Transition.ToNewList:
            bgMusic.file_name = "../../music/"+fe.list.name+".mp3"
            bgMusic.playing=true
            bgMusic.loop=true
  break;
  }
 return false;
}
fe.add_transition_callback( "bgmusic_transitions" );
}
oomek commented 5 years ago

Please use a markdown for code snippets. https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code