|
| 1 | +/*------------------------------------------------------------- |
| 2 | +
|
| 3 | +Copyright (C) 2011 - 2025 |
| 4 | +shuffle2 |
| 5 | +Extrems' Corner.org |
| 6 | +
|
| 7 | +This software is provided 'as-is', without any express or implied |
| 8 | +warranty. In no event will the authors be held liable for any |
| 9 | +damages arising from the use of this software. |
| 10 | +
|
| 11 | +Permission is granted to anyone to use this software for any |
| 12 | +purpose, including commercial applications, and to alter it and |
| 13 | +redistribute it freely, subject to the following restrictions: |
| 14 | +
|
| 15 | +1. The origin of this software must not be misrepresented; you |
| 16 | +must not claim that you wrote the original software. If you use |
| 17 | +this software in a product, an acknowledgment in the product |
| 18 | +documentation would be appreciated but is not required. |
| 19 | +
|
| 20 | +2. Altered source versions must be plainly marked as such, and |
| 21 | +must not be misrepresented as being the original software. |
| 22 | +
|
| 23 | +3. This notice may not be removed or altered from any source |
| 24 | +distribution. |
| 25 | +
|
| 26 | +-------------------------------------------------------------*/ |
| 27 | + |
| 28 | +#ifndef __OGC_MIC_H__ |
| 29 | +#define __OGC_MIC_H__ |
| 30 | + |
| 31 | +#include <gctypes.h> |
| 32 | + |
| 33 | +// Size of buffer for device driver |
| 34 | +// 12KB = Approx. 139msec worth @ 44100Hz |
| 35 | +// = Approx. 279msec worth @ 22050Hz |
| 36 | +// = Approx. 557msec worth @ 11025Hz |
| 37 | +#define MIC_RINGBUFFER_SIZE (12*1024) |
| 38 | + |
| 39 | +// Returned values, tests, etc. |
| 40 | +#define MIC_RESULT_UNLOCKED 1 |
| 41 | +#define MIC_RESULT_READY 0 |
| 42 | +#define MIC_RESULT_BUSY -1 |
| 43 | +#define MIC_RESULT_WRONGDEVICE -2 |
| 44 | +#define MIC_RESULT_NOCARD -3 |
| 45 | +#define MIC_RESULT_INVALID_STATE -4 |
| 46 | +#define MIC_RESULT_FATAL_ERROR -128 |
| 47 | + |
| 48 | +// Button bits |
| 49 | +#define MIC_BUTTON_0 0x0001 |
| 50 | +#define MIC_BUTTON_1 0x0002 |
| 51 | +#define MIC_BUTTON_2 0x0004 |
| 52 | +#define MIC_BUTTON_3 0x0008 |
| 53 | +#define MIC_BUTTON_4 0x0010 |
| 54 | +#define MIC_BUTTON_TALK MIC_BUTTON_4 |
| 55 | + |
| 56 | +#define MIC_BMC 0x00000000 |
| 57 | + |
| 58 | +#ifdef __cplusplus |
| 59 | + extern "C" { |
| 60 | +#endif /* __cplusplus */ |
| 61 | + |
| 62 | +typedef void (*MICCallback)(s32 chan, s32 result); |
| 63 | + |
| 64 | +void MIC_Init(void); |
| 65 | +s32 MIC_ProbeEx(s32 chan); |
| 66 | +s32 MIC_GetResultCode(s32 chan); |
| 67 | +u32 MIC_GetErrorCount(s32 chan); |
| 68 | + |
| 69 | +s32 MIC_MountAsync(s32 chan, s16 *buffer, s32 size, MICCallback detachCallback, MICCallback attachCallback); |
| 70 | +s32 MIC_Mount(s32 chan, s16 *buffer, s32 size, MICCallback detachCallback); |
| 71 | +s32 MIC_Unmount(s32 chan); |
| 72 | +s32 MIC_GetRingBufferSize(s32 chan, s32 *size); |
| 73 | + |
| 74 | +s32 MIC_SetStatusAsync(s32 chan, u32 status, MICCallback setCallback); |
| 75 | +s32 MIC_SetStatus(s32 chan, u32 status); |
| 76 | +s32 MIC_GetStatus(s32 chan, u32 *status); |
| 77 | + |
| 78 | +s32 MIC_SetParamsAsync(s32 chan, s32 size, s32 rate, s32 gain, MICCallback setCallback); |
| 79 | +s32 MIC_SetParams(s32 chan, s32 size, s32 rate, s32 gain); |
| 80 | +s32 MIC_GetParams(s32 chan, s32 *size, s32 *rate, s32 *gain); |
| 81 | + |
| 82 | +s32 MIC_SetBufferSizeAsync(s32 chan, s32 size, MICCallback setCallback); |
| 83 | +s32 MIC_SetBufferSize(s32 chan, s32 size); |
| 84 | +s32 MIC_GetBufferSize(s32 chan, s32 *size); |
| 85 | + |
| 86 | +s32 MIC_SetRateAsync(s32 chan, s32 rate, MICCallback setCallback); |
| 87 | +s32 MIC_SetRate(s32 chan, s32 rate); |
| 88 | +s32 MIC_GetRate(s32 chan, s32 *rate); |
| 89 | + |
| 90 | +s32 MIC_SetGainAsync(s32 chan, s32 gain, MICCallback setCallback); |
| 91 | +s32 MIC_SetGain(s32 chan, s32 gain); |
| 92 | +s32 MIC_GetGain(s32 chan, s32 *gain); |
| 93 | + |
| 94 | +s32 MIC_GetButton(s32 chan, u32 *button); |
| 95 | +s32 MIC_GetDeviceID(s32 chan, u32 *id); |
| 96 | + |
| 97 | +s32 MIC_SetOutAsync(s32 chan, u32 pattern, MICCallback setCallback); |
| 98 | +s32 MIC_SetOut(s32 chan, u32 pattern); |
| 99 | +s32 MIC_GetOut(s32 chan, u32 *pattern); |
| 100 | + |
| 101 | +s32 MIC_StartAsync(s32 chan, MICCallback startCallback); |
| 102 | +s32 MIC_Start(s32 chan); |
| 103 | + |
| 104 | +s32 MIC_StopAsync(s32 chan, MICCallback stopCallback); |
| 105 | +s32 MIC_Stop(s32 chan); |
| 106 | + |
| 107 | +s32 MIC_ResetAsync(s32 chan, MICCallback resetCallback); |
| 108 | +s32 MIC_Reset(s32 chan); |
| 109 | + |
| 110 | +bool MIC_IsActive(s32 chan); |
| 111 | +bool MIC_IsAttached(s32 chan); |
| 112 | + |
| 113 | +s32 MIC_GetCurrentTop(s32 chan); |
| 114 | +s32 MIC_UpdateIndex(s32 chan, s32 index, s32 samples); |
| 115 | +s32 MIC_GetSamplesLeft(s32 chan, s32 index); |
| 116 | +s32 MIC_GetSamples(s32 chan, s16 *buffer, s32 index, s32 samples); |
| 117 | + |
| 118 | +MICCallback MIC_SetExiCallback(s32 chan, MICCallback exiCallback); |
| 119 | +MICCallback MIC_SetTxCallback(s32 chan, MICCallback txCallback); |
| 120 | + |
| 121 | +#ifdef __cplusplus |
| 122 | + } |
| 123 | +#endif /* __cplusplus */ |
| 124 | + |
| 125 | +#endif |
0 commit comments