diff options
| author | Tharo <17233964+Thar0@users.noreply.github.com> | 2024-08-11 16:41:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-11 17:41:33 +0200 |
| commit | fc79632df87bfd11796cc7ca34b41d44e01319fc (patch) | |
| tree | a4ef7194dd9117e8c801437fdbe6122d2c7b39a8 /Makefile | |
| parent | 8366b8731e27c28a18e3431cdda561d8661753f0 (diff) | |
[Audio 3/?] Set up building samples (#2024)
* [Audio 3/?] Set up building samples
* AIFF -> SAMPLE
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -233,6 +233,7 @@ SPEC_REPLACE_VARS := sed -e 's|$$(BUILD_DIR)|$(BUILD_DIR)|g' # Audio tools AUDIO_EXTRACT := $(PYTHON) tools/audio_extraction.py +SAMPLECONV := tools/audio/sampleconv/sampleconv CFLAGS += $(CPP_DEFINES) CPPFLAGS += $(CPP_DEFINES) @@ -298,6 +299,22 @@ else SRC_DIRS := $(shell find src -type d) endif +ifneq ($(wildcard $(EXTRACTED_DIR)/assets/audio),) + SAMPLE_EXTRACT_DIRS := $(shell find $(EXTRACTED_DIR)/assets/audio/samples -type d) +else + SAMPLE_EXTRACT_DIRS := +endif + +ifneq ($(wildcard assets/audio/samples),) + SAMPLE_DIRS := $(shell find assets/audio/samples -type d) +else + SAMPLE_DIRS := +endif + +SAMPLE_FILES := $(foreach dir,$(SAMPLE_DIRS),$(wildcard $(dir)/*.wav)) +SAMPLE_EXTRACT_FILES := $(foreach dir,$(SAMPLE_EXTRACT_DIRS),$(wildcard $(dir)/*.wav)) +AIFC_FILES := $(foreach f,$(SAMPLE_FILES),$(BUILD_DIR)/$(f:.wav=.aifc)) $(foreach f,$(SAMPLE_EXTRACT_FILES:.wav=.aifc),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) + # create extracted directories $(shell mkdir -p $(EXTRACTED_DIR) $(EXTRACTED_DIR)/assets $(EXTRACTED_DIR)/text) @@ -644,6 +661,30 @@ $(BUILD_DIR)/assets/%.jpg.inc.c: assets/%.jpg $(BUILD_DIR)/assets/%.jpg.inc.c: $(EXTRACTED_DIR)/assets/%.jpg $(ZAPD) bren -eh -i $< -o $@ +# Audio + +AUDIO_BUILD_DEBUG ?= 0 + +# first build samples... + +$(BUILD_DIR)/assets/audio/samples/%.half.aifc: assets/audio/samples/%.half.wav + $(SAMPLECONV) vadpcm-half $< $@ + +$(BUILD_DIR)/assets/audio/samples/%.half.aifc: $(EXTRACTED_DIR)/assets/audio/samples/%.half.wav + $(SAMPLECONV) vadpcm-half $< $@ +ifeq ($(AUDIO_BUILD_DEBUG),1) + @(cmp $(<D)/aifc/$(<F:.half.wav=.half.aifc) $@ && echo "$(<F) OK") || (mkdir -p NONMATCHINGS/$(<D) && cp $(<D)/aifc/$(<F:.half.wav=.half.aifc) NONMATCHINGS/$(<D)/$(<F:.half.wav=.half.aifc)) +endif + +$(BUILD_DIR)/assets/audio/samples/%.aifc: assets/audio/samples/%.wav + $(SAMPLECONV) vadpcm $< $@ + +$(BUILD_DIR)/assets/audio/samples/%.aifc: $(EXTRACTED_DIR)/assets/audio/samples/%.wav + $(SAMPLECONV) vadpcm $< $@ +ifeq ($(AUDIO_BUILD_DEBUG),1) + @(cmp $(<D)/aifc/$(<F:.wav=.aifc) $@ && echo "$(<F) OK") || (mkdir -p NONMATCHINGS/$(<D) && cp $(<D)/aifc/$(<F:.wav=.aifc) NONMATCHINGS/$(<D)/$(<F:.wav=.aifc)) +endif + -include $(DEP_FILES) # Print target for debugging |
