public static extern void SetAudioCallback(AudioCallbackFunction function);
unsafe public bool InitUSB() { byte[] name = new byte[256]; byte[] model = new byte[256]; int[] type = new int[16]; connected = false; string[] vals; ASCIIEncoding buffer = new ASCIIEncoding(); try { if (File.Exists("ExtIO_RTL.dll")) { fixed (byte* Name = &name[0]) fixed (byte* Model = &model[0]) { if (InitHW(Name, Model, type) == 1) connected = true; else connected = false; vals = buffer.GetString(name).Split('\0') ; string hw_name = vals[0]; vals = buffer.GetString(model).Split('\0'); string hw_model = vals[0]; console.SetupForm.txtRTL_SDR_Device.Text = hw_name + " " + hw_model; } if (connected) { if (OpenHW() == 1) { audio_callback = new AudioCallbackFunction(Audio.RTL_SDR_AudioCallback); SetAudioCallback(audio_callback); if (!console.SkinsEnabled) console.btnUSB.BackColor = Color.GreenYellow; } else { connected = false; CloseHW(); if (!console.SkinsEnabled) console.btnUSB.BackColor = Color.Red; } } else { if (!console.SkinsEnabled) console.SetupForm.chkGeneralUSBPresent.Checked = false; console.btnUSB.BackColor = Color.Red; } return connected; } else return false; } catch (Exception ex) { if (debug && !console.ConsoleClosing) console.Invoke(new DebugCallbackFunction(console.DebugCallback), "InitUSB error: \n" + ex.ToString()); Debug.Write("Error while RTL_SDR init!\n", "Error!\n" + ex.ToString()); return false; } }