irmc/src/beep.h

33 lines
609 B
C
Raw Normal View History

2016-10-04 12:20:09 -04:00
#include <stdio.h>
2015-07-08 17:24:41 -04:00
#include <math.h>
2016-10-04 12:20:09 -04:00
#include "portaudio.h"
2015-07-08 17:24:41 -04:00
#define NUM_SECONDS (5)
2016-10-04 12:20:09 -04:00
#define SAMPLE_RATE (44100)
2015-07-08 17:24:41 -04:00
#define FRAMES_PER_BUFFER (64)
#ifndef M_PI
#define M_PI (3.14159265)
#endif
typedef struct
{
2016-10-03 10:13:59 -04:00
uint32_t total_count;
uint32_t up_count;
2016-09-23 16:32:24 -04:00
2016-10-03 10:13:59 -04:00
uint32_t counter;
uint32_t prev_freq;
uint32_t freq;
} paTestData;
2015-07-08 17:24:41 -04:00
2016-10-03 10:13:59 -04:00
void buzzer_set_freq(int frequency);
void buzzer_beep(int frequency, int msecs);
int buzzer_start(void);
int buzzer_stop();
void msleep(int d);
int beep_test(void);
2016-10-04 10:41:45 -04:00
2016-10-03 10:13:59 -04:00
// compatibility to old interface
int beep(double freq_hz, double duration_sec);
int beep_init();