Files
mm/include/PR/os_voice.h
T
engineer124 8ab62788b2 Audio Voice Decompiled (#1490)
* Add Tharo's documentation comments

* Voice progress

* Match osVoiceControlGain

* Match osVoiceStartReadData

* Cleanup

* Add docs from n64devkit

* WIP on osVoiceGetReadData

* Add comment

* Match voiceinit.c

* Remove CONT_ERR, already present in controller.h

* Really close to matching osVoiceStopReadData

* Progress on voicecheckword

* Match osVoiceSetWord

* Add error codes

* Matched __osVoiceContRead2... Somehow...

* Add small amount of docs

* __osVoiceContRead36 was basically identical from __osVoiceContRead2

* docs, but maybe a little carried away

* Match __osVoiceContWrite4, Write is very similar to Read

* Match __osVoiceContWrite20 from __osVoiceContWrite4, ez

* Some docs

* Improve osVoiceGetReadData

* Match osVoiceCheckWord

* currentSyllable -> currSyllable

* Match osVoiceMaskDictionary

* Match __osVoiceSetADConverter

* Meme matched osVoiceStopReadData

* small cleanup

* Missed macros

* osVoiceGetReadData Meme Match

* Small clean-up

* format

* Properly split voice files from code

* Use proper flags for voice files

* Add basic docs for func_801A5AF0

* Import Voice Data

* Update matching functions in code_801A51F0 from audio WIP

* Update matching functions in code_801A4EB0 from audio WIP

* Match func_801A5A1C

* Match func_801A5228

* Match func_801A54D0

* Doc padmgr functions used

* Match func_801A5680, it's near identical to func_801A54D0

* code_801A51F0 OK

* Match func_801A4EB8

* Match func_801A4FD8 (mips2c got it matching directly)

* code_801A4EB0 & all of voice, OK

* Import bss

* Better match for func_801A5A1C

* format

* Cleanup

* Clean up dictionary

* Introduce OSVoiceDictionary

* More voice docs

* Fix bss

* Import code_801A4EB0 data

* Introduce Word Id enum

* Dictionary: u8 -> u16

* Introduce bgms

* Fill in bgm enums

* Rename bgm to clearer names

* Fix spacing

* Fix "No_Music" define

* remove comment

* import rodata

* Improve bgm names, found another seqId function

* Another seqId function

* Another name change

* Woods of Mystery -> Sarias Song

* Fix match in osVoiceControlGain

* Fix bss reordering

* Fix bss file split

* add saria's song bgm to pierre

* Another bgm function found!

* Add bgm's to `gSaveContext.seqIndex`

* Fix BSS

* fix bss

* Fix bss

* cleanup

* more cleanup

* cow voice weekeventflag

* small cleanup

* some docs

* cleanup var

* global

* more docs

* PR Review

---------

Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
2023-11-17 12:29:42 +11:00

59 lines
2.3 KiB
C

#ifndef PR_OS_VOICE_H
#define PR_OS_VOICE_H
#include "ultratypes.h"
#include "os_message.h"
typedef enum OsVoiceHandleMode {
/* 0 */ VOICE_HANDLE_MODE_0,
/* 1 */ VOICE_HANDLE_MODE_1,
/* 2 */ VOICE_HANDLE_MODE_2,
/* 3 */ VOICE_HANDLE_MODE_3,
/* 4 */ VOICE_HANDLE_MODE_4
} OsVoiceHandleMode;
typedef struct {
/* 0x0 */ OSMesgQueue* mq;
/* 0x4 */ s32 channel; // Controller port
/* 0x8 */ OsVoiceHandleMode mode;
/* 0xC */ u8 status;
} OSVoiceHandle; // size = 0x10
typedef struct {
/* 0x00 */ u16 warning; // Warning
/* 0x02 */ u16 answerNum; // Candidate number (0~5)
/* 0x04 */ u16 voiceLevel; // Voice input level
/* 0x06 */ u16 voiceRelLevel; // Relative voice level "voice_sn"
/* 0x08 */ u16 voiceTime; // Voice input time
/* 0x0A */ u16 answer[5]; // Candidate word number
/* 0x14 */ u16 distance[5]; // Distance value
} OSVoiceData; // size = 0x20
#define VOICE_STATUS_READY 0 /* stop/end */
#define VOICE_STATUS_START 1 /* Voice Undetected (no voice input) */
#define VOICE_STATUS_CANCEL 3 /* Cancel (cancel extraneous noise) */
#define VOICE_STATUS_BUSY 5 /* Detected/Detecting (voice being input, recognition processing under way) */
#define VOICE_STATUS_END 7 /* End recognition processing (enable execution of Get Recognition Results command) */
#define VOICE_WARN_TOO_SMALL 0x400 /* Voice level is too low (100 < Voice Level < 150) */
#define VOICE_WARN_TOO_LARGE 0x800 /* Voice level is too high (Voice Level > 3500) */
#define VOICE_WARN_NOT_FIT 0x4000 /* No words match recognition word (No. 1 Candidate Distance Value > 1600) */
#define VOICE_WARN_TOO_NOISY 0x8000 /* Too much ambient noise (Relative Voice Level =< 400) */
typedef struct {
/* 0x000 */ u16 words[20][15]; // 20 words, each with up to 15 syllables
/* 0x258 */ u8 numWords;
} OSVoiceDictionary; // size = 0x25C
s32 osVoiceInit(OSMesgQueue* mq, OSVoiceHandle* hd, int channel);
s32 osVoiceSetWord(OSVoiceHandle* hd, u8* word);
s32 osVoiceCheckWord(u8* word);
s32 osVoiceStartReadData(OSVoiceHandle* hd);
s32 osVoiceStopReadData(OSVoiceHandle* hd);
s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result);
s32 osVoiceClearDictionary(OSVoiceHandle* hd, u8 numWords);
s32 osVoiceMaskDictionary(OSVoiceHandle* hd, u8* maskPattern, int size);
s32 osVoiceControlGain(OSVoiceHandle* hd, s32 analog, s32 digital);
#endif