audio_emitter_pitch


描述

This function can be used to change the pitch of all sounds emitted from the given emitter. It is a pitch multiplier, in that the input value multiplies the current pitch by that amount, so the default value of 1 is no pitch change, while a value of less than 1 will lower the pitch and greater than 1 will raise the pitch. 最好对此函数使用小增量,因为任何低于0或大于5的值都可能无法听到。

NOTE: If a sound is being looped through the emitter, the change in pitch will not be detected unless the sound is stopped and looped again!


语法:

audio_emitter_pitch(emitter, pitch);


参数 描述
emitter The index of the emitter to change.
音调值 The pitch multiplier (default 1).


返回:

N/A(无返回值)


例如:

switch (gear)
   {
   case 1: audio_emitter_pitch(s_emit, 0.8); break;
   case 2: audio_emitter_pitch(s_emit, 0.9); break;
   case 3: audio_emitter_pitch(s_emit, 0.95); break;
   case 4: audio_emitter_pitch(s_emit, 1); break;
   case 5: audio_emitter_pitch(s_emit, 1.2); break;
   }

The above code will change the pitch of the audio played from the emitter indexed in the variable "s_emit" based on the value of the variable "gear".