From 6af1892f01b4e96b73f5ae0db288ca3c34cffc07 Mon Sep 17 00:00:00 2001 From: TravisCI-DocBuilder Date: Sat, 7 Nov 2015 23:23:39 +0000 Subject: [PATCH] Doc generated from commit 7440ca79015e0480b7ceaea0731ccf92925947d4 --- apt_8h.html | 2 +- audio_2mic_2source_2main_8c-example.html | 115 ++--- csnd_8h.html | 6 +- gfx_8h.html | 8 +- globals_enum.html | 6 + globals_eval_m.html | 24 ++ globals_func_m.html | 68 +-- globals_m.html | 98 +++-- gsp_8h.html | 2 +- hid_8h.html | 6 +- linear_8h.html | 4 +- mic_8h.html | 523 ++++++++++++++--------- mic_8h_source.html | 248 ++++++----- 13 files changed, 690 insertions(+), 420 deletions(-) diff --git a/apt_8h.html b/apt_8h.html index 30b3ecf..9ae3feb 100644 --- a/apt_8h.html +++ b/apt_8h.html @@ -2052,7 +2052,7 @@ Variables

Processes the current APT status.

Generally used within a main loop.

Returns
Whether the application is closing.
-
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
+
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
diff --git a/audio_2mic_2source_2main_8c-example.html b/audio_2mic_2source_2main_8c-example.html index 51fe6c1..0fee17d 100644 --- a/audio_2mic_2source_2main_8c-example.html +++ b/audio_2mic_2source_2main_8c-example.html @@ -88,90 +88,97 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
int main()
{
-
u8 *framebuf;
-
u32 *sharedmem = NULL, sharedmem_size = 0x30000;
-
u8 *audiobuf;
-
u32 audiobuf_size = 0x100000, audiobuf_pos = 0;
-
u8 control=0x40;
-
u32 audio_initialized = 0;
-
-
if(csndInit()==0)
+
bool initialized = true;
+
+
u32 micbuf_size = 0x30000;
+
u32 micbuf_pos = 0;
+
u8* micbuf = memalign(micbuf_size, 0x1000);
+
+
printf("Initializing CSND...\n");
+
{
-
printf("Init success\n");
-
audio_initialized = 1;
-
}
+
initialized = false;
+
printf("Could not initialize CSND.\n");
+
} else printf("CSND initialized.\n");
+
+
printf("Initializing MIC...\n");
+
if(R_FAILED(micInit(micbuf, micbuf_size)))
+
{
+
initialized = false;
+
printf("Could not initialize MIC.\n");
+
} else printf("MIC initialized.\n");
-
sharedmem = (u32*)memalign(0x1000, sharedmem_size);
-
audiobuf = linearAlloc(audiobuf_size);
+
u32 micbuf_datasize = micGetSampleDataSize();
-
MIC_Initialize(sharedmem, sharedmem_size, control, 0, 3, 1, 1);//See mic.h.
+
u32 audiobuf_size = 0x100000;
+
u32 audiobuf_pos = 0;
+
u8* audiobuf = linearAlloc(audiobuf_size);
-
while(aptMainLoop())
+
if(initialized) printf("Hold A to record, release to play.\n");
+
printf("Press START to exit.\n");
+
+
while(aptMainLoop())
{
- - + +
-
u32 kDown = hidKeysDown();
-
if (kDown & KEY_START)
+
u32 kDown = hidKeysDown();
+
if (kDown & KEY_START)
break; // break in order to return to hbmenu
-
if(audio_initialized)
+
if(initialized)
{
-
framebuf = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
-
-
if(kDown & KEY_A)
+
if(kDown & KEY_A)
{
audiobuf_pos = 0;
-
printf("Stopping audio playback\n");
-
CSND_SetPlayState(0x8, 0);//Stop audio playback.
- +
micbuf_pos = 0;
- +
printf("Stopping audio playback...\n");
+ +
if(R_FAILED(CSND_UpdateInfo(0))) printf("Failed to stop audio playback.\n");
-
memset(framebuf, 0x20, 0x46500);
-
printf("Now recording\n");
+
printf("Starting sampling...\n");
+
if(R_SUCCEEDED(MICU_SetPower(true)) && R_SUCCEEDED(MICU_StartSampling(MICU_ENCODING_PCM16_SIGNED, MICU_SAMPLE_RATE_16360, 0, micbuf_datasize, true))) printf("Now recording.\n");
+
else printf("Failed to start sampling.\n");
}
-
if((hidKeysHeld() & KEY_A) && audiobuf_pos < audiobuf_size)
+
if((hidKeysHeld() & KEY_A) && audiobuf_pos < audiobuf_size)
{
-
audiobuf_pos+= MIC_ReadAudioData(&audiobuf[audiobuf_pos], audiobuf_size-audiobuf_pos, 1);
-
if(audiobuf_pos > audiobuf_size)audiobuf_pos = audiobuf_size;
-
-
memset(framebuf, 0x60, 0x46500);
+
u32 micbuf_readpos = micbuf_pos;
+
micbuf_pos = micGetLastSampleOffset();
+
while(audiobuf_pos < audiobuf_size && micbuf_readpos != micbuf_pos)
+
{
+
audiobuf[audiobuf_pos] = micbuf[micbuf_readpos];
+
audiobuf_pos++;
+
micbuf_readpos = (micbuf_readpos + 1) % micbuf_datasize;
+
}
}
-
if(hidKeysUp() & KEY_A)
+
if(hidKeysUp() & KEY_A)
{
-
printf("Playing the recorded sample\n");
- -
GSPGPU_FlushDataCache(NULL, audiobuf, audiobuf_pos);
-
csndPlaySound(0x8, SOUND_ONE_SHOT | SOUND_FORMAT_16BIT, 16000, 1.0, 0.0, (u32*)audiobuf, NULL, audiobuf_pos);
+
printf("Stoping sampling...\n");
+
if(R_FAILED(MICU_StopSampling()) || R_FAILED(MICU_SetPower(false))) printf("Failed to stop sampling.\n");
-
memset(framebuf, 0xe0, 0x46500);
-
- - -
-
framebuf = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
-
memset(framebuf, 0xe0, 0x46500);
+
printf("Starting audio playback...\n");
+
if(R_SUCCEEDED(GSPGPU_FlushDataCache(audiobuf, audiobuf_pos)) && R_SUCCEEDED(csndPlaySound(0x8, SOUND_ONE_SHOT | SOUND_FORMAT_16BIT, 16360, 1.0, 0.0, (u32*)audiobuf, NULL, audiobuf_pos))) printf("Now playing.\n");
+
else printf("Failed to start playback.\n");
}
}
- - + +
}
- -
-
if(audio_initialized)csndExit();
+
linearFree(audiobuf);
-
free(sharedmem);
-
linearFree(audiobuf);
+ +
free(micbuf);
- + +
return 0;
}
diff --git a/csnd_8h.html b/csnd_8h.html index 51a92e6..28a7c84 100644 --- a/csnd_8h.html +++ b/csnd_8h.html @@ -1376,7 +1376,7 @@ Variables
-
Examples:
audio/mic/source/main.c.
+
Examples:
audio/mic/source/main.c.
@@ -1513,7 +1513,7 @@ Variables
-
Examples:
audio/mic/source/main.c.
+
Examples:
audio/mic/source/main.c.
@@ -1840,7 +1840,7 @@ Variables

