public void TraverseNodesAndLeafs(DataProcessCallback in_data_process_callback, NodeProcessCallback in_node_process_callback) { Stack <QuadTreeNode> stack = new Stack <QuadTreeNode>(); QuadTreeNode current = m_root; while (true) { if (current.Children != null) { if (in_node_process_callback != null) { foreach (QuadTreeNode node in current.Children) { in_node_process_callback(node.Bounds); } } stack.Push(current.Children[2]); stack.Push(current.Children[1]); stack.Push(current.Children[3]); current = current.Children[0]; } else { QuadTreeLeaf node = current.Data; while (node != null) { in_data_process_callback(node.Data); node = node.Next; } if (stack.Count > 0) { current = stack.Pop(); } else { break; } } } }
internal MiniAudioAdapter(int sampleRate, bool enableAudioCapture) : base(sampleRate, enableAudioCapture) { // Build device type flags var deviceType = DeviceType.Playback; if (enableAudioCapture) { deviceType |= DeviceType.Capture; } // Allocate device config var deviceConfig = ma_ext_alloc_device_config(deviceType, (uint)sampleRate, _dataProc = DataProcessCallback); // Allocate device data and initialize _device = ma_ext_alloc_device(); var result = ma_device_init(null, deviceConfig, _device); if (result != Result.Success) { throw new InvalidOperationException("Unable to init device. " + result); } // Free device config, device has been initialized ma_ext_free(deviceConfig); // Start audio device result = ma_device_start(_device); if (result != Result.Success) { throw new InvalidOperationException("Unable to start device. " + result); } }
public static extern void *ma_ext_alloc_device_config(DeviceType deviceType, uint sampleRate, DataProcessCallback dataCallback);