MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / startStream

Method startStream

examples/TinyAudio/RtAudio.cpp:1595–1637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1593}
1594
1595void 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
1634unlock:
1635 if (result == noErr) return;
1636 error(RtAudioError::SYSTEM_ERROR);
1637}
1638
1639void RtApiCore ::stopStream(void)
1640{

Callers

nothing calls this directly

Calls 6

errorFunction · 0.85
getAsioErrorStringFunction · 0.85
getErrorStringFunction · 0.85
strMethod · 0.80
c_strMethod · 0.80
StartMethod · 0.45

Tested by

no test coverage detected