Mac: test adjustable number of channels.
This commit is contained in:
parent
110043f842
commit
315309f60e
5 changed files with 74 additions and 74 deletions
|
|
@ -46,8 +46,8 @@
|
|||
#include <math.h>
|
||||
#include "portaudio.h"
|
||||
|
||||
#define MAX_SINES (500)
|
||||
#define MAX_USAGE (0.8)
|
||||
#define MAX_SINES (2000)
|
||||
#define MAX_USAGE (0.5)
|
||||
#define SAMPLE_RATE (44100)
|
||||
#define FREQ_TO_PHASE_INC(freq) (freq/(float)SAMPLE_RATE)
|
||||
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
#endif
|
||||
#define TWOPI (M_PI * 2.0)
|
||||
|
||||
#define TABLE_SIZE (512)
|
||||
#define TABLE_SIZE (1024)
|
||||
|
||||
typedef struct paTestData
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@ typedef struct paTestData
|
|||
}
|
||||
paTestData;
|
||||
|
||||
/* Convert phase between and 1.0 to sine value
|
||||
/* Convert phase between 0.0 and 1.0 to sine value
|
||||
* using linear interpolation.
|
||||
*/
|
||||
float LookupSine( paTestData *data, float phase );
|
||||
|
|
@ -187,14 +187,14 @@ int main(void)
|
|||
|
||||
/* Play an increasing number of sine waves until we hit MAX_USAGE */
|
||||
do {
|
||||
data.numSines++;
|
||||
data.numSines += 10;
|
||||
Pa_Sleep(200);
|
||||
load = Pa_GetStreamCpuLoad(stream);
|
||||
printf("numSines = %d, CPU load = %f\n", data.numSines, load );
|
||||
fflush(stdout);
|
||||
} while((load < MAX_USAGE) && (data.numSines < MAX_SINES));
|
||||
|
||||
Pa_Sleep(2000); /* Stay for 2 seconds around 80% CPU. */
|
||||
Pa_Sleep(2000); /* Stay for 2 seconds at max CPU. */
|
||||
|
||||
err = Pa_StopStream( stream );
|
||||
if( err != paNoError )
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
#include "portaudio.h"
|
||||
|
||||
#define SAMPLE_RATE (44100)
|
||||
#define FRAMES_PER_BUFFER (256)
|
||||
#define FRAMES_PER_BUFFER (128)
|
||||
#define FREQ_INCR (300.0 / SAMPLE_RATE)
|
||||
#define MAX_CHANNELS (64)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue