Skip to content

Audio lib decomp#38

Open
jefemagril wants to merge 63 commits into
mkst:masterfrom
jefemagril:audio-lib
Open

Audio lib decomp#38
jefemagril wants to merge 63 commits into
mkst:masterfrom
jefemagril:audio-lib

Conversation

@jefemagril

Copy link
Copy Markdown

Decompiled a bunch of the libultra audio code

…ructs instead of void pointers, enhancing type safety and code clarity.
…ty by replacing void pointers with specific structs, and update function implementations to match new signatures.
…or improved event handling and implement logic for track end detection.
…eqSetLoc for improved clarity and functionality in n_csq.c. Update related comments in init_8180.c to reflect changes.
…oop start markers in audio sequences, replacing the previous func_10018790. Update related function calls in init_8180.c for consistency.
…me for audio players, replacing the previous commented-out implementation. Update logic to utilize the n_syn structure for improved clarity and functionality.
…s, improving memory management in audio processing. Update linked list handling for proper insertion and removal of voices.
…oices in the audio synthesizer, enhancing linked list operations for voice management. Update N_PVoice structure to facilitate voice linking during list transitions.
…eplacing the previous commented-out implementation. Introduce helper functions for sample time calculation and command list management, enhancing audio synthesis capabilities.
… for audio synthesis, replacing the previous commented-out func_1001DA28. Update related logic for improved audio processing based on main bus filter conditions.
…n the event queue. Enhance linked list management for event insertion based on delta timing, improving audio event processing efficiency.
…ments in audio synthesis. Replace calls to the previous func_1001A45C for improved clarity and functionality in volume handling.
…hannel fade control in audio synthesis. Include comments on discrepancies with original assembly and potential improvements for future development.
… synthesis. Update calls in init_12560.c to utilize the new function, enhancing clarity and functionality in volume management.
…state. Update calls in init_12560.c to utilize the new function, enhancing clarity in audio state management. Adjust gStreamState handling in game_21FC90.c for improved state tracking.
… Update gStreamState handling to support fade-out and stopping states, enhancing audio control in game_21FC90.c.
…tPan, n_alStreamSetLoadInfo, and n_alStreamSetDoneCallback. Update init_12560.c to utilize these functions for improved audio management. Refactor game_21FC90.c to enhance audio stream handling and state management with new constants and callback mechanisms.
…adjustments in audio streams. Update init_19B50.c to replace the previous function call with the new implementation, enhancing audio control and state management. Add new helper functions for pitch calculations.
…in audio streams. Update init_19B50.c to implement sustain logic, enhancing audio state management and control. Introduce N_ALCSPExtraChanState struct for custom release time handling, improving audio processing capabilities.
…ementing new functions for channel volume, pan, priority, and effects management. Introduce n_alCSPHandleChlVolCtrl, n_alCSPHandleChlPanCtrl, n_alCSPHandleChlPriorityCtrl, and others to enhance audio state management. Update function signatures and improve clarity in audio processing logic.
… enhance audio processing capabilities. Update function signatures in init_1E350.c and init_19B50.c for improved clarity and consistency in audio control logic.
…udio streams. Update init_19B50.c to implement fade logic, enhancing audio state management. Remove commented-out code for clarity and maintainability.
…n translation unit (n_streamcrc.c) for optimized compilation. Update Makefile to set appropriate optimization flags for the new file, ensuring consistency in audio processing across the project.
… into a dedicated translation unit (n_streamcrc.c) for optimized compilation. Update comments for clarity on their purpose and integration within the audio processing framework.
…stants for fade speed and duration mask. Update n_alCSPStartChlFade function to utilize these constants, improving code clarity and maintainability in audio state management.
… implementing new functions n_alSndpPostActiveVoiceUpdates and n_alSndpPostReadyVoiceUpdates. Introduce constants for event types and flags to enhance code clarity and maintainability in audio event handling.
…n init_15550.c. Update init_EB00.c to replace previous function calls with the new implementation, enhancing audio state management. Introduce constants for event types to improve code clarity in audio processing.
…in audio processing. Update func_10016F80 to utilize the new function, improving clarity and maintainability in event handling. Introduce SNDP_ALL_EVENT_TYPES constant for better event type management.
…e sound playback in audio processing. Introduce SNDP_PLAY_SOUND_EVT constant for event handling, enhancing clarity and maintainability in audio state management.
…ept N_ALSndpConfig struct, enhancing configuration management for sound player initialization. Introduce N_ALSndPlayerExtended struct for extended sound player functionality, improving clarity and maintainability in audio processing.
…and implementing new sound processing functions. Update init_EB00.c to utilize the new sndp_get_state and sndp_post_end_event functions, enhancing clarity and maintainability in audio state management.
…calls in functions.h and init_EB00.c for improved clarity in audio event handling. This change enhances the maintainability of audio processing by standardizing function signatures and improving code readability.
…n_alCSPSetBank and updating its implementation for improved clarity in bank event handling. Remove the corresponding declaration from functions.h to maintain consistency in function signatures.
…SndpSoundState struct instead of the previous struct154. Update the corresponding declaration in functions.h to maintain consistency in function signatures and improve clarity in audio processing.
…SoundState struct, improving clarity in voice management. Update the corresponding declaration in functions.h to maintain consistency in function signatures and enhance audio processing readability.
…p_post_end_event to sndp_post_stopall_event and update related calls for improved clarity in audio event handling. Additionally, update function signatures to utilize N_ALSndpSoundState struct, enhancing maintainability in audio state management.
…naming and implementing n_alSndpSetOutputMode and n_alSndpSetOutputRoute for improved clarity in audio output management. Update related calls in game_2D4B0.c to reflect these changes, enhancing maintainability in audio processing.
…y renaming and implementing n_alOscDepthToCents, n_alOscInit, n_alOscUpdate, n_alOscStop, and n_alOscSetCallbacks for improved clarity in audio modulation management. Update related calls to enhance maintainability in audio processing.
…28D0.c by renaming and implementing n_alBnkfPatchBank, n_alBnkfPatchSingleWaveBaseList, and n_alBnkfPatchWaveBaseList for improved clarity in audio bank management. Update related calls to enhance maintainability in audio processing.

#define BNKF_SAMPLE_BANK_BASE(sampleBankId) (((sampleBankId) & -8) << 5)

#define oscNext unk0

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these defines rather than updating the struct?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just being conservative. The defines explain their function in this file, but in the wider codebase they might be a more generic type used for other things. I figure we can revisit that once we have more context.

Comment thread conker/src/game_1944C0.c Outdated
#pragma GLOBAL_ASM("asm/nonmatchings/game_1944C0/func_15168BAC.s")

// void func_15168BE4(void *arg0_raw, u8 arg1, s32 arg2) {
// typedef struct {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think im a fan of all these internal structs.. should try and trace the use through the various calls and define them in a common place.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I refactored all of those, I think

Comment thread conker/src/game_1944C0.c Outdated
D_800D2DAB = 1;
return arg0;
}
// void func_1516968C(void *arg0, u8 *arg1, u8 arg2) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is arg1 really a u8 pointer?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, refactored it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants