#include "core/types.h"
#include "macros.h"
#include <pulse/pulseaudio.h>
#include <pulse/simple.h>
Go to the source code of this file.
|
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.
|
|
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.
|
|
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.
|
|
◆ free_wave_settings()
Free the wave_settings structure.
- Parameters
-
[in,out] | wave_ss | The pointer to the wave_settings |
◆ generate_wave()
Generate a waveform inside of a buffer based on a frequency, rate, wave type and duty_cycle.
- Parameters
-
[in,out] | buf | A pointer to the sound buffer |
[in] | size | The size of the buffer |
[in] | wave_ss | The sound settings of the wave |
- Returns
- 0 if no error
◆ generate_wave_settings()
Allocate a wave settings structure and return its pointers.
- Parameters
-
[in] | frequency | The frequency of the wave |
[in] | sample_rate | The sample rate of the wave |
[in] | volume | The volume of the sound wave (also called amplitude) |
[in] | duty_cycle | The duty_cycle of the wave (only used for Rectangle waveforms) |
[in] | wave_type | The type of the wave |
- Returns
- The pointer to the allocated settings
◆ play_sound()
Play a sound based on a sound buffer, a sound interface and a the buffer size.
- Parameters
-
[in] | buf | A pointer to the sound buffer |
[in] | s | A pointer to the sound interface |
[in] | size | The size of the sound buffer |
- Returns
- 0 if no error, 1 if pa_simple_write failed