struct timeval then;\r
struct timeval now;\r
\r
- if ( stream_.state != STREAM_RUNNING || stream_.streamTime == 0.0 )\r
+ // If lastTickTimestamp is 0 it means we haven't had a "last tick" since\r
+ // we started the stream.\r
+ if ( stream_.state != STREAM_RUNNING || (stream_.lastTickTimestamp.tv_sec == 0 && stream_.lastTickTimestamp.tv_usec == 0) )\r
return stream_.streamTime;\r
\r
gettimeofday( &now, NULL );\r
return stream_.sampleRate;\r
}\r
\r
+void RtApi :: startStream( void )\r
+{\r
+#if defined( HAVE_GETTIMEOFDAY )\r
+ stream_.lastTickTimestamp.tv_sec = 0;\r
+ stream_.lastTickTimestamp.tv_usec = 0;\r
+#endif\r
+}\r
+\r
\r
// *************************************************** //\r
//\r
void RtApiCore :: startStream( void )\r
{\r
verifyStream();\r
+ RtApi::startStream();\r
if ( stream_.state == STREAM_RUNNING ) {\r
errorText_ = "RtApiCore::startStream(): the stream is already running!";\r
error( RtAudioError::WARNING );\r
void RtApiJack :: startStream( void )\r
{\r
verifyStream();\r
+ RtApi::startStream();\r
if ( stream_.state == STREAM_RUNNING ) {\r
errorText_ = "RtApiJack::startStream(): the stream is already running!";\r
error( RtAudioError::WARNING );\r
void RtApiAsio :: startStream()\r
{\r
verifyStream();\r
+ RtApi::startStream();\r
if ( stream_.state == STREAM_RUNNING ) {\r
errorText_ = "RtApiAsio::startStream(): the stream is already running!";\r
error( RtAudioError::WARNING );\r
void RtApiWasapi::startStream( void )\r
{\r
verifyStream();\r
-\r
+ RtApi::startStream();\r
+ \r
if ( stream_.state == STREAM_RUNNING ) {\r
errorText_ = "RtApiWasapi::startStream: The stream is already running.";\r
error( RtAudioError::WARNING );\r
void RtApiDs :: startStream()\r
{\r
verifyStream();\r
+ RtApi::startStream();\r
+ \r
if ( stream_.state == STREAM_RUNNING ) {\r
errorText_ = "RtApiDs::startStream(): the stream is already running!";\r
error( RtAudioError::WARNING );\r
// This method calls snd_pcm_prepare if the device isn't already in that state.\r
\r
verifyStream();\r
+ RtApi::startStream();\r
if ( stream_.state == STREAM_RUNNING ) {\r
errorText_ = "RtApiAlsa::startStream(): the stream is already running!";\r
error( RtAudioError::WARNING );\r
\r
void RtApiPulse::startStream( void )\r
{\r
+ RtApi::startStream();\r
+ \r
PulseAudioHandle *pah = static_cast<PulseAudioHandle *>( stream_.apiHandle );\r
\r
if ( stream_.state == STREAM_CLOSED ) {\r
void RtApiOss :: startStream()\r
{\r
verifyStream();\r
+ RtApi::startStream();\r
if ( stream_.state == STREAM_RUNNING ) {\r
errorText_ = "RtApiOss::startStream(): the stream is already running!";\r
error( RtAudioError::WARNING );\r