PortAudio 2.0
patest_sine_formats.c File Reference

Play a sine wave for several seconds. Test various data formats. More...

#include <stdio.h>
#include <math.h>
#include "portaudio.h"

Data Structures

struct  paTestData
 

Macros

#define NUM_SECONDS   (10)
 
#define SAMPLE_RATE   (44100)
 
#define FRAMES_PER_BUFFER   (512)
 
#define LEFT_FREQ   (SAMPLE_RATE/256.0) /* So we hit 1.0 */
 
#define RIGHT_FREQ   (500.0)
 
#define AMPLITUDE   (1.0)
 
#define TEST_UINT8   (0)
 
#define TEST_INT8   (0)
 
#define TEST_INT16   (1)
 
#define TEST_FLOAT32   (0)
 
#define TEST_FORMAT   paInt16
 
#define SAMPLE_ZERO   (0)
 
#define DOUBLE_TO_SAMPLE(x)
 
#define FORMAT_NAME   "Signed 16 Bit"
 
#define M_PI   (3.14159265)
 

Typedefs

typedef short SAMPLE_t
 

Functions

int main (void)
 

Detailed Description

Play a sine wave for several seconds. Test various data formats.

Author
Phil Burk

Macro Definition Documentation

◆ AMPLITUDE

#define AMPLITUDE   (1.0)

◆ DOUBLE_TO_SAMPLE

#define DOUBLE_TO_SAMPLE ( x)
Value:
(SAMPLE_ZERO + (SAMPLE_t)(32767 * (x)))
#define SAMPLE_ZERO
Definition patest_sine_formats.c:77
short SAMPLE_t
Definition patest_sine_formats.c:76

◆ FORMAT_NAME

#define FORMAT_NAME   "Signed 16 Bit"

Referenced by main().

◆ FRAMES_PER_BUFFER

#define FRAMES_PER_BUFFER   (512)

Referenced by main().

◆ LEFT_FREQ

#define LEFT_FREQ   (SAMPLE_RATE/256.0) /* So we hit 1.0 */

◆ M_PI

#define M_PI   (3.14159265)

◆ NUM_SECONDS

#define NUM_SECONDS   (10)

Referenced by main().

◆ RIGHT_FREQ

#define RIGHT_FREQ   (500.0)

◆ SAMPLE_RATE

#define SAMPLE_RATE   (44100)

Referenced by main().

◆ SAMPLE_ZERO

#define SAMPLE_ZERO   (0)

◆ TEST_FLOAT32

#define TEST_FLOAT32   (0)

◆ TEST_FORMAT

#define TEST_FORMAT   paInt16

Referenced by main().

◆ TEST_INT16

#define TEST_INT16   (1)

◆ TEST_INT8

#define TEST_INT8   (0)

◆ TEST_UINT8

#define TEST_UINT8   (0)

Typedef Documentation

◆ SAMPLE_t

typedef short SAMPLE_t

Function Documentation

◆ main()