PancakeNESEmu
A homebrewed NES Emulator written in C
Loading...
Searching...
No Matches
apu.h
Go to the documentation of this file.
1#ifndef apu_h
2#define apu_h
3
4#include "core/types.h"
5#include "macros.h"
6
7#include <pulse/pulseaudio.h>
8#include <pulse/simple.h>
9
17
27wave_settings_t* generate_wave_settings(float frequency, float sample_rate, unsigned int volume,
28 duty_cycle_t duty_cycle, wave_t wave_type);
29
35
44errcode_t generate_wave(sbuffer_t* buf, size_t size, wave_settings_t* wave_ss);
45
53errcode_t play_sound(sbuffer_t* buf, pa_simple* s, size_t size);
54
55#endif // !apu_h
errcode_t play_sound(sbuffer_t *buf, pa_simple *s, size_t size)
Play a sound based on a sound buffer, a sound interface and a the buffer size.
void free_wave_settings(wave_settings_t *wave_ss)
Free the wave_settings structure.
errcode_t generate_wave(sbuffer_t *buf, size_t size, wave_settings_t *wave_ss)
Generate a waveform inside of a buffer based on a frequency, rate, wave type and duty_cycle.
wave_settings_t * generate_wave_settings(float frequency, float sample_rate, unsigned int volume, duty_cycle_t duty_cycle, wave_t wave_type)
Allocate a wave settings structure and return its pointers.
wave_t wave_type
Definition apu.h:15
unsigned int volume
Definition apu.h:13
duty_cycle_t duty_cycle
Definition apu.h:14
float frequency
Definition apu.h:11
float sample_rate
Definition apu.h:12
byte errcode_t
Definition of the error code type used by some function.
Definition types.h:15
float duty_cycle_t
Definition of the duty cycle used by the APU.
Definition types.h:17
int16_t sbuffer_t
Definition of the sound buffer type used by the APU.
Definition types.h:14
wave_t
Definition types.h:19