本文整理汇总了C#中UnityEngine.WWW.GetAudioClip方法的典型用法代码示例。如果您正苦于以下问题:C# WWW.GetAudioClip方法的具体用法?C# WWW.GetAudioClip怎么用?C# WWW.GetAudioClip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.WWW
的用法示例。
在下文中一共展示了WWW.GetAudioClip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DownloadAudio
private IEnumerator DownloadAudio()
{
_url = input_url.text;
//#if !UNITY_EDITOR
// _url = _url.Replace("http://www.spilldemo.com", Application.dataPath + "/..");
//#endif
Debug.Log("_url: " + _url);
yield return new WaitForSeconds(0.5f);
WWW www = new WWW(_url);
yield return www;
string extension = _url.Substring(_url.Length - 4);
Debug.Log("extension: " + extension);
if (extension.Equals(".ogg"))
_source.clip = www.GetAudioClip(false, false, AudioType.OGGVORBIS);
else if (extension.Equals(".mp3"))
_source.clip = www.GetAudioClip(false, false, AudioType.MPEG);
else if (extension.Equals(".wav"))
_source.clip = www.GetAudioClip(false, false, AudioType.WAV);
else
_source.clip = www.GetAudioClip(false, false, AudioType.UNKNOWN);
yield return new WaitForSeconds(0.5f);
_source.Play();
}
示例2: onFlightStart
protected override void onFlightStart()
{
ping = gameObject.AddComponent<AudioSource>();
WWW www = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "Parts/mumech_MuonDetector/ping.wav");
if ((ping != null) && (www != null))
{
ping.clip = www.GetAudioClip(false);
ping.volume = 0;
ping.Stop();
}
disk = transform.Find("model/disk");
if (disk != null)
{
MIN_PING_DIST = 150000;
MIN_PING_TIME = 0.2;
MAX_PING_TIME = 15;
led = transform.Find("model/led");
originalLensShader = led.renderer.material.shader;
pingLight = led.gameObject.AddComponent<Light>();
pingLight.type = LightType.Point;
pingLight.renderMode = LightRenderMode.ForcePixel;
pingLight.shadows = LightShadows.None;
pingLight.range = 1;
pingLight.enabled = false;
}
RenderingManager.AddToPostDrawQueue(3, new Callback(drawGUI));
}
示例3: StartLoadMusic
private IEnumerator StartLoadMusic(string url, bool broadcast = false)
{
var s = http + "://tmrace.net/cops/music.php?url=" + WWW.EscapeURL(url);
Debug.LogWarning(s);
var w = new WWW(s);
yield return w;
if(string.IsNullOrEmpty(w.text))yield break;
print(w.text);
w = new WWW(w.text);
yield return w;
var audioClip = w.GetAudioClip(false, true, AudioType.OGGVORBIS);
if (audioClip.length == 0)
{
Debug.LogError(w.error);
yield break;
}
if (broadcast && _Game && audioClip)
{
broadCastTime = Time.time;
_GameGui.CallRPC(_GameGui.Chat, _Loader.playerName + " Play music " + Path.GetFileNameWithoutExtension(w.url));
_GameGui.CallRPCTo(_MpGame.LoadMusic, PhotonTargets.Others, s);
}
audio.clip = audioClip;
audio.Play();
}
示例4: FileSelected
protected void FileSelected(string path)
{
fileBrowser = null;
if (path != null)
{
Debug.Log(path);
if(path.Contains(".mp3"))
{
Debug.Log(path);
using (Mp3FileReader reader = new Mp3FileReader(path))
{
Debug.Log("Reached");
path = path.Replace(".mp3", ".wav");
WaveFileWriter.CreateWaveFile(path , reader);
}
}
path = "file://" + path;
WWW wtf = new WWW(path);
//Wait for wtf to finish
while (!wtf.isDone)
{
}
SceneManager.getInstance.setClip(wtf.GetAudioClip(false));
}
}
示例5: StartLoadMusic
private IEnumerator StartLoadMusic(string url, bool broadcast = false)
{
var s = http + "//tmrace.net/cops/music.php?url=" + WWW.EscapeURL(url);
print(s);
var w = new WWW(s);
yield return w;
print(w.text);
w = new WWW(w.text);
yield return w;
var audioClip = w.GetAudioClip(false, true);
if (audioClip.length == 0)
{
Debug.LogError(w.error);
yield break;
}
if (broadcast && _Game && audioClip)
{
broadCastTime = Time.time;
_Game.CallRPC(_ChatGui.Chat, _Player.playerName + " Set music to " + w.text);
_Game.CallRPCTo(_Game.LoadMusic, PhotonTargets.Others, w.text);
}
audio.clip = audioClip;
audio.Play();
}
示例6: OpenAndPlay
private IEnumerator OpenAndPlay(string path)
{
WWW www = new WWW("file://" + path);
this.AudioSource.clip = www.GetAudioClip(false, true);
while (this.AudioSource.clip.isReadyToPlay == false) yield return null;
this.AudioSource.Play();
}
示例7: GetAudioClip
public AudioClip GetAudioClip()
{
var thewww = new WWW(song);
while(!thewww.isDone){ }
var ac = thewww.GetAudioClip(false, true,AudioType.OGGVORBIS);
thewww.Dispose();
return ac;
}
示例8: LoadMusic
IEnumerator LoadMusic(string[] urls)
{
foreach (string url in urls){
WWW download = new WWW ("file://" + url);
yield return download;
music.Add(download.GetAudioClip(false));
}
}
示例9: LoadClip
public static IEnumerator LoadClip(AudioSource audioSource)
{
WWW www = new WWW("file://" + tempFolder + "output.wav");
while (!www.isDone)
yield return www;
AudioClip clip = www.GetAudioClip(false);
audioSource.clip = clip;
if (clip.length > 0)
audioSource.PlayDelayed(0.02f);
}
示例10: LoadSound
private IEnumerator LoadSound()
{
WWW www = new WWW("File://" + Application.streamingAssetsPath + "/Audio/buttonSound.ogg");
yield return www;
//buttonSound = www.audioClip;
buttonSound = www.GetAudioClip(false);
www.Dispose();
}
示例11: GetWWW
IEnumerator GetWWW(int st)
{
www = new WWW(urls[st]);
int frames = 0;
while (www != null && !www.isDone)
{
m_info = "Loading... " + frames;
frames++;
yield return new WaitForEndOfFrame();
}
if (!string.IsNullOrEmpty(www.error))
{
m_info = "Error: " + www.error;
}
else
{
m_info = "Done!";
switch (st)
{
case 0:
{
m_info += " Press Mouse Button 2 to load texture";
tex = null;
if (www.audioClip != null)
{
_audio = www.GetAudioClip(false, false, AudioType.WAV);
if (_audio == null)
yield return new WaitForEndOfFrame();
else
gameObject.GetComponent<AudioSource>().clip = _audio;
}
break;
}
case 1:
{
m_info += " Press Mouse Button 2 to load texture (non readable) and load into texture";
_audio = null;
gameObject.GetComponent<AudioSource>().clip = null;
if (www.texture != null)
tex = www.texture;
}
break;
case 2:
{
m_info += " Press Mouse Button 2 to load sound";
if (www.textureNonReadable != null)
www.LoadImageIntoTexture(tex);
}
break;
}
}
}
示例12: start
IEnumerator start()
{
// Remove the "spaces" in excess
Regex rgx = new Regex ("\\s+");
// Replace the "spaces" with "% 20" for the link Can be interpreted
string result = rgx.Replace ("Hello", "%20");
string url = "http://translate.google.com/translate_tts?tl=en&q=" + result;
WWW www = new WWW (url);
yield return www;
GetComponent<AudioSource>().clip = www.GetAudioClip (false, false, AudioType.MPEG);
GetComponent<AudioSource>().Play ();
}
示例13: play
public void play()
{
//the actual play button activation method
string fullpath = "file://" + fileinfo [selectedCellIndex].FullName;
Debug.Log ("Play, " + fullpath);
WWW clip = new WWW (fullpath);
Debug.Log (clip.bytes);
audioSource.clip = clip.GetAudioClip (false, true);
audioSource.Play ();
//Animation Anime = jeep.GetComponent<Animation> ();
//Anime.Play ("Take 001");
//Debug.Log (Anime.Play ());
}
示例14: DownloadSound
IEnumerator DownloadSound()
{
WWW www = new WWW("http://7ROAD-20140625X.7road.com/music.wav");
yield return www;
if (www.error != null)
{
m_info = www.error;
yield return null;
}
m_downloadClip = www.GetAudioClip(false);
audio.PlayOneShot(m_downloadClip);
}
示例15: download
IEnumerator download(string filePathUrl)
{
WWW www = new WWW (filePathUrl);
while (!www.isDone) { // ダウンロードの進捗を表示
print (Mathf.CeilToInt (www.progress * 100));
yield return null;
}
if (!string.IsNullOrEmpty (www.error)) { // ダウンロードでエラーが発生した
Debug.Log ("error:" + www.error);
} else { // ダウンロードが正常に完了した
filePath = Application.persistentDataPath + "/" + Path.GetFileName (www.url);
File.WriteAllBytes (filePath, www.bytes);
Debug.Log ("download file write success." + filePath);
audioSource.clip = www.GetAudioClip(false, true, AudioType.MPEG);
audioSource.Play();
// 音声の時間を保存しておく
maxAudioTime = www.GetAudioClip(false, true, AudioType.MPEG).length;
audioTime = maxAudioTime;
}
}