Preliminary sound

This commit is contained in:
Edith Boles
2026-03-05 22:36:58 -08:00
parent 3b8e70c524
commit 4cfa24e4a6
12 changed files with 96409 additions and 13 deletions

View File

@@ -2,7 +2,7 @@
API := x11
CFLAGS := -MD -Wall -g -lm -pthread -I ./inc/
CFLAGS := -MD -Wall -g -lm -lpthread -ldl -I ./inc/
ifeq ($(API), arm)
CC := arm-cortexa9_neon-linux-gnueabihf-gcc
@@ -12,7 +12,7 @@ else
CFLAGS := $(CFLAGS) -lX11
endif
TARGETS := pm3-lvgl cvend
TARGETS := pm3-lvgl cvend audio_test
EXES := $(patsubst %,bin/%,$(TARGETS))
SRCS := $(shell find src inc -type f -iname '*.c')
OBJS := $(patsubst src/%.c,obj/%.o,$(patsubst inc/%.c,obj/lib/%.o,$(SRCS)))

502
asound.state Executable file
View File

@@ -0,0 +1,502 @@
state.Audio {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value.0 127
value.1 127
comment {
access 'read write'
type INTEGER
count 2
range '0 - 175'
dbmin -6350
dbmax 2400
dbvalue.0 0
dbvalue.1 0
}
}
control.2 {
iface MIXER
name 'HP Driver Gain Volume'
value.0 6
value.1 6
comment {
access 'read write'
type INTEGER
count 2
range '0 - 35'
dbmin -600
dbmax 2900
dbvalue.0 0
dbvalue.1 0
}
}
control.3 {
iface MIXER
name 'LO Driver Gain Volume'
value.0 6
value.1 6
comment {
access 'read write'
type INTEGER
count 2
range '0 - 35'
dbmin -600
dbmax 2900
dbvalue.0 0
dbvalue.1 0
}
}
control.4 {
iface MIXER
name 'HP DAC Playback Switch'
value.0 false
value.1 false
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.5 {
iface MIXER
name 'LO DAC Playback Switch'
value.0 true
value.1 true
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.6 {
iface MIXER
name 'Mic PGA Switch'
value.0 false
value.1 false
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.7 {
iface MIXER
name 'ADCFGA Left Mute Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.8 {
iface MIXER
name 'ADCFGA Right Mute Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.9 {
iface MIXER
name 'ADC Level Volume'
value.0 24
value.1 24
comment {
access 'read write'
type INTEGER
count 2
range '0 - 64'
dbmin -1200
dbmax 2000
dbvalue.0 0
dbvalue.1 0
}
}
control.10 {
iface MIXER
name 'PGA Level Volume'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 95'
dbmin 0
dbmax 4750
dbvalue.0 0
dbvalue.1 0
}
}
control.11 {
iface MIXER
name 'Auto-mute Switch'
value 0
comment {
access 'read write'
type INTEGER
count 1
range '0 - 7'
}
}
control.12 {
iface MIXER
name 'AGC Left Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.13 {
iface MIXER
name 'AGC Right Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.14 {
iface MIXER
name 'AGC Target Level'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 7'
}
}
control.15 {
iface MIXER
name 'AGC Gain Hysteresis'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 3'
}
}
control.16 {
iface MIXER
name 'AGC Hysteresis'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 3'
}
}
control.17 {
iface MIXER
name 'AGC Noise Threshold'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 31'
}
}
control.18 {
iface MIXER
name 'AGC Max PGA'
value.0 127
value.1 127
comment {
access 'read write'
type INTEGER
count 2
range '0 - 127'
}
}
control.19 {
iface MIXER
name 'AGC Attack Time'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 31'
}
}
control.20 {
iface MIXER
name 'AGC Decay Time'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 31'
}
}
control.21 {
iface MIXER
name 'AGC Noise Debounce'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 31'
}
}
control.22 {
iface MIXER
name 'AGC Signal Debounce'
value.0 0
value.1 0
comment {
access 'read write'
type INTEGER
count 2
range '0 - 15'
}
}
control.23 {
iface MIXER
name 'HPL Output Mixer L_DAC Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.24 {
iface MIXER
name 'HPL Output Mixer IN1_L Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.25 {
iface MIXER
name 'LOL Output Mixer L_DAC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.26 {
iface MIXER
name 'HPR Output Mixer R_DAC Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.27 {
iface MIXER
name 'HPR Output Mixer IN1_R Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.28 {
iface MIXER
name 'LOR Output Mixer R_DAC Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.29 {
iface MIXER
name 'IN1_R to Right Mixer Positive Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.30 {
iface MIXER
name 'IN2_R to Right Mixer Positive Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.31 {
iface MIXER
name 'IN3_R to Right Mixer Positive Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.32 {
iface MIXER
name 'IN2_L to Right Mixer Positive Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.33 {
iface MIXER
name 'IN1_L to Right Mixer Negative Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.34 {
iface MIXER
name 'IN3_L to Right Mixer Negative Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.35 {
iface MIXER
name 'IN1_L to Left Mixer Positive Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.36 {
iface MIXER
name 'IN2_L to Left Mixer Positive Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.37 {
iface MIXER
name 'IN3_L to Left Mixer Positive Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.38 {
iface MIXER
name 'IN1_R to Left Mixer Positive Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.39 {
iface MIXER
name 'IN2_R to Left Mixer Negative Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
control.40 {
iface MIXER
name 'IN3_R to Left Mixer Negative Resistor'
value Off
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Off
item.1 '10 kOhm'
item.2 '20 kOhm'
item.3 '40 kOhm'
}
}
}

