Author Topic: Case Select sound issue  (Read 128 times)

kent79

  • Sr. Member
  • ****
  • Posts: 427
    • View Profile
Case Select sound issue
« on: September 25, 2017, 05:14:53 PM »
I would like to add select click sound while selected system, so added code as below. But sound can't run it properly. I suspect the sound is cutting when the theme was changed to game menu. We need to add "holding" control - the sound must play completed and then goto game theme. Anyone can know how to do it? Attachment is  sample code. Please try. Thanks.  :)

Ideal:
Select & click system -> play click sound fully -> goto game menu

Current:
Select & click system -> play click sound not completed -> goto game menu
 

Code: [Select]
case "select":
local bgMusic1 = fe.add_sound("start.mp3")
bgMusic1.playing=true
break;

keilmillerjr

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Re: Case Select sound issue
« Reply #1 on: September 25, 2017, 05:41:37 PM »
I’m exhausted, so only take a quick look at the menu. Keep in mind that I haven’t used menus. Y’all know I have my personal machine only running one system.

I am not sure how „goto game menu“ is selected as there is a break in your switch case, and maybe default holds that logic? Regardless, you need to add a tick to constantly check if sound has stopped playing, or a certain time (length of sound) has passed. Once this is true, then proceed to „goto game menu“.

Hopefully that is enough to get you started. If you still need help, walk me through and I can look at it tomorrow night.

jedione

  • Sr. Member
  • ****
  • Posts: 364
  • punktoe
    • View Profile
Re: Case Select sound issue
« Reply #2 on: September 25, 2017, 06:18:02 PM »
you could just put a starting sound that is unique upon entrance to each theme..

this is what i have used.

Code: [Select]
function start_theme( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition.StartLayout:
              local sound = fe.add_sound("intro.mp3");
      sound.playing=true;
  break;
  }
 return false;
}
fe.add_transition_callback( "start_theme" );


i know its not the answer you were looking for butt just another way of getting a similar effect.
help a friend....

jedione

  • Sr. Member
  • ****
  • Posts: 364
  • punktoe
    • View Profile
Re: Case Select sound issue
« Reply #3 on: September 25, 2017, 06:23:55 PM »
on that added note...a selection is technically the end of the system menu

so this should work    .EndLayout



function start_theme( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition..EndLayout:
              local sound = fe.add_sound("intro.mp3");
         sound.playing=true;
  break;
  }
 return false;
}
fe.add_transition_callback( "start_theme" );
help a friend....

kent79

  • Sr. Member
  • ****
  • Posts: 427
    • View Profile
Re: Case Select sound issue
« Reply #4 on: September 25, 2017, 06:33:26 PM »
on that added note...a selection is technically the end of the system menu

so this should work    .EndLayout



function start_theme( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition..EndLayout:
              local sound = fe.add_sound("intro.mp3");
         sound.playing=true;
  break;
  }
 return false;
}
fe.add_transition_callback( "start_theme" );

Try. But not working

keilmillerjr

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Re: Case Select sound issue
« Reply #5 on: September 26, 2017, 04:17:17 AM »
on that added note...a selection is technically the end of the system menu

so this should work    .EndLayout



function start_theme( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition..EndLayout:
              local sound = fe.add_sound("intro.mp3");
         sound.playing=true;
  break;
  }
 return false;
}
fe.add_transition_callback( "start_theme" );

Transition needs to return false, and return true if sound playing is complete.

jedione

  • Sr. Member
  • ****
  • Posts: 364
  • punktoe
    • View Profile
Re: Case Select sound issue
« Reply #6 on: October 07, 2017, 06:07:20 AM »
well as it apears it is built in to AM allready,
all you need to do is go in to your am.config and add
this one line.


sound
   sound_volume         40
   ambient_volume       20
   movie_volume         30
   select               intro.mp3
   displays_menu        01 - Hey You.mp3


ie: intro.mp3  =  your.mp3 in the layout

and it will play when you select your system or game.
help a friend....