From 61e4c0bddc52464a37fa0ed7650ab284761a33f3 Mon Sep 17 00:00:00 2001 From: riccardom Date: Sat, 25 Apr 2009 10:21:10 +0000 Subject: [PATCH] Poor man's mic fake implementation, don't expect it to be similar to a blow it's just noise or not. --- desmume/src/gtk/main.cpp | 11 ++++++++++- desmume/src/mic.cpp | 12 +++++++++++- desmume/src/mic.h | 2 ++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index befbac657..f7594ddf0 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -40,6 +40,7 @@ #include "debug.h" #include "rasterize.h" #include "saves.h" +#include "mic.h" #ifdef GDB_STUB #include "gdbstub.h" @@ -115,6 +116,7 @@ static void MenuSave(GtkMenuItem *item, gpointer slot); static void MenuLoad(GtkMenuItem *item, gpointer slot); static void About();//GtkWidget* widget, gpointer data); static void desmume_gtk_disable_audio (GtkToggleAction *action); +static void desmume_gtk_mic_noise (GtkToggleAction *action); static void Modify_Layer(GtkToggleAction* action, gpointer data); static const char *ui_description = @@ -154,6 +156,7 @@ static const char *ui_description = " " " " " " +" " " " " " " " @@ -234,7 +237,8 @@ static const GtkActionEntry action_entries[] = { }; static const GtkToggleActionEntry toggle_entries[] = { - { "enableaudio", NULL, "_Enable audio", NULL, NULL, G_CALLBACK(desmume_gtk_disable_audio), TRUE}//, + { "enableaudio", NULL, "_Enable audio", NULL, NULL, G_CALLBACK(desmume_gtk_disable_audio), TRUE}, + { "micnoise", NULL, "_Fake mic noise", NULL, NULL, G_CALLBACK(desmume_gtk_mic_noise), FALSE}//, }; static const GtkRadioActionEntry frameskip_entries[] = { @@ -1455,6 +1459,11 @@ static void desmume_gtk_disable_audio (GtkToggleAction *action) } } +static void desmume_gtk_mic_noise (GtkToggleAction *action) +{ + Mic_DoNoise((BOOL)gtk_toggle_action_get_active(action)); +} + #if 0 static void desmume_gtk_menu_config (GtkWidget *pMenuBar, int act_savetype) { diff --git a/desmume/src/mic.cpp b/desmume/src/mic.cpp index e072b8a11..afee6dd44 100644 --- a/desmume/src/mic.cpp +++ b/desmume/src/mic.cpp @@ -3,6 +3,8 @@ #include "types.h" #include "mic.h" +static BOOL silence = TRUE; + BOOL Mic_Init() { return TRUE; @@ -18,7 +20,15 @@ void Mic_DeInit() u8 Mic_ReadSample() { - return 0; + if (silence) + return 0; + + return 150; +} + +void Mic_DoNoise(BOOL noise) +{ + silence = !noise; } #endif diff --git a/desmume/src/mic.h b/desmume/src/mic.h index 06c3c9a12..8632f39e0 100644 --- a/desmume/src/mic.h +++ b/desmume/src/mic.h @@ -6,6 +6,8 @@ extern int MicButtonPressed; static char MicSampleName[256]; char* LoadSample(const char *name); extern int MicDisplay; +#else +void Mic_DoNoise(BOOL); #endif BOOL Mic_Init();