summaryrefslogtreecommitdiff
path: root/RtAudio.cpp
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-04-15 13:55:10 +0100
committercah <cah@ableton.com>2019-12-03 11:16:07 +0100
commite8aa9b26eee0b2366a6fcaa1630a2d27a1c6b51b (patch)
tree24ba8804077eb32e4c508488f33dcafbcfc0bb3f /RtAudio.cpp
parent46175bde1ab6c430c91a7d5380720cb5f0084cc9 (diff)
Try to fix build by removing std:: qualifier.
Diffstat (limited to 'RtAudio.cpp')
-rw-r--r--RtAudio.cpp71
1 files changed, 35 insertions, 36 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp
index 64b1577..ca58867 100644
--- a/RtAudio.cpp
+++ b/RtAudio.cpp
@@ -114,7 +114,7 @@ const char* rtaudio_api_names[][2] = {
{ "ds" , "DirectSound" },
{ "dummy" , "Dummy" },
};
-const unsigned int rtaudio_num_api_names =
+const unsigned int rtaudio_num_api_names =
sizeof(rtaudio_api_names)/sizeof(rtaudio_api_names[0]);
// The order here will control the order of RtAudio's API search in
@@ -473,7 +473,7 @@ double RtApi :: getStreamTime( void )
then = stream_.lastTickTimestamp;
return stream_.streamTime +
((now.tv_sec + 0.000001 * now.tv_usec) -
- (then.tv_sec + 0.000001 * then.tv_usec));
+ (then.tv_sec + 0.000001 * then.tv_usec));
#else
return stream_.streamTime;
#endif
@@ -1903,7 +1903,7 @@ bool RtApiCore :: callbackEvent( AudioDeviceID deviceId,
channelsLeft -= streamChannels;
}
}
-
+
if ( stream_.doConvertBuffer[1] ) { // convert from our internal "device" buffer
convertBuffer( stream_.userBuffer[1],
stream_.deviceBuffer,
@@ -2801,7 +2801,7 @@ RtApiAsio :: RtApiAsio()
// CoInitialize beforehand, but it must be for appartment threading
// (in which case, CoInitilialize will return S_FALSE here).
coInitialized_ = false;
- HRESULT hr = CoInitialize( NULL );
+ HRESULT hr = CoInitialize( NULL );
if ( FAILED(hr) ) {
errorText_ = "RtApiAsio::ASIO requires a single-threaded appartment. Call CoInitializeEx(0,COINIT_APARTMENTTHREADED)";
error( RtAudioError::WARNING );
@@ -3252,7 +3252,7 @@ bool RtApiAsio :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
errorText_ = errorStream_.str();
goto error;
}
- buffersAllocated = true;
+ buffersAllocated = true;
stream_.state = STREAM_STOPPED;
// Set flags for buffer conversion.
@@ -3731,13 +3731,13 @@ static long asioMessages( long selector, long value, void* /*message*/, double*
static const char* getAsioErrorString( ASIOError result )
{
- struct Messages
+ struct Messages
{
ASIOError value;
const char*message;
};
- static const Messages m[] =
+ static const Messages m[] =
{
{ ASE_NotPresent, "Hardware input or output is not present or available." },
{ ASE_HWMalfunction, "Hardware is malfunctioning." },
@@ -3972,7 +3972,7 @@ private:
// In order to satisfy WASAPI's buffer requirements, we need a means of converting sample rate
// between HW and the user. The WasapiResampler class is used to perform this conversion between
-// HwIn->UserIn and UserOut->HwOut during the stream callback loop.
+// HwIn->UserIn and UserO ut->HwOut during the stream callback loop.
class WasapiResampler
{
public:
@@ -5497,7 +5497,7 @@ Exit:
#if defined(__WINDOWS_DS__) // Windows DirectSound API
// Modified by Robin Davies, October 2005
-// - Improvements to DirectX pointer chasing.
+// - Improvements to DirectX pointer chasing.
// - Bug fix for non-power-of-two Asio granularity used by Edirol PCR-A30.
// - Auto-call CoInitialize for DSOUND and ASIO platforms.
// Various revisions for RtAudio 4.0 by Gary Scavone, April 2007
@@ -5541,7 +5541,7 @@ struct DsHandle {
void *id[2];
void *buffer[2];
bool xrun[2];
- UINT bufferPointer[2];
+ UINT bufferPointer[2];
DWORD dsBufferSize[2];
DWORD dsPointerLeadTime[2]; // the number of bytes ahead of the safe pointer to lead by.
HANDLE condition;
@@ -6394,7 +6394,7 @@ void RtApiDs :: startStream()
// Increase scheduler frequency on lesser windows (a side-effect of
// increasing timer accuracy). On greater windows (Win2K or later),
// this is already in effect.
- timeBeginPeriod( 1 );
+ timeBeginPeriod( 1 );
buffersRolling = false;
duplexPrerollBytes = 0;
@@ -6716,7 +6716,7 @@ void RtApiDs :: callbackEvent()
}
if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) {
-
+
LPDIRECTSOUNDBUFFER dsBuffer = (LPDIRECTSOUNDBUFFER) handle->buffer[0];
if ( handle->drainCounter > 1 ) { // write zeros to the output stream
@@ -6783,7 +6783,7 @@ void RtApiDs :: callbackEvent()
}
if ( dsPointerBetween( nextWritePointer, safeWritePointer, currentWritePointer, dsBufferSize )
- || dsPointerBetween( endWrite, safeWritePointer, currentWritePointer, dsBufferSize ) ) {
+ || dsPointerBetween( endWrite, safeWritePointer, currentWritePointer, dsBufferSize ) ) {
// We've strayed into the forbidden zone ... resync the read pointer.
handle->xrun[0] = true;
nextWritePointer = safeWritePointer + handle->dsPointerLeadTime[0] - bufferBytes;
@@ -6857,14 +6857,14 @@ void RtApiDs :: callbackEvent()
if ( safeReadPointer < (DWORD)nextReadPointer ) safeReadPointer += dsBufferSize; // unwrap offset
DWORD endRead = nextReadPointer + bufferBytes;
- // Handling depends on whether we are INPUT or DUPLEX.
+ // Handling depends on whether we are INPUT or DUPLEX.
// If we're in INPUT mode then waiting is a good thing. If we're in DUPLEX mode,
// then a wait here will drag the write pointers into the forbidden zone.
- //
- // In DUPLEX mode, rather than wait, we will back off the read pointer until
- // it's in a safe position. This causes dropouts, but it seems to be the only
- // practical way to sync up the read and write pointers reliably, given the
- // the very complex relationship between phase and increment of the read and write
+ //
+ // In DUPLEX mode, rather than wait, we will back off the read pointer until
+ // it's in a safe position. This causes dropouts, but it seems to be the only
+ // practical way to sync up the read and write pointers reliably, given the
+ // the very complex relationship between phase and increment of the read and write
// pointers.
//
// In order to minimize audible dropouts in DUPLEX mode, we will
@@ -6915,7 +6915,7 @@ void RtApiDs :: callbackEvent()
error( RtAudioError::SYSTEM_ERROR );
return;
}
-
+
if ( safeReadPointer < (DWORD)nextReadPointer ) safeReadPointer += dsBufferSize; // unwrap offset
}
}
@@ -8147,7 +8147,7 @@ void RtApiAlsa :: stopStream()
AlsaHandle *apiInfo = (AlsaHandle *) stream_.apiHandle;
snd_pcm_t **handle = (snd_pcm_t **) apiInfo->handles;
if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) {
- if ( apiInfo->synchronized )
+ if ( apiInfo->synchronized )
result = snd_pcm_drop( handle[0] );
else
result = snd_pcm_drain( handle[0] );
@@ -8412,8 +8412,8 @@ static void *alsaCallbackHandler( void *ptr )
#ifdef SCHED_RR // Undefined with some OSes (e.g. NetBSD 1.6.x with GNU Pthread)
if ( info->doRealtime ) {
- std::cerr << "RtAudio alsa: " <<
- (sched_getscheduler(0) == SCHED_RR ? "" : "_NOT_ ") <<
+ std::cerr << "RtAudio alsa: " <<
+ (sched_getscheduler(0) == SCHED_RR ? "" : "_NOT_ ") <<
"running realtime scheduling" << std::endl;
}
#endif
@@ -8580,7 +8580,7 @@ RtAudio::DeviceInfo RtApiPulse::getDeviceInfo( unsigned int /*device*/ )
mainloop_ = 0;
info.outputChannels = channels_;
-
+
return info;
}
@@ -8589,15 +8589,15 @@ static void *pulseaudio_callback( void * user )
CallbackInfo *cbi = static_cast<CallbackInfo *>( user );
RtApiPulse *context = static_cast<RtApiPulse *>( cbi->object );
volatile bool *isRunning = &cbi->isRunning;
-
+
#ifdef SCHED_RR // Undefined with some OSes (e.g. NetBSD 1.6.x with GNU Pthread)
if (cbi->doRealtime) {
- std::cerr << "RtAudio pulse: " <<
- (sched_getscheduler(0) == SCHED_RR ? "" : "_NOT_ ") <<
+ std::cerr << "RtAudio pulse: " <<
+ (sched_getscheduler(0) == SCHED_RR ? "" : "_NOT_ ") <<
"running realtime scheduling" << std::endl;
}
#endif
-
+
while ( *isRunning ) {
pthread_testcancel();
context->callbackEvent();
@@ -8715,7 +8715,7 @@ void RtApiPulse::callbackEvent( void )
else
bytes = stream_.nUserChannels[INPUT] * stream_.bufferSize *
formatBytes( stream_.userFormat );
-
+
if ( pa_simple_read( pah->s_rec, pulse_in, bytes, &pa_error ) < 0 ) {
errorStream_ << "RtApiPulse::callbackEvent: audio read error, " <<
pa_strerror( pa_error ) << ".";
@@ -9024,7 +9024,7 @@ bool RtApiPulse::probeDeviceOpen( unsigned int device, StreamMode mode,
if ( !stream_.callbackInfo.isRunning ) {
stream_.callbackInfo.object = this;
-
+
stream_.state = STREAM_STOPPED;
// Set the thread attributes for joinable and realtime scheduling
// priority (optional). The higher priority will only take affect
@@ -9045,7 +9045,7 @@ bool RtApiPulse::probeDeviceOpen( unsigned int device, StreamMode mode,
if ( priority < min ) priority = min;
else if ( priority > max ) priority = max;
param.sched_priority = priority;
-
+
// Set the policy BEFORE the priority. Otherwise it fails.
pthread_attr_setschedpolicy(&attr, SCHED_RR);
pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
@@ -9074,7 +9074,7 @@ bool RtApiPulse::probeDeviceOpen( unsigned int device, StreamMode mode,
}
return SUCCESS;
-
+
error:
if ( pah && stream_.callbackInfo.isRunning ) {
pthread_cond_destroy( &pah->runnable_cv );
@@ -9666,7 +9666,7 @@ bool RtApiOss :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigned
if ( priority < min ) priority = min;
else if ( priority > max ) priority = max;
param.sched_priority = priority;
-
+
// Set the policy BEFORE the priority. Otherwise it fails.
pthread_attr_setschedpolicy(&attr, SCHED_RR);
pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
@@ -10054,8 +10054,8 @@ static void *ossCallbackHandler( void *ptr )
#ifdef SCHED_RR // Undefined with some OSes (e.g. NetBSD 1.6.x with GNU Pthread)
if (info->doRealtime) {
- std::cerr << "RtAudio oss: " <<
- (sched_getscheduler(0) == SCHED_RR ? "" : "_NOT_ ") <<
+ std::cerr << "RtAudio oss: " <<
+ (sched_getscheduler(0) == SCHED_RR ? "" : "_NOT_ ") <<
"running realtime scheduling" << std::endl;
}
#endif
@@ -10776,4 +10776,3 @@ void RtApi :: byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat
// End:
//
// vim: et sts=2 sw=2
-