Pause music whilst talking to NPC then continue

Started by Slasher, Wed 08/03/2017 11:16:05

Previous topic - Next topic

Slasher

Hi

GetCurrentMusic(); is obselete in the latest ags edition... what is the latest way..

I want to pause music whilst talking and then continue when finished talking.

I used to you something like this. I'm using .ogg:

Code: ags

nt music_pos = -1;
int music_num = -1;
int music_type = -1;
 
function PauseMusic() {
  music_num = GetCurrentMusic(); // now obselete
  if (music_num == -1) return;
  music_pos = GetMP3PosMillis();
  music_type = 0;
  if (!music_pos) {
    music_pos = GetMIDIPosition();
    music_type = 1;
  }
  if (music_pos == -1) {
    music_pos = Game.GetMODPattern();
    music_type = 2;
  }
  if (music_pos == -1) {
    // this shouldn't happen, but it's just a safety catch
    music_num = -1;
    music_type = -1;
    return;
  }
  StopMusic();
}
 
function UnPauseMusic() {
  if ((music_num == -1) || (music_pos == -1) || (music_type == -1)) return;
  PlayMusic(music_num);
  if (music_type == 0) SeekMP3PosMillis(music_pos);
  else if (music_type == 1) SeekMIDIPosition(music_pos);
  else if (music_type == 2) SeekMODPattern(music_pos);
  else StopMusic();
  music_num = -1;
  music_pos = -1;
  music_type = -1;





Khris

If you want to find a replacement for an old command, best search for it in the AGS 3.2.1 manual.

I found this:
Code: ags
readonly AudioClip* AudioChannel.PlayingClip

Which means you need to store the AudioChannel in a global variable when you call .Play()

SMF spam blocked by CleanTalk