mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-11 05:58:04 -05:00
e42b18cf71
* Fixed soh filters * add more makefile changes * almost ready * more updates * update * update * Update Makefiles to handle both platforms * Allow for overriding the CXX and CC executables * Restore original structure while supporting custom CXX flags * Remove some platform specific libs * Dynamic target name * Make X11 paths package-agnostic * Remove changes to `gfx_opengl.cpp` * Use OpenGL2 on MacOS instead of OpenGL3 * make it actually render something * render at least the first texture, still need to figure out the second one * Let’s use OpenGL 3 again * maybe this works to get the right texture? link's eyes still look off a bit * did this work? * set the platform to macos * actual numbers are right, but logic is ugly XXX/TODO, i know * add zlib to ldflags for ZAPDUtils * A bit of cleanup * Revert unneeded changes * Remove GL_CHECK * Fix issues with z64 branch * use an std::map instead of a giant array * three point filter fix (#2) * Fix mac compilation * fix audio for 64 bit * revert audio heap size, keep bigger pools * Add more Apple specific checks to our modifications * Add building instructions for macOS * Remove unecessary step from building instructions * Add missing SDL2 & GLEW to Linux LDLIBS * Update BUILDING.md Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Update soh/.gitignore to include other arch binaries Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Use right platform name for debugging window Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Fix stormlib on macos (arm64) * Simplify some of the ifdef checks * Revert an older no longer necessary fix * Remove remaining unecessary deviations * Update building instructions after StormLib changes * Feature: Use OpenGL 4.1 (#1) * Further tweak the BUILDING * Tidy up * reword -j message * Add Jenkins CI Support (#2) * Fix type issues * add target <appbundle> and <filledappbundle> add makefile targets to create an .app `filledappbundle` creates the target with the .otr included this should perhaps be moved to Application Support though * pull gcc's rpath from otool output * move make target to the end so it's not default * Add Jenkins and make exe in par with other platforms * Actually save build artefacts * Fix artefact path * Remove x11 mentions and linking (not used) * Update building instructions for generating app * use appsupport directory * Add new app icon * Update target to match macOS types * Update more audio types * fix null deref in Audio_PlayFanfare * Remove old import from z64 * address final nit with apple ifdefs Co-authored-by: KiritoDev <36680385+KiritoDv@users.noreply.github.com> Co-authored-by: Jeffrey Crowell <github@crowell.biz> Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com>
188 lines
4.7 KiB
C++
188 lines
4.7 KiB
C++
#include "Audio.h"
|
|
|
|
namespace Ship
|
|
{
|
|
void AudioSequenceV2::ParseFileBinary(BinaryReader* reader, Resource* res)
|
|
{
|
|
AudioSequence* seq = (AudioSequence*)res;
|
|
|
|
ResourceFile::ParseFileBinary(reader, res);
|
|
|
|
uint32_t seqDataSize = reader->ReadInt32();
|
|
|
|
seq->seqData.reserve(seqDataSize);
|
|
|
|
for (uint32_t i = 0; i < seqDataSize; i++)
|
|
seq->seqData.push_back(reader->ReadUByte());
|
|
|
|
seq->seqNumber = reader->ReadUByte();
|
|
seq->medium = reader->ReadUByte();
|
|
seq->cachePolicy = reader->ReadUByte();
|
|
|
|
uint32_t numFonts = reader->ReadInt32();
|
|
|
|
for (uint32_t i = 0; i < numFonts; i++)
|
|
seq->fonts.push_back(reader->ReadUByte());
|
|
}
|
|
|
|
void AudioSampleV2::ParseFileBinary(BinaryReader* reader, Resource* res)
|
|
{
|
|
AudioSample* entry = (AudioSample*)res;
|
|
|
|
ResourceFile::ParseFileBinary(reader, res);
|
|
|
|
entry->codec = reader->ReadByte();
|
|
entry->medium = reader->ReadByte();
|
|
entry->unk_bit26 = reader->ReadByte();
|
|
entry->unk_bit25 = reader->ReadByte();
|
|
|
|
uint32_t dataSize = reader->ReadInt32();
|
|
|
|
for (uint32_t i = 0; i < dataSize; i++)
|
|
entry->data.push_back(reader->ReadUByte());
|
|
|
|
entry->loop.start = reader->ReadUInt32();
|
|
entry->loop.end = reader->ReadUInt32();
|
|
entry->loop.count = reader->ReadUInt32();
|
|
|
|
uint32_t loopStateCnt = reader->ReadUInt32();
|
|
|
|
for (uint32_t i = 0; i < loopStateCnt; i++)
|
|
entry->loop.states.push_back(reader->ReadInt16());
|
|
|
|
entry->book.order = reader->ReadInt32();
|
|
entry->book.npredictors = reader->ReadInt32();
|
|
|
|
uint32_t bookSize = reader->ReadInt32();
|
|
|
|
for (uint32_t i = 0; i < bookSize; i++)
|
|
entry->book.books.push_back(reader->ReadInt16());
|
|
}
|
|
|
|
void AudioSoundFontV2::ParseFileBinary(BinaryReader* reader, Resource* res)
|
|
{
|
|
AudioSoundFont* soundFont = (AudioSoundFont*)res;
|
|
|
|
ResourceFile::ParseFileBinary(reader, res);
|
|
|
|
soundFont->id = reader->ReadInt32();
|
|
soundFont->medium = reader->ReadByte();
|
|
soundFont->cachePolicy = reader->ReadByte();
|
|
soundFont->data1 = reader->ReadInt16();
|
|
soundFont->data2 = reader->ReadInt16();
|
|
soundFont->data3 = reader->ReadInt16();
|
|
|
|
uint32_t drumCnt = reader->ReadInt32();
|
|
uint32_t instrumentCnt = reader->ReadInt32();
|
|
uint32_t sfxCnt = reader->ReadInt32();
|
|
|
|
for (uint32_t i = 0; i < drumCnt; i++)
|
|
{
|
|
DrumEntry drum;
|
|
drum.releaseRate = reader->ReadUByte();
|
|
drum.pan = reader->ReadUByte();
|
|
drum.loaded = reader->ReadUByte();
|
|
|
|
drum.env = ReadEnvelopeData(reader);
|
|
|
|
bool hasSample = reader->ReadByte();
|
|
drum.sampleFileName = reader->ReadString();
|
|
drum.tuning = reader->ReadSingle();
|
|
|
|
soundFont->drums.push_back(drum);
|
|
}
|
|
|
|
for (uint32_t i = 0; i < instrumentCnt; i++)
|
|
{
|
|
InstrumentEntry entry;
|
|
|
|
entry.isValidEntry = reader->ReadUByte();
|
|
entry.loaded = reader->ReadUByte();
|
|
entry.normalRangeLo = reader->ReadUByte();
|
|
entry.normalRangeHi = reader->ReadUByte();
|
|
entry.releaseRate = reader->ReadUByte();
|
|
|
|
entry.env = ReadEnvelopeData(reader);
|
|
|
|
{
|
|
bool hasSFEntry = reader->ReadByte();
|
|
|
|
if (hasSFEntry)
|
|
{
|
|
entry.lowNotesSound = new SoundFontEntry();
|
|
bool hasSampleRef = reader->ReadByte();
|
|
entry.lowNotesSound->sampleFileName = reader->ReadString();
|
|
entry.lowNotesSound->tuning = reader->ReadSingle();
|
|
}
|
|
}
|
|
|
|
{
|
|
bool hasSFEntry = reader->ReadByte();
|
|
|
|
if (hasSFEntry)
|
|
{
|
|
entry.normalNotesSound = new SoundFontEntry();
|
|
bool hasSampleRef = reader->ReadByte();
|
|
entry.normalNotesSound->sampleFileName = reader->ReadString();
|
|
entry.normalNotesSound->tuning = reader->ReadSingle();
|
|
}
|
|
}
|
|
|
|
{
|
|
bool hasSFEntry = reader->ReadByte();
|
|
|
|
if (hasSFEntry)
|
|
{
|
|
entry.highNotesSound = new SoundFontEntry();
|
|
bool hasSampleRef = reader->ReadByte();
|
|
entry.highNotesSound->sampleFileName = reader->ReadString();
|
|
entry.highNotesSound->tuning = reader->ReadSingle();
|
|
}
|
|
}
|
|
|
|
soundFont->instruments.push_back(entry);
|
|
}
|
|
|
|
for (uint32_t i = 0; i < sfxCnt; i++)
|
|
{
|
|
SoundFontEntry* entry = new SoundFontEntry();
|
|
|
|
bool hasSFEntry = reader->ReadByte();
|
|
|
|
if (hasSFEntry)
|
|
{
|
|
bool hasSampleRef = reader->ReadByte();
|
|
entry->sampleFileName = reader->ReadString();
|
|
entry->tuning = reader->ReadSingle();
|
|
}
|
|
|
|
soundFont->soundEffects.push_back(entry);
|
|
}
|
|
}
|
|
|
|
std::vector<AdsrEnvelope*> AudioSoundFontV2::ReadEnvelopeData(BinaryReader* reader)
|
|
{
|
|
std::vector<AdsrEnvelope*> envelopes;
|
|
|
|
uint32_t envelopeCnt = reader->ReadInt32();
|
|
|
|
for (uint32_t i = 0; i < envelopeCnt; i++)
|
|
{
|
|
AdsrEnvelope* env = new AdsrEnvelope();
|
|
env->delay = reader->ReadInt16();
|
|
env->arg = reader->ReadInt16();
|
|
|
|
envelopes.push_back(env);
|
|
}
|
|
|
|
return envelopes;
|
|
}
|
|
|
|
void AudioV2::ParseFileBinary(BinaryReader* reader, Resource* res)
|
|
{
|
|
Audio* audio = (Audio*)res;
|
|
|
|
ResourceFile::ParseFileBinary(reader, res);
|
|
}
|
|
}
|