projects
/
rtaudio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Missing include for roundf().
[rtaudio.git]
/
RtAudio.cpp
diff --git
a/RtAudio.cpp
b/RtAudio.cpp
index d80660e70addcbf12cacbd532129eddfc488206b..3e78f75f624fc2d8621d6ba310a75812e23f395e 100644
(file)
--- a/
RtAudio.cpp
+++ b/
RtAudio.cpp
@@
-47,6
+47,7
@@
#include <climits>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cmath>
#include <algorithm>
+#include <cmath>
// Static variable definitions.
const unsigned int RtApi::MAX_SAMPLE_RATES = 14;
// Static variable definitions.
const unsigned int RtApi::MAX_SAMPLE_RATES = 14;
@@
-465,7
+466,7
@@
double RtApi :: getStreamTime( void )
struct timeval then;
struct timeval now;
struct timeval then;
struct timeval now;
- if ( stream_.state != STREAM_RUNNING ||
stream_.streamTime == 0.0
)
+ if ( stream_.state != STREAM_RUNNING ||
(stream_.lastTickTimestamp.tv_sec == 0 && stream_.lastTickTimestamp.tv_usec == 0)
)
return stream_.streamTime;
gettimeofday( &now, NULL );
return stream_.streamTime;
gettimeofday( &now, NULL );
@@
-496,6
+497,14
@@
unsigned int RtApi :: getStreamSampleRate( void )
return stream_.sampleRate;
}
return stream_.sampleRate;
}
+void RtApi :: startStream( void )
+{
+#if defined( HAVE_GETTIMEOFDAY )
+ stream_.lastTickTimestamp.tv_sec = 0;
+ stream_.lastTickTimestamp.tv_usec = 0;
+#endif
+}
+
// *************************************************** //
//
// *************************************************** //
//
@@
-1535,6
+1544,7
@@
void RtApiCore :: closeStream( void )
void RtApiCore :: startStream( void )
{
verifyStream();
void RtApiCore :: startStream( void )
{
verifyStream();
+ RtApi::startStream();
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiCore::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiCore::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
@@
-2497,6
+2507,7
@@
void RtApiJack :: closeStream( void )
void RtApiJack :: startStream( void )
{
verifyStream();
void RtApiJack :: startStream( void )
{
verifyStream();
+ RtApi::startStream();
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiJack::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiJack::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
@@
-3380,6
+3391,7
@@
bool stopThreadCalled = false;
void RtApiAsio :: startStream()
{
verifyStream();
void RtApiAsio :: startStream()
{
verifyStream();
+ RtApi::startStream();
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiAsio::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiAsio::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
@@
-3767,7
+3779,7
@@
static const char* getAsioErrorString( ASIOError result )
#include <audioclient.h>
#include <avrt.h>
#include <mmdeviceapi.h>
#include <audioclient.h>
#include <avrt.h>
#include <mmdeviceapi.h>
-#include <
functiondiscoveryk
eys_devpkey.h>
+#include <
FunctionDiscoveryK
eys_devpkey.h>
#ifndef MF_E_TRANSFORM_NEED_MORE_INPUT
#define MF_E_TRANSFORM_NEED_MORE_INPUT _HRESULT_TYPEDEF_(0xc00d6d72)
#ifndef MF_E_TRANSFORM_NEED_MORE_INPUT
#define MF_E_TRANSFORM_NEED_MORE_INPUT _HRESULT_TYPEDEF_(0xc00d6d72)
@@
-4558,6
+4570,7
@@
void RtApiWasapi::closeStream( void )
void RtApiWasapi::startStream( void )
{
verifyStream();
void RtApiWasapi::startStream( void )
{
verifyStream();
+ RtApi::startStream();
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiWasapi::startStream: The stream is already running.";
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiWasapi::startStream: The stream is already running.";
@@
-6365,6
+6378,7
@@
void RtApiDs :: closeStream()
void RtApiDs :: startStream()
{
verifyStream();
void RtApiDs :: startStream()
{
verifyStream();
+ RtApi::startStream();
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiDs::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiDs::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
@@
-6425,6
+6439,7
@@
void RtApiDs :: startStream()
void RtApiDs :: stopStream()
{
verifyStream();
void RtApiDs :: stopStream()
{
verifyStream();
+ RtApi::startStream();
if ( stream_.state == STREAM_STOPPED ) {
errorText_ = "RtApiDs::stopStream(): the stream is already stopped!";
error( RtAudioError::WARNING );
if ( stream_.state == STREAM_STOPPED ) {
errorText_ = "RtApiDs::stopStream(): the stream is already stopped!";
error( RtAudioError::WARNING );
@@
-8063,6
+8078,7
@@
void RtApiAlsa :: startStream()
// This method calls snd_pcm_prepare if the device isn't already in that state.
verifyStream();
// This method calls snd_pcm_prepare if the device isn't already in that state.
verifyStream();
+ RtApi::startStream();
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiAlsa::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiAlsa::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
@@
-8625,12
+8641,21
@@
void RtApiPulse::callbackEvent( void )
MUTEX_UNLOCK( &stream_.mutex );
RtApi::tickStreamTime();
MUTEX_UNLOCK( &stream_.mutex );
RtApi::tickStreamTime();
+ if (pah->s_play) {
+ int e = 0;
+ pa_usec_t const lat = pa_simple_get_latency(pah->s_play, &e);
+ if (e == 0) {
+ stream_.latency[0] = lat * stream_.sampleRate / 1000000;
+ }
+ }
+
if ( doStopStream == 1 )
stopStream();
}
void RtApiPulse::startStream( void )
{
if ( doStopStream == 1 )
stopStream();
}
void RtApiPulse::startStream( void )
{
+ RtApi::startStream();
PulseAudioHandle *pah = static_cast<PulseAudioHandle *>( stream_.apiHandle );
if ( stream_.state == STREAM_CLOSED ) {
PulseAudioHandle *pah = static_cast<PulseAudioHandle *>( stream_.apiHandle );
if ( stream_.state == STREAM_CLOSED ) {
@@
-9628,6
+9653,7
@@
void RtApiOss :: closeStream()
void RtApiOss :: startStream()
{
verifyStream();
void RtApiOss :: startStream()
{
verifyStream();
+ RtApi::startStream();
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiOss::startStream(): the stream is already running!";
error( RtAudioError::WARNING );
if ( stream_.state == STREAM_RUNNING ) {
errorText_ = "RtApiOss::startStream(): the stream is already running!";
error( RtAudioError::WARNING );