这篇教程C++ CFRunLoopGetCurrent函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CFRunLoopGetCurrent函数的典型用法代码示例。如果您正苦于以下问题:C++ CFRunLoopGetCurrent函数的具体用法?C++ CFRunLoopGetCurrent怎么用?C++ CFRunLoopGetCurrent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CFRunLoopGetCurrent函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: cleanupvoid Audio_Queue::init(){ OSStatus err = noErr; cleanup(); // create the audio queue err = AudioQueueNewOutput(&m_streamDesc, audioQueueOutputCallback, this, CFRunLoopGetCurrent(), NULL, 0, &m_outAQ); if (err) { AQ_TRACE("%s: error in AudioQueueNewOutput/n", __PRETTY_FUNCTION__); m_lastError = err; if (m_delegate) { m_delegate->audioQueueInitializationFailed(); } return; } Stream_Configuration *configuration = Stream_Configuration::configuration(); // allocate audio queue buffers for (unsigned int i = 0; i < configuration->bufferCount; ++i) { err = AudioQueueAllocateBuffer(m_outAQ, configuration->bufferSize, &m_audioQueueBuffer[i]); if (err) { /* If allocating the buffers failed, everything else will fail, too. * Dispose the queue so that we can later on detect that this * queue in fact has not been initialized. */ AQ_TRACE("%s: error in AudioQueueAllocateBuffer/n", __PRETTY_FUNCTION__); (void)AudioQueueDispose(m_outAQ, true); m_outAQ = 0; m_lastError = err; if (m_delegate) { m_delegate->audioQueueInitializationFailed(); } return; } } // listen for kAudioQueueProperty_IsRunning err = AudioQueueAddPropertyListener(m_outAQ, kAudioQueueProperty_IsRunning, audioQueueIsRunningCallback, this); if (err) { AQ_TRACE("%s: error in AudioQueueAddPropertyListener/n", __PRETTY_FUNCTION__); m_lastError = err; return; } if (configuration->enableTimeAndPitchConversion) { UInt32 enableTimePitchConversion = 1; err = AudioQueueSetProperty (m_outAQ, kAudioQueueProperty_EnableTimePitch, &enableTimePitchConversion, sizeof(enableTimePitchConversion)); if (err != noErr) { AQ_TRACE("Failed to enable time and pitch conversion. Play rate setting will fail/n"); } } if (m_initialOutputVolume != 1.0) { setVolume(m_initialOutputVolume); }}
开发者ID:jsonsnow,项目名称:MusicPlayers,代码行数:67,
示例2: btpad_packet_handlervoid btpad_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ bd_addr_t event_addr; if (packet_type == HCI_EVENT_PACKET) { switch (packet[0]) { case BTSTACK_EVENT_STATE: { RARCH_LOG("BTstack: HCI State %d/n", packet[2]); switch (packet[2]) { case HCI_STATE_WORKING: btpad_queue_reset(); btpad_queue_hci_read_bd_addr(); bt_send_cmd_ptr(l2cap_register_service_ptr, PSM_HID_CONTROL, 672); // TODO: Where did I get 672 for mtu? bt_send_cmd_ptr(l2cap_register_service_ptr, PSM_HID_INTERRUPT, 672); btpad_queue_hci_inquiry(HCI_INQUIRY_LAP, 3, 1); btpad_queue_run(1); break; case HCI_STATE_HALTING: btpad_close_all_connections(); CFRunLoopStop(CFRunLoopGetCurrent()); break; } } break; case HCI_EVENT_COMMAND_STATUS: btpad_queue_run(packet[3]); break; case HCI_EVENT_COMMAND_COMPLETE: { btpad_queue_run(packet[2]); if (COMMAND_COMPLETE_EVENT(packet, (*hci_read_bd_addr_ptr))) { bt_flip_addr_ptr(event_addr, &packet[6]); if (!packet[5]) RARCH_LOG("BTpad: Local address is %s/n", bd_addr_to_str_ptr(event_addr)); else RARCH_LOG("BTpad: Failed to get local address (Status: %02X)/n", packet[5]); } } break; case HCI_EVENT_INQUIRY_RESULT: { if (packet[2]) { bt_flip_addr_ptr(event_addr, &packet[3]); struct apple_pad_connection* connection = (struct apple_pad_connection*)btpad_find_empty_connection(); if (connection) { RARCH_LOG("BTpad: Inquiry found device/n"); memset(connection, 0, sizeof(struct apple_pad_connection)); memcpy(connection->address, event_addr, sizeof(bd_addr_t)); connection->has_address = true; connection->state = BTPAD_CONNECTING; bt_send_cmd_ptr(l2cap_create_channel_ptr, connection->address, PSM_HID_CONTROL); bt_send_cmd_ptr(l2cap_create_channel_ptr, connection->address, PSM_HID_INTERRUPT); } } } break; case HCI_EVENT_INQUIRY_COMPLETE: { // This must be turned off during gameplay as it causes a ton of lag inquiry_running = !inquiry_off; if (inquiry_running) btpad_queue_hci_inquiry(HCI_INQUIRY_LAP, 3, 1); } break; case L2CAP_EVENT_CHANNEL_OPENED: { bt_flip_addr_ptr(event_addr, &packet[3]); const uint16_t handle = READ_BT_16(packet, 9); const uint16_t psm = READ_BT_16(packet, 11); const uint16_t channel_id = READ_BT_16(packet, 13); struct apple_pad_connection* connection = (struct apple_pad_connection*)btpad_find_connection_for(handle, event_addr); if (!packet[2]) { if (!connection) { RARCH_LOG("BTpad: Got L2CAP 'Channel Opened' event for unrecognized device/n");//.........这里部分代码省略.........
开发者ID:ChowZenki,项目名称:RetroArch,代码行数:101,
示例3: ReceiveReportsPsychError ReceiveReports(int deviceIndex){ long error=0; pRecDevice device; IOHIDDeviceInterface122** interface=NULL; int reason; // kCFRunLoopRunFinished, kCFRunLoopRunStopped, kCFRunLoopRunTimedOut, kCFRunLoopRunHandledSource PsychHIDVerifyInit(); if(deviceIndex < 0 || deviceIndex >= MAXDEVICEINDEXS) PrintfExit("Sorry. Can't cope with deviceNumber %d (more than %d). Please tell [email C++ CFRunLoopRemoveSource函数代码示例 C++ CFRunLoopAddSource函数代码示例
|