mirror of
https://github.com/pret/pokeruby.git
synced 2025-01-19 11:12:26 +00:00
Output .bin file for direct sound metadata (loop point, pitch adust, and number of samples). This was needed since we couldn't incbin a string argument in a macro.
This commit is contained in:
parent
fe1fad3aa5
commit
001e1c77b8
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,6 +13,7 @@
|
||||
*.latfont
|
||||
*.hwjpnfont
|
||||
*.fwjpnfont
|
||||
data/music/direct_sound_samples/*.bin
|
||||
pokeas
|
||||
pokeld
|
||||
pokeobjcopy
|
||||
|
3
Makefile
3
Makefile
@ -31,7 +31,7 @@ PREPROC := tools/preproc/preproc
|
||||
# Secondary expansion is required for dependency variables in object rules.
|
||||
.SECONDEXPANSION:
|
||||
|
||||
.PRECIOUS: %.1bpp %.4bpp %.8bpp %.gbapal %.lz %.rl %.pcm
|
||||
.PRECIOUS: %.1bpp %.4bpp %.8bpp %.gbapal %.lz %.rl %.pcm %.bin
|
||||
|
||||
.PHONY: all clean compare ruby sapphire
|
||||
|
||||
@ -91,6 +91,7 @@ include misc.mk
|
||||
%.lz: % ; $(GFX) $< $@
|
||||
%.rl: % ; $(GFX) $< $@
|
||||
%.pcm: %.aif ; $(AIF) $< $@
|
||||
%.bin: %.aif ; $(AIF) $< $@
|
||||
|
||||
src/libc_ruby.o src/libc_sapphire.o: CC1 := tools/agbcc/bin/old_agbcc
|
||||
src/libc_ruby.o src/libc_sapphire.o: CFLAGS := -O2
|
||||
|
@ -111,17 +111,3 @@
|
||||
.4byte \voice_group_pointer
|
||||
.4byte 0
|
||||
.endm
|
||||
|
||||
.macro directsound_looped pitch_adjust, loop_start_sample_index, num_samples
|
||||
.4byte 0x40000000
|
||||
.4byte \pitch_adjust
|
||||
.4byte \loop_start_sample_index
|
||||
.4byte \num_samples
|
||||
.endm
|
||||
|
||||
.macro directsound_not_looped pitch_adjust, num_samples
|
||||
.4byte 0x0
|
||||
.4byte \pitch_adjust
|
||||
.4byte 0x0
|
||||
.4byte \num_samples
|
||||
.endm
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -228,6 +228,11 @@ void aif2pcm(const char *aif_filename)
|
||||
strcpy(pcm_filename, aif_filename);
|
||||
change_file_extension(pcm_filename, "pcm");
|
||||
|
||||
// Get .metadata filename.
|
||||
char metadata_filename[strlen(aif_filename)];
|
||||
strcpy(metadata_filename, aif_filename);
|
||||
change_file_extension(metadata_filename, "bin");
|
||||
|
||||
// Open the given .aif file so we can read its contents.
|
||||
FILE *aif_file;
|
||||
aif_file = fopen(aif_filename, "rb");
|
||||
@ -264,6 +269,14 @@ void aif2pcm(const char *aif_filename)
|
||||
fwrite(aif_data->samples, aif_data->num_samples, 1, pcm_file);
|
||||
fclose(pcm_file);
|
||||
|
||||
// Write the output .bin file containing .aif metadata.
|
||||
FILE *metadata_file;
|
||||
metadata_file = fopen(metadata_filename, "wb");
|
||||
unsigned long pitch_adjust = (unsigned long)(aif_data->sample_rate * 1024);
|
||||
fwrite(&pitch_adjust, sizeof(unsigned long), 1, metadata_file);
|
||||
fwrite(&(aif_data->loop_offset), sizeof(unsigned long), 1, metadata_file);
|
||||
fclose(metadata_file);
|
||||
|
||||
free(aif_data->samples);
|
||||
free(aif_data);
|
||||
free(aif_file_data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user