Skip to content

Commit

Permalink
link THPAudio.c
Browse files Browse the repository at this point in the history
slightly different from MKDD's instance
  • Loading branch information
EpochFlame committed Sep 17, 2023
1 parent 2fa2bf8 commit 016c848
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 677 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"thpaudiodecode.h": "c",
"thpdraw.h": "c",
"thpplayer.h": "c",
"thpvideodecode.h": "c"
"thpvideodecode.h": "c",
"thpaudio.h": "c"
}
}
320 changes: 0 additions & 320 deletions asm/Dolphin/thp/THPAudio.s

This file was deleted.

2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@
"host": False,
"objects": [
"Dolphin/thp/THPDec",
"Dolphin/thp/THPAudio",
["Dolphin/thp/THPAudio", True],
],
},
{
Expand Down
10 changes: 5 additions & 5 deletions docs/recommended_todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
| ---- | ---- | ---- | ---- |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/targsupp.c">TRK_MINNOW_DOLPHIN/targsupp.c</a> | 326 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXDisplayList.c">gx/GXDisplayList.c</a> | 647 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/Runtime/__init_cpp_exceptions.cpp">Runtime/__init_cpp_exceptions.cpp</a> | 684 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/Runtime/global_destructor_chain.c">Runtime/global_destructor_chain.c</a> | 965 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/mtx/mtxvec.c">mtx/mtxvec.c</a> | 3122 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/mslsupp.c">TRK_MINNOW_DOLPHIN/mslsupp.c</a> | 4555 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/CircleBuffer.c">TRK_MINNOW_DOLPHIN/CircleBuffer.c</a> | 4715 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/serpoll.c">TRK_MINNOW_DOLPHIN/serpoll.c</a> | 4793 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/mpc_7xx_603e.c">TRK_MINNOW_DOLPHIN/mpc_7xx_603e.c</a> | 5554 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/mtx/mtx44.c">mtx/mtx44.c</a> | 5987 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/os/OSReboot.c">os/OSReboot.c</a> | 6397 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXGeometry.c">gx/GXGeometry.c</a> | 6983 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/thp/THPAudio.c">thp/THPAudio.c</a> | 7974 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c">TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c</a> | 10320 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/mtx/mtxvec.c">mtx/mtxvec.c</a> | 3122 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/thp/THPAudio.c">thp/THPAudio.c</a> | 3671 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/mslsupp.c">TRK_MINNOW_DOLPHIN/mslsupp.c</a> | 4555 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/CircleBuffer.c">TRK_MINNOW_DOLPHIN/CircleBuffer.c</a> | 4715 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/serpoll.c">TRK_MINNOW_DOLPHIN/serpoll.c</a> | 4793 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/mpc_7xx_603e.c">TRK_MINNOW_DOLPHIN/mpc_7xx_603e.c</a> | 5554 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/mtx/mtx44.c">mtx/mtx44.c</a> | 5987 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/os/OSReboot.c">os/OSReboot.c</a> | 6397 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXGeometry.c">gx/GXGeometry.c</a> | 6983 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c">TRK_MINNOW_DOLPHIN/dolphin_trk_glue.c</a> | 10320 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/exi/EXIUart.c">exi/EXIUart.c</a> | 10329 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk.c">TRK_MINNOW_DOLPHIN/dolphin_trk.c</a> | 11230 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/support.c">TRK_MINNOW_DOLPHIN/support.c</a> | 12046 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTransform.c">gx/GXTransform.c</a> | 12379 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXLight.c">gx/GXLight.c</a> | 14151 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTev.c">gx/GXTev.c</a> | 14624 |
Expand Down
38 changes: 38 additions & 0 deletions include/THP/THPAudio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef _THP_THPAUDIO_H
#define _THP_THPAUDIO_H

#include "Dolphin/os.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct THPAudioRecordHeader {
u32 offsetNextChannel;
u32 sampleSize;
s16 lCoef[8][2];
s16 rCoef[8][2];
s16 lYn1;
s16 lYn2;
s16 rYn1;
s16 rYn2;
} THPAudioRecordHeader;

typedef struct THPAudioDecodeInfo {
u8* encodeData;
u32 offsetNibbles;
u8 predictor;
u8 scale;
s16 yn1;
s16 yn2;
} THPAudioDecodeInfo;

u32 THPAudioDecode(s16* audioBuffer, u8* audioFrame, s32 flag);
static s32 __THPAudioGetNewSample(THPAudioDecodeInfo* info);
static void __THPAudioInitialize(THPAudioDecodeInfo* info, u8* ptr);

#ifdef __cplusplus
}
#endif

#endif
2 changes: 1 addition & 1 deletion include/THP/THPAudioDecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _THP_THPAUDIODECODE_H

#include "Dolphin/os.h"
#include "THP/THPAudio.h"

static void* AudioDecoderForOnMemory(void* bufPtr);
static void* AudioDecoder(void* _);
Expand All @@ -10,7 +11,6 @@ static void AudioDecode(THPReadBuffer* readBuffer);
#ifdef __cplusplus
extern "C" {
#endif
int THPAudioDecode(s16* buffer, u8* frame, s32 flags); // TODO: determine args and name properly

BOOL CreateAudioDecodeThread(OSPriority prio, void* param);
void AudioDecodeThreadStart();
Expand Down
3 changes: 2 additions & 1 deletion src/Dolphin/thp/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
THP_FILES:=\
$(BUILD_DIR)/asm/Dolphin/thp/THPDec.o\
$(BUILD_DIR)/asm/Dolphin/thp/THPAudio.o\
$(BUILD_DIR)/src/Dolphin/thp/THPAudio.o\

$(THP_FILES): CFLAGS += -common off
$(THP_FILES): MWCC_VERSION := 1.2.5n

DEPENDS += $(THP_FILES:.o=.d)

Expand Down
Loading

0 comments on commit 016c848

Please sign in to comment.