| 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
| 2 | * Mupen64plus - Audio_1.2.h * |
| 3 | * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * |
| 4 | * Copyright (C) 2007-2008 Richard42 Ebenblues * |
| 5 | * Copyright (C) 2002 Zilmar * |
| 6 | * * |
| 7 | * This program is free software; you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU General Public License as published by * |
| 9 | * the Free Software Foundation; either version 2 of the License, or * |
| 10 | * (at your option) any later version. * |
| 11 | * * |
| 12 | * This program is distributed in the hope that it will be useful, * |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 15 | * GNU General Public License for more details. * |
| 16 | * * |
| 17 | * You should have received a copy of the GNU General Public License * |
| 18 | * along with this program; if not, write to the * |
| 19 | * Free Software Foundation, Inc., * |
| 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
| 21 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 22 | |
| 23 | /********************************************************************************** |
| 24 | Notes: |
| 25 | ------ |
| 26 | |
| 27 | Setting the approprate bits in the MI_INTR_REG and calling CheckInterrupts which |
| 28 | are both passed to the DLL in InitiateAudio will generate an Interrupt from with in |
| 29 | the plugin. |
| 30 | |
| 31 | **********************************************************************************/ |
| 32 | #ifndef _AUDIO_H_INCLUDED__ |
| 33 | #define _AUDIO_H_INCLUDED__ |
| 34 | |
| 35 | #if defined(__cplusplus) |
| 36 | extern "C" { |
| 37 | #endif |
| 38 | |
| 39 | /* Note: BOOL, BYTE, WORD, DWORD, TRUE, FALSE are defined in windows.h */ |
| 40 | |
| 41 | #define PLUGIN_TYPE_AUDIO 3 |
| 42 | |
| 43 | #define EXPORT __declspec(dllexport) |
| 44 | #define CALL _cdecl |
| 45 | |
| 46 | #define SYSTEM_NTSC 0 |
| 47 | #define SYSTEM_PAL 1 |
| 48 | #define SYSTEM_MPAL 2 |
| 49 | |
| 50 | #ifndef __PLUGIN_INFO__ |
| 51 | #define __PLUGIN_INFO__ |
| 52 | /***** Structures *****/ |
| 53 | typedef struct { |
| 54 | WORD Version; /* Should be set to 0x0101 */ |
| 55 | WORD Type; /* Set to PLUGIN_TYPE_AUDIO */ |
| 56 | char Name[100]; /* Name of the DLL */ |
| 57 | |
| 58 | /* If DLL supports memory these memory options then set them to TRUE or FALSE |
| 59 | if it does not support it */ |
| 60 | BOOL NormalMemory; /* a normal BYTE array */ |
| 61 | BOOL MemoryBswaped; /* a normal BYTE array where the memory has been pre |
| 62 | bswap on a dword (32 bits) boundry */ |
| 63 | } PLUGIN_INFO; |
| 64 | #endif //__PLUGIN_INFO__ |
| 65 | |
| 66 | typedef struct { |
| 67 | HWND hwnd; |
| 68 | HINSTANCE hinst; |
| 69 | |
| 70 | BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre |
| 71 | // bswap on a dword (32 bits) boundry |
| 72 | // eg. the first 8 bytes are stored like this: |
| 73 | // 4 3 2 1 8 7 6 5 |
| 74 | BYTE * HEADER; // This is the rom header (first 40h bytes of the rom |
| 75 | // This will be in the same memory format as the rest of the memory. |
| 76 | BYTE * RDRAM; |
| 77 | BYTE * DMEM; |
| 78 | BYTE * IMEM; |
| 79 | |
| 80 | DWORD * MI_INTR_REG; |
| 81 | |
| 82 | DWORD * AI_DRAM_ADDR_REG; |
| 83 | DWORD * AI_LEN_REG; |
| 84 | DWORD * AI_CONTROL_REG; |
| 85 | DWORD * AI_STATUS_REG; |
| 86 | DWORD * AI_DACRATE_REG; |
| 87 | DWORD * AI_BITRATE_REG; |
| 88 | |
| 89 | void (*CheckInterrupts)( void ); |
| 90 | } AUDIO_INFO; |
| 91 | |
| 92 | /****************************************************************** |
| 93 | Function: AiDacrateChanged |
| 94 | Purpose: This function is called to notify the dll that the |
| 95 | AiDacrate registers value has been changed. |
| 96 | input: The System type: |
| 97 | SYSTEM_NTSC 0 |
| 98 | SYSTEM_PAL 1 |
| 99 | SYSTEM_MPAL 2 |
| 100 | output: none |
| 101 | *******************************************************************/ |
| 102 | EXPORT void CALL AiDacrateChanged (int SystemType); |
| 103 | |
| 104 | /****************************************************************** |
| 105 | Function: AiLenChanged |
| 106 | Purpose: This function is called to notify the dll that the |
| 107 | AiLen registers value has been changed. |
| 108 | input: none |
| 109 | output: none |
| 110 | *******************************************************************/ |
| 111 | EXPORT void CALL AiLenChanged (void); |
| 112 | |
| 113 | /****************************************************************** |
| 114 | Function: AiReadLength |
| 115 | Purpose: This function is called to allow the dll to return the |
| 116 | value that AI_LEN_REG should equal |
| 117 | input: none |
| 118 | output: The amount of bytes still left to play. |
| 119 | *******************************************************************/ |
| 120 | EXPORT DWORD CALL AiReadLength (void); |
| 121 | |
| 122 | /****************************************************************** |
| 123 | Function: AiUpdate |
| 124 | Purpose: This function is called to allow the dll to update |
| 125 | things on a regular basis (check how long to sound to |
| 126 | go, copy more stuff to the buffer, anyhting you like). |
| 127 | The function is designed to go in to the message loop |
| 128 | of the main window ... but can be placed anywhere you |
| 129 | like. |
| 130 | input: if Wait is set to true, then this function should wait |
| 131 | till there is a messgae in the its message queue. |
| 132 | output: none |
| 133 | *******************************************************************/ |
| 134 | EXPORT void CALL AiUpdate (BOOL Wait); |
| 135 | |
| 136 | /****************************************************************** |
| 137 | Function: CloseDLL |
| 138 | Purpose: This function is called when the emulator is closing |
| 139 | down allowing the dll to de-initialise. |
| 140 | input: none |
| 141 | output: none |
| 142 | *******************************************************************/ |
| 143 | EXPORT void CALL CloseDLL (void); |
| 144 | |
| 145 | /****************************************************************** |
| 146 | Function: DllAbout |
| 147 | Purpose: This function is optional function that is provided |
| 148 | to give further information about the DLL. |
| 149 | input: a handle to the window that calls this function |
| 150 | output: none |
| 151 | *******************************************************************/ |
| 152 | EXPORT void CALL DllAbout ( HWND hParent ); |
| 153 | |
| 154 | /****************************************************************** |
| 155 | Function: DllConfig |
| 156 | Purpose: This function is optional function that is provided |
| 157 | to allow the user to configure the dll |
| 158 | input: a handle to the window that calls this function |
| 159 | output: none |
| 160 | *******************************************************************/ |
| 161 | EXPORT void CALL DllConfig ( HWND hParent ); |
| 162 | |
| 163 | /****************************************************************** |
| 164 | Function: DllTest |
| 165 | Purpose: This function is optional function that is provided |
| 166 | to allow the user to test the dll |
| 167 | input: a handle to the window that calls this function |
| 168 | output: none |
| 169 | *******************************************************************/ |
| 170 | EXPORT void CALL DllTest ( HWND hParent ); |
| 171 | |
| 172 | /****************************************************************** |
| 173 | Function: GetDllInfo |
| 174 | Purpose: This function allows the emulator to gather information |
| 175 | about the dll by filling in the PluginInfo structure. |
| 176 | input: a pointer to a PLUGIN_INFO stucture that needs to be |
| 177 | filled by the function. (see def above) |
| 178 | output: none |
| 179 | *******************************************************************/ |
| 180 | EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo ); |
| 181 | |
| 182 | /****************************************************************** |
| 183 | Function: InitiateSound |
| 184 | Purpose: This function is called when the DLL is started to give |
| 185 | information from the emulator that the n64 audio |
| 186 | interface needs |
| 187 | Input: Audio_Info is passed to this function which is defined |
| 188 | above. |
| 189 | Output: TRUE on success |
| 190 | FALSE on failure to initialise |
| 191 | |
| 192 | ** note on interrupts **: |
| 193 | To generate an interrupt set the appropriate bit in MI_INTR_REG |
| 194 | and then call the function CheckInterrupts to tell the emulator |
| 195 | that there is a waiting interrupt. |
| 196 | *******************************************************************/ |
| 197 | EXPORT BOOL CALL InitiateAudio (AUDIO_INFO Audio_Info); |
| 198 | |
| 199 | /****************************************************************** |
| 200 | Function: ProcessAList |
| 201 | Purpose: This function is called when there is a Alist to be |
| 202 | processed. The Dll will have to work out all the info |
| 203 | about the AList itself. |
| 204 | input: none |
| 205 | output: none |
| 206 | *******************************************************************/ |
| 207 | EXPORT void CALL ProcessAList(void); |
| 208 | |
| 209 | /****************************************************************** |
| 210 | Function: RomClosed |
| 211 | Purpose: This function is called when a rom is closed. |
| 212 | input: none |
| 213 | output: none |
| 214 | *******************************************************************/ |
| 215 | EXPORT void CALL RomClosed (void); |
| 216 | |
| 217 | /****************************************************************** |
| 218 | Function: PauseAudio |
| 219 | Purpose: This function is called when plugin should pause or |
| 220 | re-enable sound. Audio should be enabled by default. |
| 221 | input: TRUE when audio should be paused. |
| 222 | FALSE when audio sould continue playing. |
| 223 | output: TRUE when audio is paused. |
| 224 | FALSE when audio plays. |
| 225 | *******************************************************************/ |
| 226 | EXPORT BOOL CALL PauseAudio (BOOL Pause); |
| 227 | |
| 228 | /****************************************************************** |
| 229 | NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE |
| 230 | ORIGINAL SPEC |
| 231 | Function: SetConfigDir |
| 232 | Purpose: To pass the location where config files should be read/ |
| 233 | written to. |
| 234 | input: path to config directory |
| 235 | output: none |
| 236 | *******************************************************************/ |
| 237 | EXPORT void CALL SetConfigDir( char *configDir ); |
| 238 | |
| 239 | /****************************************************************** |
| 240 | NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE |
| 241 | ORIGINAL SPEC |
| 242 | Function: VolumeUp |
| 243 | Purpose: To increase the audio volume |
| 244 | input: none |
| 245 | output: none |
| 246 | *******************************************************************/ |
| 247 | EXPORT void CALL VolumeUp(void); |
| 248 | |
| 249 | /****************************************************************** |
| 250 | NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE |
| 251 | ORIGINAL SPEC |
| 252 | Function: VolumeDown |
| 253 | Purpose: To decrease the audio volume |
| 254 | input: none |
| 255 | output: none |
| 256 | *******************************************************************/ |
| 257 | EXPORT void CALL VolumeDown(void); |
| 258 | |
| 259 | /****************************************************************** |
| 260 | NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE |
| 261 | ORIGINAL SPEC |
| 262 | Function: VolumeMute |
| 263 | Purpose: Toggles between muted and not muted |
| 264 | input: none |
| 265 | output: none |
| 266 | *******************************************************************/ |
| 267 | EXPORT void CALL VolumeMute(void); |
| 268 | |
| 269 | /****************************************************************** |
| 270 | NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE |
| 271 | ORIGINAL SPEC |
| 272 | Function: VolumeGet |
| 273 | Purpose: Return the current volume level |
| 274 | input: none |
| 275 | output: string containing volume level state (percentage or mute) |
| 276 | *******************************************************************/ |
| 277 | EXPORT const char * CALL VolumeGetString(void); |
| 278 | |
| 279 | |
| 280 | #if defined(__cplusplus) |
| 281 | } |
| 282 | #endif |
| 283 | |
| 284 | #endif |
| 285 | |