Add mmsystem.h and mmreg.h for dsound.
if (AUDIO_LINUX_PULSE)
find_library(PULSE_LIB pulse)
find_library(PULSESIMPLE_LIB pulse-simple)
- list(APPEND LINKLIBS ${PULSE_LIB} ${PULSESIMPLE_LIB})
+ find_package(Threads REQUIRED CMAKE_THREAD_PREFER_PTHREAD)
+ list(APPEND LINKLIBS ${PULSE_LIB} ${PULSESIMPLE_LIB} ${CMAKE_THREAD_LIBS_INIT})
add_definitions(-D__LINUX_PULSE__)
message(STATUS "Using Linux PulseAudio")
endif (AUDIO_LINUX_PULSE)
add_subdirectory(tests)
endif (BUILD_TESTING)
+install(TARGETS rtaudio
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION bin)
+
+install(
+ FILES RtAudio.h
+ DESTINATION include)
+
+install(
+ FILES rtaudio.pc
+ DESTINATION lib/pkgconfig)
-/************************************************************************/\r
+/************************************************************************/\r
/*! \class RtAudio\r
\brief Realtime audio i/o C++ classes.\r
\r
#include <cstdlib>\r
#include <cstring>\r
#include <climits>\r
+#include <cmath>\r
#include <algorithm>\r
\r
// Static variable definitions.\r
//\r
// *************************************************** //\r
\r
-std::string RtAudio :: getVersion( void ) throw()\r
+std::string RtAudio :: getVersion( void )\r
{\r
return RTAUDIO_VERSION;\r
}\r
\r
-void RtAudio :: getCompiledApi( std::vector<RtAudio::Api> &apis ) throw()\r
+void RtAudio :: getCompiledApi( std::vector<RtAudio::Api> &apis )\r
{\r
apis.clear();\r
\r
throw( RtAudioError( errorText, RtAudioError::UNSPECIFIED ) );\r
}\r
\r
-RtAudio :: ~RtAudio() throw()\r
+RtAudio :: ~RtAudio()\r
{\r
if ( rtapi_ )\r
delete rtapi_;\r
\r
if ( time >= 0.0 )\r
stream_.streamTime = time;\r
+#if defined( HAVE_GETTIMEOFDAY )\r
+ gettimeofday( &stream_.lastTickTimestamp, NULL );\r
+#endif\r
}\r
\r
unsigned int RtApi :: getStreamSampleRate( void )\r
// In order to satisfy WASAPI's buffer requirements, we need a means of converting sample rate\r
// between HW and the user. The convertBufferWasapi function is used to perform this conversion\r
// between HwIn->UserIn and UserOut->HwOut during the stream callback loop.\r
-// This sample rate converter favors speed over quality, and works best with conversions between\r
-// one rate and its multiple.\r
+// This sample rate converter works best with conversions between one rate and its multiple.\r
void convertBufferWasapi( char* outBuffer,\r
const char* inBuffer,\r
const unsigned int& channelCount,\r
{\r
// calculate the new outSampleCount and relative sampleStep\r
float sampleRatio = ( float ) outSampleRate / inSampleRate;\r
+ float sampleRatioInv = ( float ) 1 / sampleRatio;\r
float sampleStep = 1.0f / sampleRatio;\r
float inSampleFraction = 0.0f;\r
\r
- outSampleCount = ( unsigned int ) roundf( inSampleCount * sampleRatio );\r
+ outSampleCount = ( unsigned int ) std::roundf( inSampleCount * sampleRatio );\r
\r
- // frame-by-frame, copy each relative input sample into it's corresponding output sample\r
- for ( unsigned int outSample = 0; outSample < outSampleCount; outSample++ )\r
+ // if inSampleRate is a multiple of outSampleRate (or vice versa) there's no need to interpolate\r
+ if ( floor( sampleRatio ) == sampleRatio || floor( sampleRatioInv ) == sampleRatioInv )\r
{\r
- unsigned int inSample = ( unsigned int ) inSampleFraction;\r
-\r
- switch ( format )\r
+ // frame-by-frame, copy each relative input sample into it's corresponding output sample\r
+ for ( unsigned int outSample = 0; outSample < outSampleCount; outSample++ )\r
{\r
- case RTAUDIO_SINT8:\r
- memcpy( &( ( char* ) outBuffer )[ outSample * channelCount ], &( ( char* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( char ) );\r
- break;\r
- case RTAUDIO_SINT16:\r
- memcpy( &( ( short* ) outBuffer )[ outSample * channelCount ], &( ( short* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( short ) );\r
- break;\r
- case RTAUDIO_SINT24:\r
- memcpy( &( ( S24* ) outBuffer )[ outSample * channelCount ], &( ( S24* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( S24 ) );\r
- break;\r
- case RTAUDIO_SINT32:\r
- memcpy( &( ( int* ) outBuffer )[ outSample * channelCount ], &( ( int* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( int ) );\r
- break;\r
- case RTAUDIO_FLOAT32:\r
- memcpy( &( ( float* ) outBuffer )[ outSample * channelCount ], &( ( float* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( float ) );\r
- break;\r
- case RTAUDIO_FLOAT64:\r
- memcpy( &( ( double* ) outBuffer )[ outSample * channelCount ], &( ( double* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( double ) );\r
- break;\r
+ unsigned int inSample = ( unsigned int ) inSampleFraction;\r
+\r
+ switch ( format )\r
+ {\r
+ case RTAUDIO_SINT8:\r
+ memcpy( &( ( char* ) outBuffer )[ outSample * channelCount ], &( ( char* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( char ) );\r
+ break;\r
+ case RTAUDIO_SINT16:\r
+ memcpy( &( ( short* ) outBuffer )[ outSample * channelCount ], &( ( short* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( short ) );\r
+ break;\r
+ case RTAUDIO_SINT24:\r
+ memcpy( &( ( S24* ) outBuffer )[ outSample * channelCount ], &( ( S24* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( S24 ) );\r
+ break;\r
+ case RTAUDIO_SINT32:\r
+ memcpy( &( ( int* ) outBuffer )[ outSample * channelCount ], &( ( int* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( int ) );\r
+ break;\r
+ case RTAUDIO_FLOAT32:\r
+ memcpy( &( ( float* ) outBuffer )[ outSample * channelCount ], &( ( float* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( float ) );\r
+ break;\r
+ case RTAUDIO_FLOAT64:\r
+ memcpy( &( ( double* ) outBuffer )[ outSample * channelCount ], &( ( double* ) inBuffer )[ inSample * channelCount ], channelCount * sizeof( double ) );\r
+ break;\r
+ }\r
+\r
+ // jump to next in sample\r
+ inSampleFraction += sampleStep;\r
}\r
+ }\r
+ else // else interpolate\r
+ {\r
+ // frame-by-frame, copy each relative input sample into it's corresponding output sample\r
+ for ( unsigned int outSample = 0; outSample < outSampleCount; outSample++ )\r
+ {\r
+ unsigned int inSample = ( unsigned int ) inSampleFraction;\r
+ float inSampleDec = inSampleFraction - inSample;\r
+ unsigned int frameInSample = inSample * channelCount;\r
+ unsigned int frameOutSample = outSample * channelCount;\r
\r
- // jump to next in sample\r
- inSampleFraction += sampleStep;\r
+ switch ( format )\r
+ {\r
+ case RTAUDIO_SINT8:\r
+ {\r
+ for ( unsigned int channel = 0; channel < channelCount; channel++ )\r
+ {\r
+ char fromSample = ( ( char* ) inBuffer )[ frameInSample + channel ];\r
+ char toSample = ( ( char* ) inBuffer )[ frameInSample + channelCount + channel ];\r
+ char sampleDiff = ( char ) ( ( toSample - fromSample ) * inSampleDec );\r
+ ( ( char* ) outBuffer )[ frameOutSample + channel ] = fromSample + sampleDiff;\r
+ }\r
+ break;\r
+ }\r
+ case RTAUDIO_SINT16:\r
+ {\r
+ for ( unsigned int channel = 0; channel < channelCount; channel++ )\r
+ {\r
+ short fromSample = ( ( short* ) inBuffer )[ frameInSample + channel ];\r
+ short toSample = ( ( short* ) inBuffer )[ frameInSample + channelCount + channel ];\r
+ short sampleDiff = ( short ) ( ( toSample - fromSample ) * inSampleDec );\r
+ ( ( short* ) outBuffer )[ frameOutSample + channel ] = fromSample + sampleDiff;\r
+ }\r
+ break;\r
+ }\r
+ case RTAUDIO_SINT24:\r
+ {\r
+ for ( unsigned int channel = 0; channel < channelCount; channel++ )\r
+ {\r
+ int fromSample = ( ( S24* ) inBuffer )[ frameInSample + channel ].asInt();\r
+ int toSample = ( ( S24* ) inBuffer )[ frameInSample + channelCount + channel ].asInt();\r
+ int sampleDiff = ( int ) ( ( toSample - fromSample ) * inSampleDec );\r
+ ( ( S24* ) outBuffer )[ frameOutSample + channel ] = fromSample + sampleDiff;\r
+ }\r
+ break;\r
+ }\r
+ case RTAUDIO_SINT32:\r
+ {\r
+ for ( unsigned int channel = 0; channel < channelCount; channel++ )\r
+ {\r
+ int fromSample = ( ( int* ) inBuffer )[ frameInSample + channel ];\r
+ int toSample = ( ( int* ) inBuffer )[ frameInSample + channelCount + channel ];\r
+ int sampleDiff = ( int ) ( ( toSample - fromSample ) * inSampleDec );\r
+ ( ( int* ) outBuffer )[ frameOutSample + channel ] = fromSample + sampleDiff;\r
+ }\r
+ break;\r
+ }\r
+ case RTAUDIO_FLOAT32:\r
+ {\r
+ for ( unsigned int channel = 0; channel < channelCount; channel++ )\r
+ {\r
+ float fromSample = ( ( float* ) inBuffer )[ frameInSample + channel ];\r
+ float toSample = ( ( float* ) inBuffer )[ frameInSample + channelCount + channel ];\r
+ float sampleDiff = ( toSample - fromSample ) * inSampleDec;\r
+ ( ( float* ) outBuffer )[ frameOutSample + channel ] = fromSample + sampleDiff;\r
+ }\r
+ break;\r
+ }\r
+ case RTAUDIO_FLOAT64:\r
+ {\r
+ for ( unsigned int channel = 0; channel < channelCount; channel++ )\r
+ {\r
+ double fromSample = ( ( double* ) inBuffer )[ frameInSample + channel ];\r
+ double toSample = ( ( double* ) inBuffer )[ frameInSample + channelCount + channel ];\r
+ double sampleDiff = ( toSample - fromSample ) * inSampleDec;\r
+ ( ( double* ) outBuffer )[ frameOutSample + channel ] = fromSample + sampleDiff;\r
+ }\r
+ break;\r
+ }\r
+ }\r
+\r
+ // jump to next in sample\r
+ inSampleFraction += sampleStep;\r
+ }\r
}\r
}\r
\r
\r
RtApiDs :: ~RtApiDs()\r
{\r
- if ( coInitialized_ ) CoUninitialize(); // balanced call.\r
if ( stream_.state != STREAM_CLOSED ) closeStream();\r
+ if ( coInitialized_ ) CoUninitialize(); // balanced call.\r
}\r
\r
// The DirectSound default output is always the first device.\r
info.nativeFormats |= RTAUDIO_SINT8;\r
if ( mask & AFMT_S32_LE || mask & AFMT_S32_BE )\r
info.nativeFormats |= RTAUDIO_SINT32;\r
+#ifdef AFMT_FLOAT\r
if ( mask & AFMT_FLOAT )\r
info.nativeFormats |= RTAUDIO_FLOAT32;\r
+#endif\r
if ( mask & AFMT_S24_LE || mask & AFMT_S24_BE )\r
info.nativeFormats |= RTAUDIO_SINT24;\r
\r
}\r
\r
// Verify the sample rate setup worked.\r
- if ( abs( srate - sampleRate ) > 100 ) {\r
+ if ( abs( srate - (int)sampleRate ) > 100 ) {\r
close( fd );\r
errorStream_ << "RtApiOss::probeDeviceOpen: device (" << ainfo.name << ") does not support sample rate (" << sampleRate << ").";\r
errorText_ = errorStream_.str();\r
#include <string>
#include <vector>
-#include <exception>
+#include <stdexcept>
#include <iostream>
/*! \typedef typedef unsigned long RtAudioFormat;
*/
/************************************************************************/
-class RtAudioError : public std::exception
+class RtAudioError : public std::runtime_error
{
public:
//! Defined RtAudioError types.
};
//! The constructor.
- RtAudioError( const std::string& message, Type type = RtAudioError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
-
- //! The destructor.
- virtual ~RtAudioError( void ) throw() {}
+ RtAudioError( const std::string& message,
+ Type type = RtAudioError::UNSPECIFIED )
+ : std::runtime_error(message), type_(type) {}
//! Prints thrown error message to stderr.
- virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
+ virtual void printMessage( void ) const
+ { std::cerr << '\n' << what() << "\n\n"; }
//! Returns the thrown error message type.
- virtual const Type& getType(void) const throw() { return type_; }
+ virtual const Type& getType(void) const { return type_; }
//! Returns the thrown error message string.
- virtual const std::string& getMessage(void) const throw() { return message_; }
-
- //! Returns the thrown error message as a c-style string.
- virtual const char* what( void ) const throw() { return message_.c_str(); }
+ virtual const std::string getMessage(void) const
+ { return std::string(what()); }
protected:
- std::string message_;
Type type_;
};
};
//! A static function to determine the current RtAudio version.
- static std::string getVersion( void ) throw();
+ static std::string getVersion( void );
//! A static function to determine the available compiled audio APIs.
/*!
the enumerated list values. Note that there can be more than one
API compiled for certain operating systems.
*/
- static void getCompiledApi( std::vector<RtAudio::Api> &apis ) throw();
+ static void getCompiledApi( std::vector<RtAudio::Api> &apis );
//! The class constructor.
/*!
If a stream is running or open, it will be stopped and closed
automatically.
*/
- ~RtAudio() throw();
+ ~RtAudio();
//! Returns the audio API specifier for the current instance of RtAudio.
- RtAudio::Api getCurrentApi( void ) throw();
+ RtAudio::Api getCurrentApi( void );
//! A public function that queries for the number of audio devices available.
/*!
is called, thus supporting devices connected \e after instantiation. If
a system error occurs during processing, a warning will be issued.
*/
- unsigned int getDeviceCount( void ) throw();
+ unsigned int getDeviceCount( void );
//! Return an RtAudio::DeviceInfo structure for a specified device number.
/*!
client's responsibility to verify that a device is available
before attempting to open a stream.
*/
- unsigned int getDefaultOutputDevice( void ) throw();
+ unsigned int getDefaultOutputDevice( void );
//! A function that returns the index of the default input device.
/*!
client's responsibility to verify that a device is available
before attempting to open a stream.
*/
- unsigned int getDefaultInputDevice( void ) throw();
+ unsigned int getDefaultInputDevice( void );
//! A public function for opening a stream with the specified parameters.
/*!
If a stream is not open, this function issues a warning and
returns (no exception is thrown).
*/
- void closeStream( void ) throw();
+ void closeStream( void );
//! A function that starts a stream.
/*!
void abortStream( void );
//! Returns true if a stream is open and false if not.
- bool isStreamOpen( void ) const throw();
+ bool isStreamOpen( void ) const;
//! Returns true if the stream is running and false if it is stopped or not open.
- bool isStreamRunning( void ) const throw();
+ bool isStreamRunning( void ) const;
//! Returns the number of elapsed seconds since the stream was started.
/*!
unsigned int getStreamSampleRate( void );
//! Specify whether warning messages should be printed to stderr.
- void showWarnings( bool value = true ) throw();
+ void showWarnings( bool value = true );
protected:
// Default constructor.
CallbackInfo()
- :object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false) {}
+ :object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false), priority(0) {}
};
// **************************************************************** //
//
// **************************************************************** //
-inline RtAudio::Api RtAudio :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
-inline unsigned int RtAudio :: getDeviceCount( void ) throw() { return rtapi_->getDeviceCount(); }
+inline RtAudio::Api RtAudio :: getCurrentApi( void ) { return rtapi_->getCurrentApi(); }
+inline unsigned int RtAudio :: getDeviceCount( void ) { return rtapi_->getDeviceCount(); }
inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); }
-inline unsigned int RtAudio :: getDefaultInputDevice( void ) throw() { return rtapi_->getDefaultInputDevice(); }
-inline unsigned int RtAudio :: getDefaultOutputDevice( void ) throw() { return rtapi_->getDefaultOutputDevice(); }
-inline void RtAudio :: closeStream( void ) throw() { return rtapi_->closeStream(); }
+inline unsigned int RtAudio :: getDefaultInputDevice( void ) { return rtapi_->getDefaultInputDevice(); }
+inline unsigned int RtAudio :: getDefaultOutputDevice( void ) { return rtapi_->getDefaultOutputDevice(); }
+inline void RtAudio :: closeStream( void ) { return rtapi_->closeStream(); }
inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); }
inline void RtAudio :: stopStream( void ) { return rtapi_->stopStream(); }
inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); }
-inline bool RtAudio :: isStreamOpen( void ) const throw() { return rtapi_->isStreamOpen(); }
-inline bool RtAudio :: isStreamRunning( void ) const throw() { return rtapi_->isStreamRunning(); }
+inline bool RtAudio :: isStreamOpen( void ) const { return rtapi_->isStreamOpen(); }
+inline bool RtAudio :: isStreamRunning( void ) const { return rtapi_->isStreamRunning(); }
inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); }
inline unsigned int RtAudio :: getStreamSampleRate( void ) { return rtapi_->getStreamSampleRate(); }
inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); }
inline void RtAudio :: setStreamTime( double time ) { return rtapi_->setStreamTime( time ); }
-inline void RtAudio :: showWarnings( bool value ) throw() { rtapi_->showWarnings( value ); }
+inline void RtAudio :: showWarnings( bool value ) { rtapi_->showWarnings( value ); }
// RtApi Subclass prototypes.
PyObject *callback_func;
} PyRtAudio;
- static PyObject *RtAudioError;
+ static PyObject *RtAudioErrorException;
static int callback(void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
double streamTime, RtAudioStreamStatus status, void *data )
else if(!strcmp(api, "directsound"))
self->dac = new RtAudio(RtAudio::WINDOWS_DS);
}
- catch (RtError &error) {
- PyErr_SetString(RtAudioError, error.getMessage().c_str());
- Py_INCREF(RtAudioError);
+ catch (RtAudioError &error) {
+ PyErr_SetString(RtAudioErrorException, error.getMessage().c_str());
+ Py_INCREF(RtAudioErrorException);
return NULL;
}
self->dac->closeStream();
self->dac->openStream(&oParams, &iParams, self->_format, fs, &bf, &callback, self, &options);
}
- catch ( RtError& error ) {
- PyErr_SetString(RtAudioError, error.getMessage().c_str());
- Py_INCREF(RtAudioError);
+ catch ( RtAudioError& error ) {
+ PyErr_SetString(RtAudioErrorException, error.getMessage().c_str());
+ Py_INCREF(RtAudioErrorException);
return NULL;
}
self->dac->closeStream();
Py_CLEAR(self->callback_func);
}
- catch(RtError &error) {
- PyErr_SetString(RtAudioError, error.getMessage().c_str());
- Py_INCREF(RtAudioError);
+ catch(RtAudioError &error) {
+ PyErr_SetString(RtAudioErrorException, error.getMessage().c_str());
+ Py_INCREF(RtAudioErrorException);
return NULL;
}
try {
self->dac->startStream();
}
- catch(RtError &error) {
- PyErr_SetString(RtAudioError, error.getMessage().c_str());
- Py_INCREF(RtAudioError);
+ catch(RtAudioError &error) {
+ PyErr_SetString(RtAudioErrorException, error.getMessage().c_str());
+ Py_INCREF(RtAudioErrorException);
return NULL;
}
try {
self->dac->stopStream();
}
- catch(RtError &error) {
- PyErr_SetString(RtAudioError, error.getMessage().c_str());
- Py_INCREF(RtAudioError);
+ catch(RtAudioError &error) {
+ PyErr_SetString(RtAudioErrorException, error.getMessage().c_str());
+ Py_INCREF(RtAudioErrorException);
return NULL;
}
try {
self->dac->abortStream();
}
- catch(RtError &error) {
- PyErr_SetString(RtAudioError, error.getMessage().c_str());
- Py_INCREF(RtAudioError);
+ catch(RtAudioError &error) {
+ PyErr_SetString(RtAudioErrorException, error.getMessage().c_str());
+ Py_INCREF(RtAudioErrorException);
return NULL;
}
Py_RETURN_NONE;
return info_dict;
}
- catch(RtError &error) {
- PyErr_SetString(RtAudioError, error.getMessage().c_str());
- Py_INCREF(RtAudioError);
+ catch(RtAudioError &error) {
+ PyErr_SetString(RtAudioErrorException, error.getMessage().c_str());
+ Py_INCREF(RtAudioErrorException);
return NULL;
}
}
Py_INCREF(&RtAudio_type);
PyModule_AddObject(module, "RtAudio", (PyObject *)&RtAudio_type);
- RtAudioError = PyErr_NewException("rtaudio.RtError", NULL, NULL);
- Py_INCREF(RtAudioError);
- PyModule_AddObject(module, "RtError", RtAudioError);
+ RtAudioErrorException = PyErr_NewException("rtaudio.RtError", NULL, NULL);
+ Py_INCREF(RtAudioErrorException);
+ PyModule_AddObject(module, "RtError", RtAudioErrorException);
}
}
if OSNAME == 'Linux':
define_macros=[("__LINUX_ALSA__", ''),
- ('__LINUX_JACK__', ''),
- ('__LINUX_OSS__', '')]
+ ('__LINUX_JACK__', '')]
libraries = ['asound', 'jack', 'pthread']
elif OSNAME == 'Darwin':
<TD>RtApiCore</TD>
<TD>__MACOSX_CORE__</TD>
<TD><TT>pthread, CoreAudio</TT></TD>
- <TD><TT>g++ -Wall -D__MACOSX_CORE__ -o audioprobe audioprobe.cpp RtAudio.cpp -framework CoreAudio -lpthread</TT></TD>
+ <TD><TT>g++ -Wall -D__MACOSX_CORE__ -o audioprobe audioprobe.cpp RtAudio.cpp -framework CoreAudio -framework CoreFoundation -lpthread</TT></TD>
</TR>
<TR>
<TD>Windows</TD>
if ( status )
std::cout << "Stream underflow detected!" << std::endl;
- float increment;
+ double increment;
for ( j=0; j<channels; j++ ) {
increment = BASE_RATE * (j+1+(j*0.1));
for ( i=0; i<nBufferFrames; i++ ) {
if ( status ) std::cout << "Stream over/underflow detected!" << std::endl;\r
\r
for ( i=0; i<nBufferFrames; i++ ) {\r
- if ( data->frameCounter % data->pulseCount == 0 ) sample = 0.9;\r
+ if ( data->frameCounter % data->pulseCount == 0 ) sample = 0.9f;\r
else sample = 0.0;\r
for ( j=0; j<data->channels; j++ )\r
*buffer++ = sample;\r
// Let RtAudio print messages to stderr.\r
adc->showWarnings( true );\r
\r
- runtime = RUNTIME * 1000;\r
- pausetime = PAUSETIME * 1000;\r
+ runtime = static_cast<unsigned int>(RUNTIME * 1000);\r
+ pausetime = static_cast<unsigned int>(PAUSETIME * 1000);\r
\r
// Set our stream parameters for a duplex stream.\r
bufferFrames = 512;\r
oParams.deviceId = adc->getDefaultOutputDevice();\r
\r
// First, test external stopStream() calls.\r
- mydata.pulseCount = PULSE_RATE * fs;\r
+ mydata.pulseCount = static_cast<unsigned int>(PULSE_RATE * fs);\r
mydata.nFrames = 50 * fs;\r
mydata.returnValue = 0;\r
try {\r