#define MUTEX_DESTROY(A) DeleteCriticalSection(A)\r
#define MUTEX_LOCK(A) EnterCriticalSection(A)\r
#define MUTEX_UNLOCK(A) LeaveCriticalSection(A)\r
+\r
+ #include "tchar.h"\r
+\r
+ static std::string convertCharPointerToStdString(const char *text)\r
+ {\r
+ return std::string(text);\r
+ }\r
+\r
+ static std::string convertCharPointerToStdString(const wchar_t *text)\r
+ {\r
+ int length = WideCharToMultiByte(CP_UTF8, 0, text, -1, NULL, 0, NULL, NULL);\r
+ std::string s( length-1, '\0' );\r
+ WideCharToMultiByte(CP_UTF8, 0, text, -1, &s[0], length, NULL, NULL);\r
+ return s;\r
+ }\r
+\r
#elif defined(__LINUX_ALSA__) || defined(__LINUX_PULSE__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__)\r
// pthread API\r
#define MUTEX_INITIALIZE(A) pthread_mutex_init(A, NULL)\r
float sampleStep = 1.0f / sampleRatio;\r
float inSampleFraction = 0.0f;\r
\r
- outSampleCount = ( unsigned int ) ( inSampleCount * sampleRatio );\r
+ outSampleCount = ( unsigned int ) 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
RtAudio::DeviceInfo info;\r
unsigned int captureDeviceCount = 0;\r
unsigned int renderDeviceCount = 0;\r
- std::wstring deviceName;\r
std::string defaultDeviceName;\r
bool isCaptureDevice = false;\r
\r
goto Exit;\r
}\r
\r
- deviceName = defaultDeviceNameProp.pwszVal;\r
- defaultDeviceName = std::string( deviceName.begin(), deviceName.end() );\r
+ defaultDeviceName = convertCharPointerToStdString(defaultDeviceNameProp.pwszVal);\r
\r
// name\r
hr = devicePtr->OpenPropertyStore( STGM_READ, &devicePropStore );\r
goto Exit;\r
}\r
\r
- deviceName = deviceNameProp.pwszVal;\r
- info.name = std::string( deviceName.begin(), deviceName.end() );\r
+ info.name =convertCharPointerToStdString(deviceNameProp.pwszVal);\r
\r
// is default\r
if ( isCaptureDevice ) {\r
return 0;\r
}\r
\r
-#include "tchar.h"\r
-\r
-static std::string convertTChar( LPCTSTR name )\r
-{\r
-#if defined( UNICODE ) || defined( _UNICODE )\r
- int length = WideCharToMultiByte(CP_UTF8, 0, name, -1, NULL, 0, NULL, NULL);\r
- std::string s( length-1, '\0' );\r
- WideCharToMultiByte(CP_UTF8, 0, name, -1, &s[0], length, NULL, NULL);\r
-#else\r
- std::string s( name );\r
-#endif\r
-\r
- return s;\r
-}\r
-\r
static BOOL CALLBACK deviceQueryCallback( LPGUID lpguid,\r
LPCTSTR description,\r
LPCTSTR /*module*/,\r
}\r
\r
// If good device, then save its name and guid.\r
- std::string name = convertTChar( description );\r
+ std::string name = convertCharPointerToStdString( description );\r
//if ( name == "Primary Sound Driver" || name == "Primary Sound Capture Driver" )\r
if ( lpguid == NULL )\r
name = "Default Device";\r