| 1670 | } |
| 1671 | |
| 1672 | void RtApiCore ::startStream(void) |
| 1673 | { |
| 1674 | verifyStream(); |
| 1675 | if (stream_.state == STREAM_RUNNING) |
| 1676 | { |
| 1677 | errorText_ = "RtApiCore::startStream(): the stream is already running!"; |
| 1678 | error(RtAudioError::WARNING); |
| 1679 | return; |
| 1680 | } |
| 1681 | |
| 1682 | #if defined(HAVE_GETTIMEOFDAY) |
| 1683 | gettimeofday(&stream_.lastTickTimestamp, NULL); |
| 1684 | #endif |
| 1685 | |
| 1686 | OSStatus result = noErr; |
| 1687 | CoreHandle * handle = (CoreHandle *) stream_.apiHandle; |
| 1688 | if (stream_.mode == OUTPUT || stream_.mode == DUPLEX) |
| 1689 | { |
| 1690 | |
| 1691 | result = AudioDeviceStart(handle->id[0], callbackHandler); |
| 1692 | if (result != noErr) |
| 1693 | { |
| 1694 | errorStream_ << "RtApiCore::startStream: system error (" << getErrorCode(result) << ") starting callback procedure on device (" << stream_.device[0] << ")."; |
| 1695 | errorText_ = errorStream_.str(); |
| 1696 | goto unlock; |
| 1697 | } |
| 1698 | } |
| 1699 | |
| 1700 | if (stream_.mode == INPUT || (stream_.mode == DUPLEX && stream_.device[0] != stream_.device[1])) |
| 1701 | { |
| 1702 | |
| 1703 | result = AudioDeviceStart(handle->id[1], callbackHandler); |
| 1704 | if (result != noErr) |
| 1705 | { |
| 1706 | errorStream_ << "RtApiCore::startStream: system error starting input callback procedure on device (" << stream_.device[1] << ")."; |
| 1707 | errorText_ = errorStream_.str(); |
| 1708 | goto unlock; |
| 1709 | } |
| 1710 | } |
| 1711 | |
| 1712 | handle->drainCounter = 0; |
| 1713 | handle->internalDrain = false; |
| 1714 | stream_.state = STREAM_RUNNING; |
| 1715 | |
| 1716 | unlock: |
| 1717 | if (result == noErr) return; |
| 1718 | error(RtAudioError::SYSTEM_ERROR); |
| 1719 | } |
| 1720 | |
| 1721 | void RtApiCore ::stopStream(void) |
| 1722 | { |
nothing calls this directly
no test coverage detected