In this implementation if the loop mode is used, data1 must be in the range [data0 ; data0 + size]. Sound will be played once from data0 to data0 + size and then loop between data1 and data0+size.

-
Examples:
audio/mic/source/main.c.
+
Examples:
audio/mic/source/main.c.
diff --git a/gfx_8h.html b/gfx_8h.html index a7dcd84..a3dd895 100644 --- a/gfx_8h.html +++ b/gfx_8h.html @@ -249,7 +249,7 @@ Variables

Closes the gsp service and frees the framebuffers.

Just call it when you're done.

-
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
+
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, sdmc/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
@@ -269,7 +269,7 @@ Variables

Flushes the current framebuffers.

Use this if the data within your framebuffers changes a lot and that you want to make sure everything was updated correctly. This shouldn't be needed and has a significant overhead.

-
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
+
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
@@ -321,7 +321,7 @@ Variables
Returns
A pointer to the current framebuffer of the choosen screen.

Please remember that the returned pointer will change after each call to gfxSwapBuffers if double buffering is enabled.

-
Examples:
audio/mic/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, http/source/main.c, mvd/source/main.c, qtm/source/main.c, and sdmc/source/main.c.
+
Examples:
graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, http/source/main.c, mvd/source/main.c, qtm/source/main.c, and sdmc/source/main.c.
@@ -531,7 +531,7 @@ You should always call gfxSwapBuffers instead.