BIN
assets/hop_adult.wav Normal file

Binary file not shown.

BIN
assets/hop_reduced.wav Normal file

Binary file not shown.

BIN
assets/hop_success.aup3 Normal file

Binary file not shown.

BIN
assets/hop_success.aup3-shm Normal file

Binary file not shown.

BIN
assets/hop_success.aup3-wal Normal file

Binary file not shown.

95864
inc/miniaudio/miniaudio.h Normal file

File diff suppressed because it is too large Load Diff

23
src/audio_test.c Normal file
View File

@@ -0,0 +1,23 @@
#include "miniaudio/miniaudio.h"
#include <stdio.h>
int main()
{
ma_result result;
ma_engine engine;
result = ma_engine_init(NULL, &engine);
if (result != MA_SUCCESS) {
return -1;
}
ma_engine_play_sound(&engine, "assets/hop_adult.wav", NULL);
printf("Press Enter to quit...");
getchar();
ma_engine_uninit(&engine);
return 0;
}

View File

@@ -1,7 +1,6 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "crc8.h"
#include "crc32.h"
@@ -43,8 +42,10 @@ enum message_type {
MTYPE_SAM_CTRL = 0xb6,
MTYPE_SAM_CTRL_REPLY = 0xb7,
MTYPE_DESFIRE_READ = 0xb9,
MTYPE_DESFIRE_INTERACT = 0xbc,
MTYPE_DESFIRE_INTERACT_REPLY = 0xbd,
MTYPE_DESFIRE_STATUS = 0xba,
MTYPE_DESFIRE_STATUS_REPLY = 0xbb,
MTYPE_DESFIRE_COMMAND = 0xbc,
MTYPE_DESFIRE_COMMAND_REPLY = 0xbd,
MTYPE_UNHANDLED_CARD = 0xbe,
MTYPE_EMV = 0xd0,
MTYPE_EMV_STATUS = 0xd1,
@@ -155,10 +156,14 @@ const char *stringify_msg_type(uint8_t msg_type)
return "MTYPE_SECURITY_SERVICES";
case MTYPE_SECURITY_SERVICES_REPLY:
return "MTYPE_SECURITY_SERVICES_REPLY";
case MTYPE_DESFIRE_INTERACT:
return "MTYPE_DESFIRE_INTERACT";
case MTYPE_DESFIRE_INTERACT_REPLY:
return "MTYPE_DESFIRE_INTERACT_REPLY";
case MTYPE_DESFIRE_STATUS:
return "MTYPE_DESFIRE_STATUS";
case MTYPE_DESFIRE_STATUS_REPLY:
return "MTYPE_DESFIRE_STATUS_REPLY";
case MTYPE_DESFIRE_COMMAND:
return "MTYPE_DESFIRE_COMMAND";
case MTYPE_DESFIRE_COMMAND_REPLY:
return "MTYPE_DESFIRE_COMMAND_REPLY";
case MTYPE_LOG:
return "MTYPE_LOG";
default:
@@ -294,16 +299,16 @@ int main(int argc, char *argv[])
if (packet->msg_type == MTYPE_DESFIRE_READ) {
//cvend_write(file, MTYPE_DESFIRE_INTERACT, desfire_get_version, 1);
cvend_write(file, MTYPE_DESFIRE_INTERACT, desfire_select_application, 4);
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_select_application, 4);
cvend_packet *response;
do {
response = cvend_read(file);
} while (!response);
print_packet(response);
cvend_write(file, MTYPE_DESFIRE_INTERACT, desfire_fid_list, 1);
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_fid_list, 1);
cvend_free(response);
cvend_write(file, MTYPE_DESFIRE_INTERACT, desfire_read, 8);
cvend_write(file, MTYPE_DESFIRE_INTERACT, desfire_free, 1);
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_read, 8);
cvend_write(file, MTYPE_DESFIRE_COMMAND, desfire_free, 1);
}
cvend_free(packet);

View File

@@ -0,0 +1,2 @@
#define MINIAUDIO_IMPLEMENTATION
#include "miniaudio/miniaudio.h"