mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-04-28 13:07:59 +03:00
Initial audio support
This commit is contained in:
parent
c975da266a
commit
defd5f6bff
7 changed files with 2750 additions and 11 deletions
|
@ -44,9 +44,8 @@ all: $(TARGET)
|
|||
|
||||
include common.mk
|
||||
|
||||
# ../src/Audio/sampman_dc.o
|
||||
OBJS = $(RE3_OBJS) $(RW_OBJS) \
|
||||
../miami/audio/sampman_null.o \
|
||||
../miami/audio/sampman_dc.o \
|
||||
../src/prof/profiler.o
|
||||
|
||||
OBJS_TEXCONV = $(RW_OBJS:.o=.texconv.o)
|
||||
|
@ -279,6 +278,9 @@ extract-sfx: extract-sfx.cpp
|
|||
pack-sfx: pack-sfx.cpp
|
||||
$(CXX) -std=c++17 -o $@ -Og $<
|
||||
|
||||
adf2mp3: adf2mp3.cpp
|
||||
$(CXX) -o $@ -O3 -g $<
|
||||
|
||||
aud2adpcm: aud2adpcm.c
|
||||
$(CC) -o $@ -O3 -g $< -I../vendor/minimp3
|
||||
|
||||
|
@ -366,7 +368,8 @@ SFX_DC_DIR = $(REPACK_GTA_DIR)/sfx
|
|||
SFX_DC_RAW = $(SFX_DC_DIR)/sfx_all.raw
|
||||
SFX_DC_DSC = $(SFX_DC_DIR)/sfx_all.dsc
|
||||
STREAM_ADPCM_DC = $(addprefix $(REPACK_GTA_DIR)/stream/, $(STREAM_WAV:.wav=.APM)) \
|
||||
$(addprefix $(REPACK_GTA_DIR)/stream/, $(STREAM_MP3:.mp3=.APM))
|
||||
$(addprefix $(REPACK_GTA_DIR)/stream/, $(STREAM_MP3:.mp3=.APM)) \
|
||||
$(addprefix $(REPACK_GTA_DIR)/stream/, $(STREAM_ADF:.adf=.APM))
|
||||
|
||||
IMG_TEXTURES_ORIG = $(addprefix $(REPACK_IMG_ORIG_DIR)/, $(IMG_TEXTURES))
|
||||
IMG_MODELS_ORIG = $(addprefix $(REPACK_IMG_ORIG_DIR)/, $(IMG_MODELS))
|
||||
|
@ -376,10 +379,11 @@ SFX_ORIG = $(addprefix $(REPACK_SFX_ORIG_DIR)/, $(SFX_WAV))
|
|||
SFX_ORIG_LOOP = $(addprefix $(REPACK_SFX_ORIG_DIR)/, $(SFX_LOOP_WAV))
|
||||
SFX_REPACK_DC_WAV = $(addprefix $(REPACK_SFX_DC_DIR)/, $(SFX_WAV) $(SFX_LOOP_WAV))
|
||||
SFX_REPACK_DC = $(SFX_REPACK_DC_WAV:.wav=.pcm)
|
||||
STREAM_ADF_DECODED = $(addprefix $(REPACK_STREAM_DECODED_DIR)/, $(STREAM_ADF:.adf=.wav))
|
||||
STREAM_MP3_DECODED = $(addprefix $(REPACK_STREAM_DECODED_DIR)/, $(STREAM_MP3:.mp3=.wav))
|
||||
STREAM_WAV_DECODED = $(addprefix $(REPACK_STREAM_DECODED_DIR)/, $(STREAM_WAV))
|
||||
|
||||
.PRECIOUS: $(SFX_ORIG) $(SFX_REPACK_DC) $(STREAM_MP3_DECODED) $(STREAM_WAV_DECODED)
|
||||
.PRECIOUS: $(SFX_ORIG) $(SFX_REPACK_DC) $(STREAM_MP3_DECODED) $(STREAM_ADF_DECODED) $(STREAM_WAV_DECODED)
|
||||
|
||||
$(REPACK_DIR)/repacked: $(REPACK_GTA_DIR)/models/gta3.img $(REPACK_GTA_DIR)/models/gta3.dir $(LOOSE_FILES_DC) $(STREAM_ADPCM_DC) $(SFX_DC_RAW) $(SFX_DC_DSC)
|
||||
mkdir -p $(@D)
|
||||
|
@ -518,11 +522,15 @@ $(REPACK_GTA_DIR)/stream/%.APM: $(GTA_MOD_LOOSE_DIR)/Audio/%.wav aud2adpcm
|
|||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
$(REPACK_STREAM_DECODED_DIR)/%.mp3: $(GTA_MOD_LOOSE_DIR)/Audio/%.adf adf2mp3
|
||||
@mkdir -p $(@D)
|
||||
./adf2mp3 $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_MOD_LOOSE_DIR)/Audio/%.mp3 aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_MOD_LOOSE_DIR)/Audio/%.adf aud2adpcm
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(REPACK_STREAM_DECODED_DIR)/%.mp3 aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
|
@ -531,10 +539,19 @@ $(REPACK_GTA_DIR)/stream/%.APM: $(GTA_DIR)/Audio/%.wav aud2adpcm
|
|||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
$(REPACK_STREAM_DECODED_DIR)/%.mp3: $(GTA_DIR)/Audio/%.adf adf2mp3
|
||||
@mkdir -p $(@D)
|
||||
./adf2mp3 $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_DIR)/Audio/%.mp3 aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(REPACK_STREAM_DECODED_DIR)/%.mp3 aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
|
||||
# Note: This is last so it has least priority, files should be processed if possible
|
||||
$(REPACK_GTA_DIR)/%: $(GTA_DIR)/%
|
||||
@mkdir -p $(@D)
|
||||
|
|
50
dreamcast/adf2mp3.cpp
Normal file
50
dreamcast/adf2mp3.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Check for correct number of arguments.
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: adf2mp3 <inputfile> <outputfile>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get file names from command line arguments.
|
||||
const char* inputFileName = argv[1];
|
||||
const char* outputFileName = argv[2];
|
||||
|
||||
// Open the input file in binary mode.
|
||||
std::ifstream inputFile(inputFileName, std::ios::binary);
|
||||
if (!inputFile) {
|
||||
std::cerr << "Error: Unable to open input file " << inputFileName << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Open the output file in binary mode.
|
||||
std::ofstream outputFile(outputFileName, std::ios::binary);
|
||||
if (!outputFile) {
|
||||
std::cerr << "Error: Unable to open output file " << outputFileName << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Buffer to hold file data.
|
||||
const size_t bufferSize = 4096;
|
||||
char buffer[bufferSize];
|
||||
|
||||
// Process the file in chunks.
|
||||
while (inputFile.read(buffer, bufferSize) || inputFile.gcount() > 0) {
|
||||
// Get the number of bytes actually read.
|
||||
std::streamsize bytesRead = inputFile.gcount();
|
||||
// XOR each byte with 0x22.
|
||||
for (std::streamsize i = 0; i < bytesRead; ++i) {
|
||||
buffer[i] ^= 0x22;
|
||||
}
|
||||
// Write the modified buffer to the output file.
|
||||
outputFile.write(buffer, bytesRead);
|
||||
}
|
||||
|
||||
// Close files.
|
||||
inputFile.close();
|
||||
outputFile.close();
|
||||
|
||||
return 0;
|
||||
}
|
BIN
dreamcast/loader.elf
Executable file
BIN
dreamcast/loader.elf
Executable file
Binary file not shown.
|
@ -1,3 +1,14 @@
|
|||
STREAM_ADF = \
|
||||
EMOTION.adf \
|
||||
ESPANT.adf \
|
||||
FEVER.adf \
|
||||
FLASH.adf \
|
||||
KCHAT.adf \
|
||||
VCPR.adf \
|
||||
VROCK.adf \
|
||||
WAVE.adf \
|
||||
WILD.adf
|
||||
|
||||
STREAM_MP3 = \
|
||||
cnt_1b.mp3 \
|
||||
int_b.mp3 \
|
||||
|
|
|
@ -52,7 +52,11 @@
|
|||
void
|
||||
cAudioManager::PreInitialiseGameSpecificSetup()
|
||||
{
|
||||
unsigned DynamicBankCount = SFX_BANK_PED_COMMENTS; // first non dynamic bank
|
||||
BankStartOffset[SFX_BANK_0] = SAMPLEBANK_START;
|
||||
for (unsigned i = SFX_BANK_1; i < DynamicBankCount; i++) {
|
||||
BankStartOffset[i] = (SAMPLEBANK_END - SAMPLEBANK_START) / DynamicBankCount + BankStartOffset[i - 1];
|
||||
}
|
||||
#ifdef GTA_PS2
|
||||
BankStartOffset[SAMPLEBANK_CAR_PACARD] = SFX_CAR_ACCEL_1;
|
||||
BankStartOffset[SAMPLEBANK_CAR_PATHFINDER] = SFX_CAR_ACCEL_2;
|
||||
|
|
File diff suppressed because it is too large
Load diff
1419
miami/audio/sampman_dc.cpp
Normal file
1419
miami/audio/sampman_dc.cpp
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue