public bool StartAudio(string filename, bool loop) { Filename = filename; Width = Height = 0; if (!string.IsNullOrEmpty(Filename)) { if (_movieHandle < 0) { _movieHandle = AVProWindowsMediaPlugin.GetInstanceHandle(); } if (_formatConverter != null) { _formatConverter.Dispose(); _formatConverter = null; } // Note: we're marshaling the string to IntPtr as the pointer of type wchar_t System.IntPtr filenamePtr = Marshal.StringToHGlobalUni(Filename); if (AVProWindowsMediaPlugin.LoadAudio(_movieHandle, filenamePtr, loop)) { Volume = _volume; DurationSeconds = AVProWindowsMediaPlugin.GetDurationSeconds(_movieHandle); Debug.Log("[AVProWindowsMedia] Loaded audio " + Filename + " " + DurationSeconds.ToString("F2") + " sec"); } else { Debug.LogWarning("[AVProWindowsMedia] Movie failed to load"); Close(); } Marshal.FreeHGlobal(filenamePtr); } else { Debug.LogWarning("[AVProWindowsMedia] No movie file specified"); Close(); } return(_movieHandle >= 0); }