public Initialize ( byte audioData, WaveFormat format ) : void | ||
audioData | byte | The Buffer. |
format | WaveFormat | The WaveFormat. |
return | void |
/// <summary> /// Initializes the audio provider with the given audio source. /// </summary> /// <param name="audioSource">The AudioSource.</param> public void Initialize(IAudioSource audioSource) { var openALAudioSource = audioSource as OpenALAudioSource; if (openALAudioSource == null) { throw new InvalidOperationException("The specified audio source does not match the AudioProvider type."); } //clean old playback if existent if (_audioBuffer != null) { _audioBuffer.Dispose(); } _audioSource = audioSource; var audioFormat = DetectAudioFormat(openALAudioSource.WaveFormat); _audioBuffer = OpenALDevice.DefaultDevice.CreateAudioBuffer(audioFormat); _audioBuffer.PlaybackChanged += AudioBufferPlaybackChanged; Volume = _volume; Pan = _pan; _audioBuffer.Initialize(openALAudioSource.WaveData, openALAudioSource.WaveFormat); }
/// <summary> /// Initializes the audio provider with the given audio source. /// </summary> /// <param name="audioSource">The AudioSource.</param> public void Initialize(IAudioSource audioSource) { var openALAudioSource = audioSource as OpenALAudioSource; if (openALAudioSource == null) { throw new InvalidOperationException("The specified audio source does not match the AudioProvider type."); } //clean old playback if existent if (_audioBuffer != null) { _audioBuffer.Dispose(); } _audioSource = audioSource; var audioFormat = DetectAudioFormat(openALAudioSource.WaveFormat); _audioBuffer = OpenALDevice.DefaultDevice.CreateAudioBuffer(audioFormat); _audioBuffer.PlaybackChanged += AudioBufferPlaybackChanged; Volume = _volume; Pan = _pan; _audioBuffer.Initialize(openALAudioSource.WaveData, openALAudioSource.WaveFormat); }