| 1593 | } |
| 1594 | |
| 1595 | void RtApiCore ::startStream(void) |
| 1596 | { |
| 1597 | verifyStream(); |
| 1598 | if (stream_.state == STREAM_RUNNING) |
| 1599 | { |
| 1600 | errorText_ = "RtApiCore::startStream(): the stream is already running!"; |
| 1601 | error(RtAudioError::WARNING); |
| 1602 | return; |
| 1603 | } |
| 1604 | |
| 1605 | OSStatus result = noErr; |
| 1606 | CoreHandle *handle = (CoreHandle *)stream_.apiHandle; |
| 1607 | if (stream_.mode == OUTPUT || stream_.mode == DUPLEX) |
| 1608 | { |
| 1609 | result = AudioDeviceStart(handle->id[0], callbackHandler); |
| 1610 | if (result != noErr) |
| 1611 | { |
| 1612 | errorStream_ << "RtApiCore::startStream: system error (" << getErrorCode(result) << ") starting callback procedure on device (" << stream_.device[0] << ")."; |
| 1613 | errorText_ = errorStream_.str(); |
| 1614 | goto unlock; |
| 1615 | } |
| 1616 | } |
| 1617 | |
| 1618 | if (stream_.mode == INPUT || |
| 1619 | (stream_.mode == DUPLEX && stream_.device[0] != stream_.device[1])) |
| 1620 | { |
| 1621 | result = AudioDeviceStart(handle->id[1], callbackHandler); |
| 1622 | if (result != noErr) |
| 1623 | { |
| 1624 | errorStream_ << "RtApiCore::startStream: system error starting input callback procedure on device (" << stream_.device[1] << ")."; |
| 1625 | errorText_ = errorStream_.str(); |
| 1626 | goto unlock; |
| 1627 | } |
| 1628 | } |
| 1629 | |
| 1630 | handle->drainCounter = 0; |
| 1631 | handle->internalDrain = false; |
| 1632 | stream_.state = STREAM_RUNNING; |
| 1633 | |
| 1634 | unlock: |
| 1635 | if (result == noErr) return; |
| 1636 | error(RtAudioError::SYSTEM_ERROR); |
| 1637 | } |
| 1638 | |
| 1639 | void RtApiCore ::stopStream(void) |
| 1640 | { |
nothing calls this directly
no test coverage detected