Repository navigation
GraphiteSound: sampled sounds, 'snd ' resources, AIFF, and the µ-law, A-law and IMA4 codecs - #25
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The first part of
GraphiteSound, the Sound Manager's sounds and the codecs that decode them. The channels and mixer are the second part.SampledSound: a sound's encoding, rate, channels, sample size, count, base note and loop, with its samples kept asData(a slice of the resource or file it came from, not a copy).pcm16()decodes any supported encoding to interleaved 16-bit samples.'snd 'resources: formats 1 and 2 and the commands that point at a sampled sound header (GetSoundHeaderOffset), the standard, compressed and extended headers, and writing a format 1 resource back out.SoundCodecprotocol. They are written from the formats' descriptions.MIDINote.frequency(of:).MacError(badFormat,badFileFormat,badChannel,queueFull,channelBusy, …), with names in itsdescription.GraphiteSoundis a library product, and theGraphiteumbrella re-exports it. The README says so, and its status and dependencies paragraphs are brought up to date (they still described FreeType and layouts as coming, and no Foundation).Notes for review
SoundFormats.cpp,AIFF.cppandMidi.cppare ported; those three files carry its MIT notice. Pomme'sIMA4.cppandMACE.cppcome from FFmpeg under the LGPL and were not ported: IMA4 here is written anew.pcm16()throwsunimplementedfor them. They need a decoder written from a format description.MIDINotediffers from Pomme on purpose: Pomme's semitone ratio is a typo (1.059630…for1.059463…), so this uses exact equal temperament,440 · 2^((n−69)/12).Intis 32 bits (the i686 and 32-bit PowerPC builds).Package.swift.Testing
'snd 'resources and AIFF files built byte by byte in the tests (every header and compression type, loops, padding, slices, errors); and truncation and random-damage runs that must not trap.swift test, with and without theFreeTypetrait, and built the project and its tests in Xcode.