-
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
+
Examples:
app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
diff --git a/globals_enum.html b/globals_enum.html index b75e40c..3087c98 100644 --- a/globals_enum.html +++ b/globals_enum.html @@ -339,6 +339,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MemState : svc.h
  • +
  • MICU_Encoding +: mic.h +
  • +
  • MICU_SampleRate +: mic.h +
  • mvdstdMode : mvd.h
  • diff --git a/globals_eval_m.html b/globals_eval_m.html index a9257d5..1fcfbec 100644 --- a/globals_eval_m.html +++ b/globals_eval_m.html @@ -217,6 +217,30 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MEMSTATE_STATIC : svc.h
  • +
  • MICU_ENCODING_PCM16 +: mic.h +
  • +
  • MICU_ENCODING_PCM16_SIGNED +: mic.h +
  • +
  • MICU_ENCODING_PCM8 +: mic.h +
  • +
  • MICU_ENCODING_PCM8_SIGNED +: mic.h +
  • +
  • MICU_SAMPLE_RATE_10910 +: mic.h +
  • +
  • MICU_SAMPLE_RATE_16360 +: mic.h +
  • +
  • MICU_SAMPLE_RATE_32730 +: mic.h +
  • +
  • MICU_SAMPLE_RATE_8180 +: mic.h +
  • MVDMODE_COLORFORMATCONV : mvd.h
  • diff --git a/globals_func_m.html b/globals_func_m.html index 6e8de84..7e49966 100644 --- a/globals_func_m.html +++ b/globals_func_m.html @@ -129,47 +129,59 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • mappableSpaceFree() : mappable.h
  • -
  • MIC_cmd3_Initialize() -: mic.h +
  • micExit() +: mic.h
  • -
  • MIC_cmd5() -: mic.h +
  • micGetLastSampleOffset() +: mic.h
  • -
  • MIC_GetCNTBit15() -: mic.h +
  • micGetSampleDataSize() +: mic.h
  • -
  • MIC_GetControl() -: mic.h +
  • micInit() +: mic.h
  • -
  • MIC_GetEventHandle() -: mic.h +
  • MICU_AdjustSampling() +: mic.h
  • -
  • MIC_GetSharedMemOffsetValue() -: mic.h +
  • MICU_GetClamp() +: mic.h
  • -
  • MIC_Initialize() -: mic.h +
  • MICU_GetEventHandle() +: mic.h
  • -
  • MIC_IsRecoding() -: mic.h +
  • MICU_GetGain() +: mic.h
  • -
  • MIC_MapSharedMem() -: mic.h +
  • MICU_GetPower() +: mic.h
  • -
  • MIC_ReadAudioData() -: mic.h +
  • MICU_IsSampling() +: mic.h
  • -
  • MIC_SetControl() -: mic.h +
  • MICU_MapSharedMem() +: mic.h
  • -
  • MIC_SetRecording() -: mic.h +
  • MICU_SetAllowShellClosed() +: mic.h
  • -
  • MIC_Shutdown() -: mic.h +
  • MICU_SetClamp() +: mic.h
  • -
  • MIC_UnmapSharedMem() -: mic.h +
  • MICU_SetGain() +: mic.h +
  • +
  • MICU_SetPower() +: mic.h +
  • +
  • MICU_StartSampling() +: mic.h +
  • +
  • MICU_StopSampling() +: mic.h +
  • +
  • MICU_UnmapSharedMem() +: mic.h
  • mvdstdExit() : mvd.h diff --git a/globals_m.html b/globals_m.html index a3c7413..cd99ab6 100644 --- a/globals_m.html +++ b/globals_m.html @@ -244,47 +244,89 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MEMSTATE_STATIC : svc.h
  • -
  • MIC_cmd3_Initialize() -: mic.h +
  • micExit() +: mic.h
  • -
  • MIC_cmd5() -: mic.h +
  • micGetLastSampleOffset() +: mic.h
  • -
  • MIC_GetCNTBit15() -: mic.h +
  • micGetSampleDataSize() +: mic.h
  • -
  • MIC_GetControl() -: mic.h +
  • micInit() +: mic.h
  • -
  • MIC_GetEventHandle() -: mic.h +
  • MICU_AdjustSampling() +: mic.h
  • -
  • MIC_GetSharedMemOffsetValue() -: mic.h +
  • MICU_Encoding +: mic.h
  • -
  • MIC_Initialize() -: mic.h +
  • MICU_ENCODING_PCM16 +: mic.h
  • -
  • MIC_IsRecoding() -: mic.h +
  • MICU_ENCODING_PCM16_SIGNED +: mic.h
  • -
  • MIC_MapSharedMem() -: mic.h +
  • MICU_ENCODING_PCM8 +: mic.h
  • -
  • MIC_ReadAudioData() -: mic.h +
  • MICU_ENCODING_PCM8_SIGNED +: mic.h
  • -
  • MIC_SetControl() -: mic.h +
  • MICU_GetClamp() +: mic.h
  • -
  • MIC_SetRecording() -: mic.h +
  • MICU_GetEventHandle() +: mic.h
  • -
  • MIC_Shutdown() -: mic.h +
  • MICU_GetGain() +: mic.h
  • -
  • MIC_UnmapSharedMem() -: mic.h +
  • MICU_GetPower() +: mic.h +
  • +
  • MICU_IsSampling() +: mic.h +
  • +
  • MICU_MapSharedMem() +: mic.h +
  • +
  • MICU_SAMPLE_RATE_10910 +: mic.h +
  • +
  • MICU_SAMPLE_RATE_16360 +: mic.h +
  • +
  • MICU_SAMPLE_RATE_32730 +: mic.h +
  • +
  • MICU_SAMPLE_RATE_8180 +: mic.h +
  • +
  • MICU_SampleRate +: mic.h +
  • +
  • MICU_SetAllowShellClosed() +: mic.h +
  • +
  • MICU_SetClamp() +: mic.h +
  • +
  • MICU_SetGain() +: mic.h +
  • +
  • MICU_SetPower() +: mic.h +
  • +
  • MICU_StartSampling() +: mic.h +
  • +
  • MICU_StopSampling() +: mic.h +
  • +
  • MICU_UnmapSharedMem() +: mic.h
  • MVDMODE_COLORFORMATCONV : mvd.h diff --git a/gsp_8h.html b/gsp_8h.html index 6e61a1d..dc14d56 100644 --- a/gsp_8h.html +++ b/gsp_8h.html @@ -442,7 +442,7 @@ void audio/mic/source/main.c, and mvd/source/main.c. +
    Examples:
    audio/mic/source/main.c, and mvd/source/main.c.
    diff --git a/hid_8h.html b/hid_8h.html index b6a2ef1..87cea26 100644 --- a/hid_8h.html +++ b/hid_8h.html @@ -520,7 +520,7 @@ Variables

    Gets keys that were just pressed.

    Individual keys can be checked by ORing them with this value.

    Returns
    Keys down.
    -
    Examples:
    app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
    +
    Examples:
    app_launch/source/main.c, audio/mic/source/main.c, get_system_language/source/main.c, graphics/bitmap/24bit-color/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/printing/both-screen-text/source/main.c, graphics/printing/colored-text/source/main.c, graphics/printing/hello-world/source/main.c, graphics/printing/multiple-windows-text/source/main.c, http/source/main.c, input/read-controls/source/main.c, input/touch-screen/source/main.c, libapplet_launch/source/main.c, mvd/source/main.c, qtm/source/main.c, threads/event/source/main.c, and time/rtc/source/main.c.
    @@ -540,7 +540,7 @@ Variables

    Gets the currently held keys.

    Individual keys can be checked by ORing them with this value.

    Returns
    Keys held.
    -
    Examples:
    audio/mic/source/main.c, and input/read-controls/source/main.c.
    +
    Examples:
    audio/mic/source/main.c, and input/read-controls/source/main.c.
    @@ -560,7 +560,7 @@ Variables

    Gets keys that were just released.

    Individual keys can be checked by ORing them with this value.

    Returns
    Keys up.
    -
    Examples:
    audio/mic/source/main.c, and input/read-controls/source/main.c.
    +
    Examples:
    audio/mic/source/main.c, and input/read-controls/source/main.c.
    diff --git a/linear_8h.html b/linear_8h.html index b0d684c..c92452a 100644 --- a/linear_8h.html +++ b/linear_8h.html @@ -141,7 +141,7 @@ Functions
    Returns
    The allocated buffer.
    -
    Examples:
    audio/mic/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, and mvd/source/main.c.
    +
    Examples:
    audio/mic/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, and mvd/source/main.c.
    @@ -166,7 +166,7 @@ Functions
    -
    Examples:
    audio/mic/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, and mvd/source/main.c.
    +
    Examples:
    audio/mic/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, and mvd/source/main.c.
    diff --git a/mic_8h.html b/mic_8h.html index 20bc7e7..5ff489d 100644 --- a/mic_8h.html +++ b/mic_8h.html @@ -87,6 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    mic.h File Reference
    @@ -98,90 +99,208 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    Go to the source code of this file.

    + + + + + + + +

    +Enumerations

    enum  MICU_Encoding {
    +  MICU_ENCODING_PCM8 = 0, +
    +  MICU_ENCODING_PCM16 = 1, +
    +  MICU_ENCODING_PCM8_SIGNED = 2, +
    +  MICU_ENCODING_PCM16_SIGNED = 3 +
    + }
     Microphone audio encodings. More...
     
    enum  MICU_SampleRate {
    +  MICU_SAMPLE_RATE_32730 = 0, +
    +  MICU_SAMPLE_RATE_16360 = 1, +
    +  MICU_SAMPLE_RATE_10910 = 2, +
    +  MICU_SAMPLE_RATE_8180 = 3 +
    + }
     Microphone audio sampling rates. More...
     
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Functions

    Result MIC_Initialize (u32 *sharedmem, u32 sharedmem_size, u8 control, u8 recording, u8 unk0, u8 unk1, u8 unk2)
     Initializes MIC. More...
     
    -Result MIC_Shutdown (void)
     Shuts down MIC.
     
    u32 MIC_GetSharedMemOffsetValue (void)
     Gets the current shared memory offset. More...
     
    u32 MIC_ReadAudioData (u8 *outbuf, u32 readsize, u32 waitforevent)
     Reads MIC audio data. More...
     
    Result MIC_MapSharedMem (Handle handle, u32 size)
     Maps MIC's shared memory. More...
     
    -Result MIC_UnmapSharedMem (void)
     Unmaps MIC's shardd memory.
     
    Result MIC_cmd3_Initialize (u8 unk0, u8 unk1, u32 sharedmem_baseoffset, u32 sharedmem_endoffset, u8 unk2)
     Initializes MIC. More...
     
    -Result MIC_cmd5 (void)
     Unknown MIC command.
     
    Result MIC_GetCNTBit15 (u8 *out)
     Gets CNT bit 15 from MIC. More...
     
    Result MIC_GetEventHandle (Handle *handle)
     Gets the event handle signaled by MIC when data is ready. More...
     
    Result MIC_SetControl (u8 value)
     Sets the control value. More...
     
    Result MIC_GetControl (u8 *value)
     Gets the control value. More...
     
    Result MIC_SetRecording (u8 value)
     Sets whether the microphone is recording. More...
     
    Result MIC_IsRecoding (u8 *value)
     Gets whether the microphone is recording. More...
     
    Result micInit (u8 *buffer, u32 bufferSize)
     Initializes MIC. More...
     
    +void micExit (void)
     Exits MIC.
     
    u32 micGetSampleDataSize (void)
     Gets the size of the sample data area within the shared memory buffer. More...
     
    u32 micGetLastSampleOffset (void)
     Gets the offset within the shared memory buffer of the last sample written. More...
     
    Result MICU_MapSharedMem (u32 size, Handle handle)
     Maps MIC shared memory. More...
     
    +Result MICU_UnmapSharedMem (void)
     Unmaps MIC shared memory.
     
    Result MICU_StartSampling (MICU_Encoding encoding, MICU_SampleRate sampleRate, u32 offset, u32 size, bool loop)
     Begins sampling microphone input. More...
     
    Result MICU_AdjustSampling (MICU_SampleRate sampleRate)
     Adjusts the configuration of the current sampling session. More...
     
    +Result MICU_StopSampling (void)
     Stops sampling microphone input.
     
    Result MICU_IsSampling (bool *sampling)
     Gets whether microphone input is currently being sampled. More...
     
    Result MICU_GetEventHandle (Handle *handle)
     Gets an event handle triggered when the shared memory buffer is full. More...
     
    Result MICU_SetGain (u8 gain)
     Sets the microphone's gain. More...
     
    Result MICU_GetGain (u8 *gain)
     Gets the microphone's gain. More...
     
    Result MICU_SetPower (bool power)
     Sets whether the microphone is powered on. More...
     
    Result MICU_GetPower (bool *power)
     Gets whether the microphone is powered on. More...
     
    Result MICU_SetClamp (bool clamp)
     Sets whether to clamp microphone input. More...
     
    Result MICU_GetClamp (bool *clamp)
     Gets whether to clamp microphone input. More...
     
    Result MICU_SetAllowShellClosed (bool allowShellClosed)
     Sets whether to allow sampling when the shell is closed. More...
     

    Detailed Description

    MIC (Microphone) service.

    -

    Function Documentation

    - +

    Enumeration Type Documentation

    +
    - - - - + +
    Result MIC_cmd3_Initialize (u8 unk0, enum MICU_Encoding
    +
    + +

    Microphone audio encodings.

    + + + + + +
    Enumerator
    MICU_ENCODING_PCM8  +

    Unsigned 8-bit PCM.

    +
    MICU_ENCODING_PCM16  +

    Unsigned 16-bit PCM.

    +
    MICU_ENCODING_PCM8_SIGNED  +

    Signed 8-bit PCM.

    +
    MICU_ENCODING_PCM16_SIGNED  +

    Signed 16-bit PCM.

    +
    + +
    +
    + +
    +
    + - - - - + +
    u8 unk1, enum MICU_SampleRate
    +
    + +

    Microphone audio sampling rates.

    + + + + + +
    Enumerator
    MICU_SAMPLE_RATE_32730  +

    32730 Hz

    +
    MICU_SAMPLE_RATE_16360  +

    16360 Hz

    +
    MICU_SAMPLE_RATE_10910  +

    10910 Hz

    +
    MICU_SAMPLE_RATE_8180  +

    8180 Hz

    +
    + +
    +
    +

    Function Documentation

    + +
    +
    + - + + + + - - +
    u32 micGetLastSampleOffset (void ) u32 sharedmem_baseoffset,
    +
    + +

    Gets the offset within the shared memory buffer of the last sample written.

    +
    Returns
    The last sample's offset.
    +
    Examples:
    audio/mic/source/main.c.
    +
    +
    +
    + +
    +
    + - + + + + - - + +
    u32 micGetSampleDataSize (void ) u32 sharedmem_endoffset,
    +
    + +

    Gets the size of the sample data area within the shared memory buffer.

    +
    Returns
    The sample data's size.
    +
    Examples:
    audio/mic/source/main.c.
    +
    +
    +
    + +
    +
    + + + + + + - - + + @@ -194,72 +313,69 @@ Functions

    Initializes MIC.

    Parameters
    Result micInit (u8buffer,
    u8 unk2 u32 bufferSize 
    - - - - - + +
    unk0Unknown.
    unk1Unknown.
    sharedmem_baseoffsetBase offset of shared memory.
    sharedmem_endoffsetEnd offset of shared memory.
    unk2Unknown.
    sizeShared memory buffer to write audio data to. Must be aligned to 0x1000 bytes.
    handleSize of the shared memory buffer.
    - +
    Examples:
    audio/mic/source/main.c.
    +
    - +
    - + - - + +
    Result MIC_GetCNTBit15 Result MICU_AdjustSampling (u8out)MICU_SampleRate sampleRate)
    -

    Gets CNT bit 15 from MIC.

    +

    Adjusts the configuration of the current sampling session.

    Parameters
    - +
    outPointer to output the bit to.
    sampleRateSample rate of outputted audio.
    - +
    - + - - + +
    Result MIC_GetControl Result MICU_GetClamp (u8value)bool * clamp)
    -

    Gets the control value.

    -
    Note
    Bits 0-6 = Amplification.
    +

    Gets whether to clamp microphone input.

    Parameters
    - +
    valuePointer to output the control value to.
    clampPointer to output the clamp state to.
    - +
    - + @@ -268,7 +384,7 @@ Functions
    Result MIC_GetEventHandle Result MICU_GetEventHandle ( Handle handle)
    -

    Gets the event handle signaled by MIC when data is ready.

    +

    Gets an event handle triggered when the shared memory buffer is full.

    Parameters
    @@ -278,134 +394,93 @@ Functions - +
    handlePointer to output the event handle to.
    - + - - + +
    u32 MIC_GetSharedMemOffsetValue Result MICU_GetGain (void )u8gain)
    -

    Gets the current shared memory offset.

    -
    Returns
    The current shared memory offset.
    +

    Gets the microphone's gain.

    +
    Parameters
    + + +
    gainPointer to output the current gain to.
    +
    +
    - +
    - + - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Result MIC_Initialize Result MICU_GetPower (u32sharedmem,
    u32 sharedmem_size,
    bool * power) u8 control,
    u8 recording,
    u8 unk0,
    u8 unk1,
    u8 unk2 
    )
    -

    Initializes MIC.

    +

    Gets whether the microphone is powered on.

    Parameters
    - - - - - - +
    sharedmemShared memory block to use. Must be 0x1000-bytes aligned.
    sharedmem_sizeSize of the shared memory block to use. (audiodata size + 4, aligned to 0x1000-bytes)
    controlControl value. Bits 0-6 = Amplification.
    unk0Unknown. Typically 3.
    unk1Unknown. Typically 1.
    unk2Unknown. Typically 1.
    powerPointer to output the power state to.
    -
    Examples:
    audio/mic/source/main.c.
    -
    +
    - +
    - + - - + +
    Result MIC_IsRecoding Result MICU_IsSampling (u8value)bool * sampling)
    -

    Gets whether the microphone is recording.

    +

    Gets whether microphone input is currently being sampled.

    Parameters
    - +
    valuePointer to output whether the microphone is recording to.
    samplingPointer to output the sampling state to.
    - +
    - + - - + + - - + + @@ -415,104 +490,107 @@ Functions
    Result MIC_MapSharedMem Result MICU_MapSharedMem (Handle handle, u32 size,
    u32 size Handle handle 
    -

    Maps MIC's shared memory.

    +

    Maps MIC shared memory.

    Parameters
    - +
    handleHandle of the shared memory.
    sizeSize of the shared memory.
    handleHandle of the shared memory.
    - +
    - + - - - - - - - - - - - + + - - +
    u32 MIC_ReadAudioData Result MICU_SetAllowShellClosed (u8outbuf,
    u32 readsize,
    bool allowShellClosed) u32 waitforevent 
    +
    + +

    Sets whether to allow sampling when the shell is closed.

    +
    Parameters
    + + +
    allowShellClosedWhether to allow sampling when the shell is closed.
    +
    +
    + +
    +
    + +
    +
    + + + + + - -
    Result MICU_SetClamp (bool clamp) )
    -

    Reads MIC audio data.

    +

    Sets whether to clamp microphone input.

    Parameters
    - - - +
    outbufBuffer to write audio data to.
    readsizeSize of the buffer to write to.
    waitforeventWhether to wait for the MIC service to signal that audio data is ready. (non-zero = wait)
    clampWhether to clamp microphone input.
    -
    Returns
    Actual number of bytes read.
    -
    Examples:
    audio/mic/source/main.c.
    -
    +
    - +
    - + - +
    Result MIC_SetControl Result MICU_SetGain ( u8 value)gain)
    -

    Sets the control value.

    -
    Note
    Bits 0-6 = Amplification.
    +

    Sets the microphone's gain.

    Parameters
    - +
    valueControl value to set.
    gainGain to set.
    - +
    - + - - + +
    Result MIC_SetRecording Result MICU_SetPower (u8 value)bool power)
    -

    Sets whether the microphone is recording.

    +

    Sets whether the microphone is powered on.

    Parameters
    - +
    valueWhether the microphone is recording.
    powerWhether the microphone is powered on.
    @@ -520,6 +598,63 @@ Functions
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Result MICU_StartSampling (MICU_Encoding encoding,
    MICU_SampleRate sampleRate,
    u32 offset,
    u32 size,
    bool loop 
    )
    +
    + +

    Begins sampling microphone input.

    +
    Parameters
    + + + + + + +
    encodingEncoding of outputted audio.
    sampleRateSample rate of outputted audio.
    sharedMemAudioOffsetOffset to write audio data to in the shared memory buffer.
    sharedMemAudioSizeSize of audio data to write to the shared memory buffer. This should be at most "bufferSize - 4".
    loopWhether to loop back to the beginning of the buffer when the end is reached.
    +
    +
    +
    Examples:
    audio/mic/source/main.c.
    +
    +
    +