feat(include/audio): Add sound configuration loading and extended sound pack structures

Introduce API to load sound configurations and expand SoundPack with richer audio data for multi‑key mappings and generic press handling, enabling more flexible audio management.

New Features
- Added `load_sound_config` prototype in `include/audio/config.h`.

Enhancements
- Extended `SoundPack` with generic press arrays, release data fields, and multi‑key mapping structs.
- Added `AudioVoice` struct and `MAX_MIXER_VOICES` for voice management.
- Added `generic_press_data`, `generic_press_samples`, `release_data`, and `release_samples` fields.
This commit is contained in:
sankalp committed 2026-02-22 02:35:11 +05:45
1 parent f7a2a7270b
commit a776be0bf3
2 files changed
+28

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
#ifndef VBX_AUDIO_CONFIG_H
#define VBX_AUDIO_CONFIG_H
#include "audio/types.h"
int load_sound_config(const char *config_path, SoundPack *pack);
#endif // VBX_AUDIO_CONFIG_H
+20
View File
@@ -8,23 +8,43 @@
typedef struct {
int start_ms;
int duration_ms;
short *pcm_data;
uint32_t num_samples;
} SoundMapping;
typedef struct {
char press_file[256];
char release_file[256];
char generic_press_files[5][256];
short *generic_press_data[5];
uint32_t generic_press_samples[5];
int num_generic_press_files;
char sound_file[256];
short *release_data;
uint32_t release_samples;
SoundMapping key_mappings[512];
struct {
char *press;
char *release;
short *press_data;
uint32_t press_samples;
short *release_data;
uint32_t release_samples;
} multi_key_mappings[512];
int is_multi;
SF_INFO sf_info;
} SoundPack;
typedef struct {
short *data;
uint32_t total_samples;
uint32_t current_pos;
float volume;
int active;
} AudioVoice;
#define MAX_MIXER_VOICES 32
typedef struct {
int key_code;
int thread_id;