if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ){\r
switch( osVersionInfoEx.dwMinorVersion ){\r
case 0: osName = "Windows 95"; break;\r
- case 10: osName = "Windows 98"; break; // could also be SE (code I saw discriminated on osInfo.Version.Revision.ToString() == "2222A")\r
+ case 10: osName = "Windows 98"; break; // could also be 98SE (I've seen code discriminate based \r
+ // on osInfo.Version.Revision.ToString() == "2222A")\r
case 90: osName = "Windows Me"; break;\r
}\r
}else if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT ){\r
\r
\r
fprintf( fp, "OS name and edition: %s %s\n", osName, osProductType );\r
- fprintf( fp, "OS version: %d.%d.%d %S\n", osVersionInfoEx.dwMajorVersion, osVersionInfoEx.dwMinorVersion, osVersionInfoEx.dwBuildNumber, osVersionInfoEx.szCSDVersion );\r
+ fprintf( fp, "OS version: %d.%d.%d %S\n", \r
+ osVersionInfoEx.dwMajorVersion, osVersionInfoEx.dwMinorVersion, \r
+ osVersionInfoEx.dwBuildNumber, osVersionInfoEx.szCSDVersion );\r
fprintf( fp, "Processor architecture: %s\n", processorArchitecture );\r
fprintf( fp, "WoW64 process: %s\n", IsWow64() ? "Yes" : "No" );\r
}\r
{\r
float sine[TABLE_SIZE];\r
double phase;\r
+ double phaseIncrement;\r
volatile int fadeIn;\r
volatile int fadeOut;\r
double amp;\r
for( i=0; i<framesPerBuffer; i++ )\r
{\r
float x = data->sine[(int)data->phase];\r
- data->phase += 20;\r
+ data->phase += data->phaseIncrement;\r
if( data->phase >= TABLE_SIZE ){\r
data->phase -= TABLE_SIZE;\r
}\r
#define NO 0\r
\r
\r
-static int playUntilKeyPress( int deviceIndex, float sampleRate, int framesPerUserBuffer, int framesPerWmmeBuffer, int wmmeBufferCount )\r
+static int playUntilKeyPress( int deviceIndex, float sampleRate, \r
+ int framesPerUserBuffer, int framesPerWmmeBuffer, int wmmeBufferCount )\r
{\r
PaStreamParameters outputParameters;\r
PaWinMmeStreamInfo wmmeStreamInfo;\r
data.amp = 0;\r
data.fadeIn = 1;\r
data.fadeOut = 0;\r
+ data.phase = 0;\r
+ data.phaseIncrement = 15 + ((rand()%100) / 10); // randomise pitch\r
\r
err = Pa_StartStream( stream );\r
if( err != paNoError ) goto error;\r
\r
\r
do{\r
- printf( "Trying buffer size %d.\nIf it sounds smooth press 'y', if it sounds bad press 'n' ('q' to quit)\n", framesPerWmmeBuffer );\r
+ printf( "Trying buffer size %d.\nIf it sounds smooth (without clicks or glitches) press 'y', if it sounds bad press 'n' ('q' to quit)\n", framesPerWmmeBuffer );\r
c = tolower(_getch());\r
if( c == 'q' ){\r
Pa_Terminate();\r
fprintf( stderr, "Invalid device index. Use one of these:\n" );\r
for( i=0; i < Pa_GetDeviceCount(); ++i ){\r
\r
- if( Pa_GetDeviceInfo(i)->hostApi == wmmeHostApiIndex && Pa_GetDeviceInfo(i)->maxOutputChannels > 0 )\r
+ if( Pa_GetDeviceInfo(i)->hostApi == wmmeHostApiIndex && Pa_GetDeviceInfo(i)->maxOutputChannels > 0 )\r
fprintf( stderr, "%d (%s)\n", i, Pa_GetDeviceInfo(i)->name );\r
}\r
Pa_Terminate();\r
}\r
\r
/*\r
- TODO: test at 22050 44100, 48000, 96000, mono and stereo and surround\r
-\r
- TODO: could be testing with 80% CPU load\r
-\r
- another thing to try would be setting the timeBeginPeriod granularity to 1ms and see if it changes the behavior\r
+ ideas: \r
+ o- could be testing with 80% CPU load\r
+ o- could test with different channel counts\r
*/\r
\r
int main(int argc, char* argv[])\r
fprintf( resultsFp, "Sample rate: %f\n", (float)sampleRate );\r
fprintf( resultsFp, "Buffer count, Smallest working buffer size (frames), Smallest working buffering latency (frames), Smallest working buffering latency (Seconds)\n" );\r
\r
- for( wmmeBufferCount = wmmeMinBufferCount; wmmeBufferCount <= wmmeMaxBufferCount; ++wmmeBufferCount ){ // TODO print out range we're going to try before starting\r
+ for( wmmeBufferCount = wmmeMinBufferCount; wmmeBufferCount <= wmmeMaxBufferCount; ++wmmeBufferCount ){\r
\r
printf( "Test %d of %d\n", (wmmeBufferCount - wmmeMinBufferCount) + 1, (wmmeMaxBufferCount-wmmeMinBufferCount) + 1 );\r
printf( "Testing with %d buffers...\n", wmmeBufferCount );\r