Exemple #1
0
void ConverseSpeech::update()
{
 TownsSound sound;
 SoundManager *sm = Game::get_game()->get_sound_manager();

 if(!sm->is_audio_enabled() || !sm->is_speech_enabled())
   return;

 if(!list.empty())
   {
    if(sm->isSoundPLaying(handle) == false)
     {
    	list.pop_front();
    	if(!list.empty())
    	{
    	    sound = list.front();
        	handle = sm->playTownsSound(sound.filename, sound.sample_num);
    	}
     }
   }
}
Exemple #2
0
void ConverseSpeech::play_speech(uint16 actor_num, uint16 sample_num)
{
 std::string sample_file;
 char filename[20]; // "/speech/charxxx.sam"
 TownsSound sound;
 SoundManager *sm = Game::get_game()->get_sound_manager();
 
 if(!sm->is_audio_enabled()  || !sm->is_speech_enabled())
   return;

 //translate the converse sample number into the CHAR number in the SPEECH directory if required.
 
 if(actor_num == 202) //GUARDS
  actor_num = 228; 

 if(actor_num == 201) //WISPS
  actor_num = 229;

 sample_num--;
 
 sprintf(filename, "speech%cchar%u.sam", U6PATH_DELIMITER, actor_num);
 
 config->pathFromValue("config/ultima6/townsdir", filename, sample_file);
 
 DEBUG(0,LEVEL_DEBUGGING,"Loading Speech Sample %s:%d\n", sample_file.c_str(), sample_num);

 sound.filename = sample_file;
 sound.sample_num = sample_num;

 if(list.empty())
	 handle = sm->playTownsSound(sample_file, sample_num);

 list.push_back(sound);

 return;
}