Last active
March 17, 2019 22:56
-
-
Save troy-lamerton/978bd2d3e0d6c405ea5c02a24fe932e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pass the callback to the modified Client Start method | |
public void Initialize(SWIGTYPE_p_f_p_void_p_q_const__char_p_q_const__char_p_short_int_int_int_int__void receivedAudio) { | |
if (_initialized) | |
return; | |
VxClient.Instance.Start(receivedAudio); | |
_initialized = true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This file has the callback which should receive audio data | |
*/ | |
public class CommandProcessor : MonoBehaviour | |
// ... | |
delegate void AudioReceivedDelegate(Action cb, char[] a, char[] b, short c, int d, int e, int f, int g); | |
private void OnAudioDataCallback(Action cb, char[] a, char[] b, short c, int d, int e, int f, int g) { | |
throw new NotImplementedException(); | |
} | |
IAsyncResult BeginBuildClient(Uri webService, AsyncCallback callback) | |
{ | |
if (String.IsNullOrEmpty(webService.ToString())) throw new ArgumentNullException("webService", "Specify a non-null argument."); | |
var result = new AsyncResult<Client>(callback); | |
var audioReceivedCallback = new SWIGTYPE_p_f_p_void_p_q_const__char_p_q_const__char_p_short_int_int_int_int__void( | |
Marshal.GetFunctionPointerForDelegate(new AudioReceivedDelegate(OnAudioDataCallback)), true); | |
_client.Initialize(audioReceivedCallback); | |
// ... | |
} | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Start(SWIGTYPE_p_f_p_void_p_q_const__char_p_q_const__char_p_short_int_int_int_int__void receivedAudio) { | |
if (_startCount > 0) { | |
++_startCount; | |
return; | |
} | |
VivoxDebug.Instance.debugLocation = 0; | |
vx_sdk_config_t config = new vx_sdk_config_t(); | |
VivoxCoreInstance.vx_get_default_config(config); | |
config.initial_log_level = (vx_log_level)2; | |
// set the audio received callback | |
config.pf_on_audio_unit_before_recv_audio_rendered = receivedAudio; | |
int status = VivoxCoreInstance.Initialize(config); | |
if (status != 0) | |
throw new VivoxApiException(status); | |
MessagePump.Instance.MainLoopRun += InstanceOnMainLoopRun; | |
++_startCount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment