win32: microphone hotkey, sample loader, and display
This commit is contained in:
parent
07e090c224
commit
dd60bc24a3
|
@ -1,6 +1,13 @@
|
||||||
#ifndef MIC_H
|
#ifndef MIC_H
|
||||||
#define MIC_H
|
#define MIC_H
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
extern int MicButtonPressed;
|
||||||
|
static char MicSampleName[256];
|
||||||
|
char* LoadSample(const char *name);
|
||||||
|
extern int MicDisplay;
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL Mic_Init();
|
BOOL Mic_Init();
|
||||||
void Mic_Reset();
|
void Mic_Reset();
|
||||||
void Mic_DeInit();
|
void Mic_DeInit();
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "inputdx.h"
|
#include "inputdx.h"
|
||||||
#include "render3d.h"
|
#include "render3d.h"
|
||||||
#include "throttle.h"
|
#include "throttle.h"
|
||||||
|
#include "../mic.h"
|
||||||
|
|
||||||
SCustomKeys CustomKeys;
|
SCustomKeys CustomKeys;
|
||||||
|
|
||||||
|
@ -146,6 +147,9 @@ void HK_StateQuickLoadSlot(int)
|
||||||
HK_StateLoadSlot(lastSaveState);
|
HK_StateLoadSlot(lastSaveState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HK_MicrophoneKeyDown(int) {MicButtonPressed =1;}
|
||||||
|
void HK_MicrophoneKeyUp(int) {MicButtonPressed =0;}
|
||||||
|
|
||||||
void HK_AutoHoldClearKeyDown(int) {
|
void HK_AutoHoldClearKeyDown(int) {
|
||||||
|
|
||||||
for (int i=0; i < 10; i++) {
|
for (int i=0; i < 10; i++) {
|
||||||
|
@ -356,6 +360,13 @@ void InitCustomKeys (SCustomKeys *keys)
|
||||||
keys->PrintScreen.page = HOTKEY_PAGE_MAIN;
|
keys->PrintScreen.page = HOTKEY_PAGE_MAIN;
|
||||||
keys->PrintScreen.key = VK_PAUSE;
|
keys->PrintScreen.key = VK_PAUSE;
|
||||||
|
|
||||||
|
keys->Microphone.handleKeyDown = HK_MicrophoneKeyDown;
|
||||||
|
keys->Microphone.handleKeyUp = HK_MicrophoneKeyUp;
|
||||||
|
keys->Microphone.code = "Microphone";
|
||||||
|
keys->Microphone.name = L"Microphone";
|
||||||
|
keys->Microphone.page = HOTKEY_PAGE_MAIN;
|
||||||
|
keys->Microphone.key = NULL;
|
||||||
|
|
||||||
keys->QuickSave.handleKeyDown = HK_StateQuickSaveSlot;
|
keys->QuickSave.handleKeyDown = HK_StateQuickSaveSlot;
|
||||||
keys->QuickSave.code = "QuickSave";
|
keys->QuickSave.code = "QuickSave";
|
||||||
keys->QuickSave.name = L"Quick Save";
|
keys->QuickSave.name = L"Quick Save";
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct SCustomKeys
|
||||||
SCustomKey Slot[10];
|
SCustomKey Slot[10];
|
||||||
SCustomKey QuickSave, QuickLoad;
|
SCustomKey QuickSave, QuickLoad;
|
||||||
|
|
||||||
SCustomKey Pause, FrameAdvance, FastForward, FastForwardToggle, IncreaseSpeed, DecreaseSpeed;
|
SCustomKey Pause, FrameAdvance, FastForward, FastForwardToggle, IncreaseSpeed, DecreaseSpeed, Microphone;
|
||||||
|
|
||||||
SCustomKey TurboRight, TurboLeft, TurboDown, TurboUp, TurboSelect, TurboStart, TurboB, TurboA, TurboY, TurboX;
|
SCustomKey TurboRight, TurboLeft, TurboDown, TurboUp, TurboSelect, TurboStart, TurboB, TurboA, TurboY, TurboX;
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#include "gbaslot_config.h"
|
#include "gbaslot_config.h"
|
||||||
#include "cheatsWin.h"
|
#include "cheatsWin.h"
|
||||||
|
|
||||||
|
#include "../mic.h"
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "hotkey.h"
|
#include "hotkey.h"
|
||||||
|
@ -220,7 +221,9 @@ bool frameCounterDisplay = false;
|
||||||
bool FpsDisplay = false;
|
bool FpsDisplay = false;
|
||||||
bool ShowInputDisplay = false;
|
bool ShowInputDisplay = false;
|
||||||
bool ShowLagFrameCounter = false;
|
bool ShowLagFrameCounter = false;
|
||||||
|
bool ShowMicrophone = false;
|
||||||
bool HudEditorMode = false;
|
bool HudEditorMode = false;
|
||||||
|
bool UseMicSample = false;
|
||||||
unsigned short windowSize = 0;
|
unsigned short windowSize = 0;
|
||||||
|
|
||||||
struct HudCoordinates{
|
struct HudCoordinates{
|
||||||
|
@ -239,6 +242,7 @@ struct HudStruct {
|
||||||
HudCoordinates FrameCounter;
|
HudCoordinates FrameCounter;
|
||||||
HudCoordinates InputDisplay;
|
HudCoordinates InputDisplay;
|
||||||
HudCoordinates LagFrameCounter;
|
HudCoordinates LagFrameCounter;
|
||||||
|
HudCoordinates Microphone;
|
||||||
HudCoordinates Dummy;
|
HudCoordinates Dummy;
|
||||||
|
|
||||||
HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; }
|
HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; }
|
||||||
|
@ -328,6 +332,11 @@ void ResetHud(HudStruct *hudstruct) {
|
||||||
hudstruct->LagFrameCounter.y=65;
|
hudstruct->LagFrameCounter.y=65;
|
||||||
hudstruct->LagFrameCounter.xsize=30;
|
hudstruct->LagFrameCounter.xsize=30;
|
||||||
hudstruct->LagFrameCounter.ysize=10;
|
hudstruct->LagFrameCounter.ysize=10;
|
||||||
|
|
||||||
|
hudstruct->Microphone.x=0;
|
||||||
|
hudstruct->Microphone.y=85;
|
||||||
|
hudstruct->Microphone.xsize=20;
|
||||||
|
hudstruct->Microphone.ysize=10;
|
||||||
|
|
||||||
SetHudDummy(&hudstruct->Dummy);
|
SetHudDummy(&hudstruct->Dummy);
|
||||||
}
|
}
|
||||||
|
@ -361,6 +370,7 @@ struct NDS_fw_config_data win_fw_config;
|
||||||
LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp);
|
LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp);
|
||||||
LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
LRESULT CALLBACK MicrophoneSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
struct configured_features {
|
struct configured_features {
|
||||||
|
@ -1120,6 +1130,7 @@ DWORD WINAPI run()
|
||||||
if (frameCounterDisplay) osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d",frameCounter);
|
if (frameCounterDisplay) osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d",frameCounter);
|
||||||
if (ShowInputDisplay) osd->addFixed(Hud.InputDisplay.x, Hud.InputDisplay.y, "%s",InputDisplayString.c_str());
|
if (ShowInputDisplay) osd->addFixed(Hud.InputDisplay.x, Hud.InputDisplay.y, "%s",InputDisplayString.c_str());
|
||||||
if (ShowLagFrameCounter) osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames);
|
if (ShowLagFrameCounter) osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames);
|
||||||
|
if (ShowMicrophone) osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay);
|
||||||
DisplayMessage();
|
DisplayMessage();
|
||||||
CheckMessages();
|
CheckMessages();
|
||||||
}
|
}
|
||||||
|
@ -1217,6 +1228,7 @@ int MenuInit()
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, FpsDisplay ? MF_CHECKED : MF_UNCHECKED);
|
MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, FpsDisplay ? MF_CHECKED : MF_UNCHECKED);
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, ShowInputDisplay ? MF_CHECKED : MF_UNCHECKED);
|
MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, ShowInputDisplay ? MF_CHECKED : MF_UNCHECKED);
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, ShowLagFrameCounter ? MF_CHECKED : MF_UNCHECKED);
|
MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, ShowLagFrameCounter ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, ShowMicrophone ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
|
||||||
MainWindow->checkMenu(IDC_WINDOW1X, MF_BYCOMMAND | ((windowSize==1)?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(IDC_WINDOW1X, MF_BYCOMMAND | ((windowSize==1)?MF_CHECKED:MF_UNCHECKED));
|
||||||
MainWindow->checkMenu(IDC_WINDOW1_5X, MF_BYCOMMAND | ((windowSize==65535)?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(IDC_WINDOW1_5X, MF_BYCOMMAND | ((windowSize==65535)?MF_CHECKED:MF_UNCHECKED));
|
||||||
|
@ -1443,6 +1455,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
frameCounterDisplay = GetPrivateProfileInt("Display","FrameCounter", 0, IniName);
|
frameCounterDisplay = GetPrivateProfileInt("Display","FrameCounter", 0, IniName);
|
||||||
ShowInputDisplay = GetPrivateProfileInt("Display","Display Input", 0, IniName);
|
ShowInputDisplay = GetPrivateProfileInt("Display","Display Input", 0, IniName);
|
||||||
ShowLagFrameCounter = GetPrivateProfileInt("Display","Display Lag Counter", 0, IniName);
|
ShowLagFrameCounter = GetPrivateProfileInt("Display","Display Lag Counter", 0, IniName);
|
||||||
|
ShowMicrophone = GetPrivateProfileInt("Display","Display Microphone", 0, IniName);
|
||||||
ScreenGap = GetPrivateProfileInt("Display", "ScreenGap", 0, IniName);
|
ScreenGap = GetPrivateProfileInt("Display", "ScreenGap", 0, IniName);
|
||||||
FrameLimit = GetPrivateProfileInt("FrameLimit", "FrameLimit", 1, IniName);
|
FrameLimit = GetPrivateProfileInt("FrameLimit", "FrameLimit", 1, IniName);
|
||||||
//sprintf(text, "%s", DESMUME_NAME_AND_VERSION);
|
//sprintf(text, "%s", DESMUME_NAME_AND_VERSION);
|
||||||
|
@ -2228,7 +2241,8 @@ enum CONFIGSCREEN
|
||||||
CONFIGSCREEN_FIRMWARE,
|
CONFIGSCREEN_FIRMWARE,
|
||||||
CONFIGSCREEN_WIFI,
|
CONFIGSCREEN_WIFI,
|
||||||
CONFIGSCREEN_SOUND,
|
CONFIGSCREEN_SOUND,
|
||||||
CONFIGSCREEN_EMULATION
|
CONFIGSCREEN_EMULATION,
|
||||||
|
CONFIGSCREEN_MICROPHONE
|
||||||
};
|
};
|
||||||
|
|
||||||
void RunConfig(CONFIGSCREEN which)
|
void RunConfig(CONFIGSCREEN which)
|
||||||
|
@ -2258,6 +2272,9 @@ void RunConfig(CONFIGSCREEN which)
|
||||||
case CONFIGSCREEN_EMULATION:
|
case CONFIGSCREEN_EMULATION:
|
||||||
DialogBox(hAppInst, MAKEINTRESOURCE(IDD_EMULATIONSETTINGS), hwnd, (DLGPROC)EmulationSettingsDlgProc);
|
DialogBox(hAppInst, MAKEINTRESOURCE(IDD_EMULATIONSETTINGS), hwnd, (DLGPROC)EmulationSettingsDlgProc);
|
||||||
break;
|
break;
|
||||||
|
case CONFIGSCREEN_MICROPHONE:
|
||||||
|
DialogBox(hAppInst, MAKEINTRESOURCE(IDD_MICROPHONE), hwnd, (DLGPROC)MicrophoneSettingsDlgProc);
|
||||||
|
break;
|
||||||
case CONFIGSCREEN_WIFI:
|
case CONFIGSCREEN_WIFI:
|
||||||
#ifdef EXPERIMENTAL_WIFI
|
#ifdef EXPERIMENTAL_WIFI
|
||||||
if(wifiMac.netEnabled)
|
if(wifiMac.netEnabled)
|
||||||
|
@ -2698,6 +2715,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
case IDM_EMULATIONSETTINGS:
|
case IDM_EMULATIONSETTINGS:
|
||||||
RunConfig(CONFIGSCREEN_EMULATION);
|
RunConfig(CONFIGSCREEN_EMULATION);
|
||||||
return 0;
|
return 0;
|
||||||
|
case IDM_MICROPHONESETTINGS:
|
||||||
|
RunConfig(CONFIGSCREEN_MICROPHONE);
|
||||||
|
return 0;
|
||||||
|
|
||||||
case IDM_GAME_INFO:
|
case IDM_GAME_INFO:
|
||||||
{
|
{
|
||||||
|
@ -2901,6 +2921,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
osd->clear();
|
osd->clear();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case ID_VIEW_DISPLAYMICROPHONE:
|
||||||
|
ShowMicrophone ^= 1;
|
||||||
|
MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, ShowMicrophone ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
WritePrivateProfileInt("Display", "Display Microphone", ShowMicrophone, IniName);
|
||||||
|
osd->clear();
|
||||||
|
return 0;
|
||||||
|
|
||||||
#define clearsaver() \
|
#define clearsaver() \
|
||||||
MainWindow->checkMenu(IDC_SAVETYPE1, MF_BYCOMMAND | MF_UNCHECKED); \
|
MainWindow->checkMenu(IDC_SAVETYPE1, MF_BYCOMMAND | MF_UNCHECKED); \
|
||||||
MainWindow->checkMenu(IDC_SAVETYPE2, MF_BYCOMMAND | MF_UNCHECKED); \
|
MainWindow->checkMenu(IDC_SAVETYPE2, MF_BYCOMMAND | MF_UNCHECKED); \
|
||||||
|
@ -3406,6 +3433,104 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK MicrophoneSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch(uMsg)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
HWND cur;
|
||||||
|
|
||||||
|
UseMicSample = GetPrivateProfileInt("Use Mic Sample", "UseMicSample", FALSE, IniName);
|
||||||
|
CheckDlgButton(hDlg, IDC_USEMICSAMPLE, ((UseMicSample == true) ? BST_CHECKED : BST_UNCHECKED));
|
||||||
|
GetPrivateProfileString("Use Mic Sample", "MicSampleFile", "micsample.raw", MicSampleName, MAX_PATH, IniName);
|
||||||
|
SetDlgItemText(hDlg, IDC_MICSAMPLE, MicSampleName);
|
||||||
|
|
||||||
|
if(UseMicSample == false)
|
||||||
|
{
|
||||||
|
cur = GetDlgItem(hDlg, IDC_MICSAMPLE);
|
||||||
|
EnableWindow(cur, FALSE);
|
||||||
|
cur = GetDlgItem(hDlg, IDC_MICSAMPLEBROWSE);
|
||||||
|
EnableWindow(cur, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch(LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDOK:
|
||||||
|
{
|
||||||
|
int val = 0;
|
||||||
|
|
||||||
|
if((!romloaded) || (val == IDYES))
|
||||||
|
{
|
||||||
|
HWND cur;
|
||||||
|
|
||||||
|
UseMicSample = IsDlgButtonChecked(hDlg, IDC_USEMICSAMPLE);
|
||||||
|
cur = GetDlgItem(hDlg, IDC_MICSAMPLE);
|
||||||
|
GetWindowText(cur, MicSampleName, 256);
|
||||||
|
|
||||||
|
WritePrivateProfileInt("Use Mic Sample", "UseMicSample", ((UseMicSample == true) ? 1 : 0), IniName);
|
||||||
|
WritePrivateProfileString("Use Mic Sample", "MicSampleFile", MicSampleName, IniName);
|
||||||
|
LoadSample(MicSampleName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case IDCANCEL:
|
||||||
|
{
|
||||||
|
EndDialog(hDlg, TRUE);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case IDC_USEMICSAMPLE:
|
||||||
|
{
|
||||||
|
HWND cur;
|
||||||
|
BOOL enable = IsDlgButtonChecked(hDlg, IDC_USEMICSAMPLE);
|
||||||
|
|
||||||
|
cur = GetDlgItem(hDlg, IDC_MICSAMPLE);
|
||||||
|
EnableWindow(cur, enable);
|
||||||
|
cur = GetDlgItem(hDlg, IDC_MICSAMPLEBROWSE);
|
||||||
|
EnableWindow(cur, enable);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case IDC_MICSAMPLEBROWSE:
|
||||||
|
{
|
||||||
|
char fileName[256] = "";
|
||||||
|
OPENFILENAME ofn;
|
||||||
|
|
||||||
|
ZeroMemory(&ofn, sizeof(ofn));
|
||||||
|
ofn.lStructSize = sizeof(ofn);
|
||||||
|
ofn.hwndOwner = hDlg;
|
||||||
|
ofn.lpstrFilter = "Any file(*.*)\0*.*\0\0";
|
||||||
|
ofn.nFilterIndex = 1;
|
||||||
|
ofn.lpstrFile = fileName;
|
||||||
|
ofn.nMaxFile = 256;
|
||||||
|
ofn.lpstrDefExt = "bin";
|
||||||
|
ofn.Flags = OFN_NOCHANGEDIR;
|
||||||
|
|
||||||
|
if(GetOpenFileName(&ofn))
|
||||||
|
{
|
||||||
|
HWND cur;
|
||||||
|
|
||||||
|
switch(LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_MICSAMPLEBROWSE: cur = GetDlgItem(hDlg, IDC_MICSAMPLE); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetWindowText(cur, fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
#ifdef EXPERIMENTAL_WIFI
|
#ifdef EXPERIMENTAL_WIFI
|
||||||
|
|
|
@ -12,6 +12,12 @@
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
#include "../debug.h"
|
#include "../debug.h"
|
||||||
#include "../mic.h"
|
#include "../mic.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
int MicDisplay;
|
||||||
|
int MicButtonPressed=0;
|
||||||
|
int SampleLoaded=0;
|
||||||
|
|
||||||
#define MIC_CHECKERR(hr) if(hr != MMSYSERR_NOERROR) return FALSE;
|
#define MIC_CHECKERR(hr) if(hr != MMSYSERR_NOERROR) return FALSE;
|
||||||
|
|
||||||
|
@ -51,8 +57,27 @@ static int CALLBACK waveInProc(HWAVEIN wavein, UINT msg, DWORD instance, DWORD p
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL Mic_Init()
|
char* samplebuffer;
|
||||||
|
int samplebuffersize;
|
||||||
|
FILE* fp;
|
||||||
|
|
||||||
|
char* LoadSample(const char *name)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
std::ifstream fl(name);
|
||||||
|
fl.seekg( 0, std::ios::end );
|
||||||
|
size_t len = fl.tellg();
|
||||||
|
samplebuffersize=len;
|
||||||
|
char *ret = new char[len];
|
||||||
|
fl.seekg(0, std::ios::beg);
|
||||||
|
fl.read(ret, len);
|
||||||
|
samplebuffer=ret;
|
||||||
|
SampleLoaded=1;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL Mic_Init() {
|
||||||
|
|
||||||
if(Mic_Inited)
|
if(Mic_Inited)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -123,21 +148,44 @@ void Mic_DeInit()
|
||||||
waveInClose(waveIn);
|
waveInClose(waveIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int random[32] = {0xB1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE9, 0x70,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x28, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x20, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE9};
|
||||||
|
|
||||||
|
int x=0;
|
||||||
|
|
||||||
u8 Mic_ReadSample()
|
u8 Mic_ReadSample()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!Mic_Inited)
|
if(!Mic_Inited)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
u8 tmp = Mic_Buffer[Mic_PlayBuf][Mic_BufPos >> 1];
|
|
||||||
u8 ret;
|
u8 ret;
|
||||||
|
|
||||||
if(Mic_BufPos & 0x1)
|
if(MicButtonPressed)
|
||||||
{
|
if(SampleLoaded) { //use a sample
|
||||||
ret = ((tmp & 0x1) << 7);
|
x++;
|
||||||
}
|
if(x > samplebuffersize)
|
||||||
else
|
x=0;
|
||||||
{
|
ret=samplebuffer[x];
|
||||||
ret = ((tmp & 0xFE) >> 1);
|
}
|
||||||
|
else { //use the "random" values
|
||||||
|
x++;
|
||||||
|
if(x > ARRAYSIZE(random))
|
||||||
|
x=0;
|
||||||
|
ret = random[x];
|
||||||
|
}
|
||||||
|
else { //normal mic behavior
|
||||||
|
u8 tmp = (u8)Mic_Buffer[Mic_BufPos >> 1];
|
||||||
|
|
||||||
|
if(Mic_BufPos & 0x1)
|
||||||
|
{
|
||||||
|
ret = ((tmp & 0x1) << 7);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = ((tmp & 0xFE) >> 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mic_BufPos++;
|
Mic_BufPos++;
|
||||||
|
@ -147,5 +195,7 @@ u8 Mic_ReadSample()
|
||||||
Mic_PlayBuf ^= 1;
|
Mic_PlayBuf ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MicDisplay = ret;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
|
@ -404,6 +404,11 @@
|
||||||
#define IDC_GI_ARM7SIZE 4486
|
#define IDC_GI_ARM7SIZE 4486
|
||||||
#define IDC_GI_FNTOFS 4487
|
#define IDC_GI_FNTOFS 4487
|
||||||
#define IDC_GI_FNTSIZE 4488
|
#define IDC_GI_FNTSIZE 4488
|
||||||
|
#define IDD_MICROPHONE 5000
|
||||||
|
#define IDM_MICROPHONESETTINGS 5001
|
||||||
|
#define IDC_MICSAMPLEBROWSE 5003
|
||||||
|
#define IDC_MICSAMPLE 5004
|
||||||
|
#define IDC_USEMICSAMPLE 5005
|
||||||
#define IDM_SCREENSEP_NONE 40000
|
#define IDM_SCREENSEP_NONE 40000
|
||||||
#define IDM_SCREENSEP_BORDER 40001
|
#define IDM_SCREENSEP_BORDER 40001
|
||||||
#define IDM_SCREENSEP_NDSGAP 40002
|
#define IDM_SCREENSEP_NDSGAP 40002
|
||||||
|
@ -416,7 +421,8 @@
|
||||||
#define ID_VIEW_DISPLAYFPS 40010
|
#define ID_VIEW_DISPLAYFPS 40010
|
||||||
#define ID_VIEW_DISPLAYINPUT 40011
|
#define ID_VIEW_DISPLAYINPUT 40011
|
||||||
#define ID_VIEW_DISPLAYLAG 40012
|
#define ID_VIEW_DISPLAYLAG 40012
|
||||||
#define ID_VIEW_HUDEDITOR 40013
|
#define ID_VIEW_HUDEDITOR 40013
|
||||||
|
#define ID_VIEW_DISPLAYMICROPHONE 40014
|
||||||
#define IDM_FILE_RECORDAVI 40015
|
#define IDM_FILE_RECORDAVI 40015
|
||||||
#define IDM_FILE_STOPAVI 40016
|
#define IDM_FILE_STOPAVI 40016
|
||||||
#define ACCEL_CTRL_O 40032
|
#define ACCEL_CTRL_O 40032
|
||||||
|
|
|
@ -115,6 +115,7 @@ MENU_PRINCIPAL MENU
|
||||||
MENUITEM "Display Fps", ID_VIEW_DISPLAYFPS
|
MENUITEM "Display Fps", ID_VIEW_DISPLAYFPS
|
||||||
MENUITEM "Display Input", ID_VIEW_DISPLAYINPUT
|
MENUITEM "Display Input", ID_VIEW_DISPLAYINPUT
|
||||||
MENUITEM "Display Lag Counter", ID_VIEW_DISPLAYLAG
|
MENUITEM "Display Lag Counter", ID_VIEW_DISPLAYLAG
|
||||||
|
MENUITEM "Display Microphone", ID_VIEW_DISPLAYMICROPHONE
|
||||||
MENUITEM "HUD Editing Mode", ID_VIEW_HUDEDITOR
|
MENUITEM "HUD Editing Mode", ID_VIEW_HUDEDITOR
|
||||||
}
|
}
|
||||||
POPUP "&Konfigure"
|
POPUP "&Konfigure"
|
||||||
|
@ -135,6 +136,7 @@ MENU_PRINCIPAL MENU
|
||||||
MENUITEM "Wifi settings", IDM_WIFISETTINGS, GRAYED
|
MENUITEM "Wifi settings", IDM_WIFISETTINGS, GRAYED
|
||||||
MENUITEM "Firmware Indstillinger", IDM_FIRMSETTINGS
|
MENUITEM "Firmware Indstillinger", IDM_FIRMSETTINGS
|
||||||
MENUITEM "Emulation settings", IDM_EMULATIONSETTINGS
|
MENUITEM "Emulation settings", IDM_EMULATIONSETTINGS
|
||||||
|
MENUITEM "Microphone Settings", IDM_MICROPHONESETTINGS
|
||||||
POPUP "&Frame Skip"
|
POPUP "&Frame Skip"
|
||||||
{
|
{
|
||||||
MENUITEM "Limit framerate", IDC_FRAMELIMIT
|
MENUITEM "Limit framerate", IDC_FRAMELIMIT
|
||||||
|
@ -285,6 +287,7 @@ MENU_PRINCIPAL MENU
|
||||||
MENUITEM "Display FPS", ID_VIEW_DISPLAYFPS
|
MENUITEM "Display FPS", ID_VIEW_DISPLAYFPS
|
||||||
MENUITEM "Display Input", ID_VIEW_DISPLAYINPUT
|
MENUITEM "Display Input", ID_VIEW_DISPLAYINPUT
|
||||||
MENUITEM "Display Lag Counter", ID_VIEW_DISPLAYLAG
|
MENUITEM "Display Lag Counter", ID_VIEW_DISPLAYLAG
|
||||||
|
MENUITEM "Display Microphone", ID_VIEW_DISPLAYMICROPHONE
|
||||||
MENUITEM "HUD Editing Mode", ID_VIEW_HUDEDITOR
|
MENUITEM "HUD Editing Mode", ID_VIEW_HUDEDITOR
|
||||||
}
|
}
|
||||||
POPUP "&Config"
|
POPUP "&Config"
|
||||||
|
@ -306,6 +309,7 @@ MENU_PRINCIPAL MENU
|
||||||
MENUITEM "Wifi settings", IDM_WIFISETTINGS, GRAYED
|
MENUITEM "Wifi settings", IDM_WIFISETTINGS, GRAYED
|
||||||
MENUITEM "Firmware Settings", IDM_FIRMSETTINGS
|
MENUITEM "Firmware Settings", IDM_FIRMSETTINGS
|
||||||
MENUITEM "Emulation Settings", IDM_EMULATIONSETTINGS
|
MENUITEM "Emulation Settings", IDM_EMULATIONSETTINGS
|
||||||
|
MENUITEM "Microphone Settings", IDM_MICROPHONESETTINGS
|
||||||
POPUP "&Frame Skip"
|
POPUP "&Frame Skip"
|
||||||
{
|
{
|
||||||
MENUITEM "Limit framerate", IDC_FRAMELIMIT
|
MENUITEM "Limit framerate", IDC_FRAMELIMIT
|
||||||
|
@ -454,6 +458,7 @@ MENU_PRINCIPAL MENU
|
||||||
MENUITEM "Framerate", ID_VIEW_DISPLAYFPS
|
MENUITEM "Framerate", ID_VIEW_DISPLAYFPS
|
||||||
MENUITEM "Display Input", ID_VIEW_DISPLAYINPUT
|
MENUITEM "Display Input", ID_VIEW_DISPLAYINPUT
|
||||||
MENUITEM "Display Lag Counter", ID_VIEW_DISPLAYLAG
|
MENUITEM "Display Lag Counter", ID_VIEW_DISPLAYLAG
|
||||||
|
MENUITEM "Display Microphone", ID_VIEW_DISPLAYMICROPHONE
|
||||||
MENUITEM "HUD Editing Mode", ID_VIEW_HUDEDITOR
|
MENUITEM "HUD Editing Mode", ID_VIEW_HUDEDITOR
|
||||||
}
|
}
|
||||||
POPUP "&Config"
|
POPUP "&Config"
|
||||||
|
@ -474,6 +479,7 @@ MENU_PRINCIPAL MENU
|
||||||
MENUITEM "Config. wifi", IDM_WIFISETTINGS, GRAYED
|
MENUITEM "Config. wifi", IDM_WIFISETTINGS, GRAYED
|
||||||
MENUITEM "Config. du firmware", IDM_FIRMSETTINGS
|
MENUITEM "Config. du firmware", IDM_FIRMSETTINGS
|
||||||
MENUITEM "Config. d'émulation", IDM_EMULATIONSETTINGS
|
MENUITEM "Config. d'émulation", IDM_EMULATIONSETTINGS
|
||||||
|
MENUITEM "Microphone Settings", IDM_MICROPHONESETTINGS
|
||||||
POPUP "&Frame Skip"
|
POPUP "&Frame Skip"
|
||||||
{
|
{
|
||||||
MENUITEM "Limit framerate", IDC_FRAMELIMIT
|
MENUITEM "Limit framerate", IDC_FRAMELIMIT
|
||||||
|
@ -2230,7 +2236,20 @@ FONT 8, "MS Sans Serif", 0, 0, 1
|
||||||
LTEXT "frames", IDC_STATIC, 406, 5, 16, 8, SS_LEFT
|
LTEXT "frames", IDC_STATIC, 406, 5, 16, 8, SS_LEFT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
IDD_MICROPHONE DIALOG 0, 0, 241, 111
|
||||||
|
STYLE DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU
|
||||||
|
CAPTION "Microphone Simulation Settings"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
{
|
||||||
|
DEFPUSHBUTTON "OK", IDOK, 130, 91, 50, 14, BS_DEFPUSHBUTTON
|
||||||
|
PUSHBUTTON "Cancel", IDCANCEL, 185, 91, 50, 14, BS_PUSHBUTTON
|
||||||
|
GROUPBOX "Microphone Sample", IDC_STATIC, 5, 6, 230, 75
|
||||||
|
AUTOCHECKBOX "Use Microphone Sample", IDC_USEMICSAMPLE, 15, 21, 110, 10, BS_AUTOCHECKBOX
|
||||||
|
LTEXT "Sample:", IDC_STATIC, 15, 36, 110, 8, SS_LEFT
|
||||||
|
EDITTEXT IDC_MICSAMPLE, 15, 46, 190, 14, ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "...", IDC_MICSAMPLEBROWSE, 205, 46, 20, 14, BS_PUSHBUTTON
|
||||||
|
}
|
||||||
|
|
||||||
LANGUAGE LANG_DANISH, SUBLANG_DANISH_DENMARK
|
LANGUAGE LANG_DANISH, SUBLANG_DANISH_DENMARK
|
||||||
IDD_OAM DIALOGEX 0, 0, 300, 200
|
IDD_OAM DIALOGEX 0, 0, 300, 200
|
||||||
|
|
Loading…
Reference in New Issue