You are not logged in.

Read the FAQ and Knowledge Base before posting.
We won't make a 3DS/2DS emulator.

#1 Re: Support II (decommissioned) » Please help me ( Pkmn platine ) » 2009-05-31 00:03:04

In linux I have this message :
desmumescreenshot0.png

When desmume read the savegame.

#2 Re: Support II (decommissioned) » Zelda Phantom Hourglass » 2009-05-30 23:54:32

For the save I select Flash 4Mo. It's work fine too.

#4 Support II (decommissioned) » Xubuntu 64bits Zelda Microphone » 2009-05-20 04:27:38

Heptaeon
Replies: 4

Hi,

I'm very sad when I learned there are no microphone emulation for Linux :'(. Then, because I'm a Zelda addict I have modify a little bit the source to pass the blow test.

zelda.png

I give you the modified mic.cpp

#ifndef WIN32

#include "types.h"
#include "mic.h"
#include <alsa/asoundlib.h>


#define MIC_BUFSIZE 4096

BOOL Mic_Inited = FALSE;
u8 Mic_Buffer[2][MIC_BUFSIZE];
u16 Mic_BufPos;
u8 Mic_PlayBuf;

// Handle for the PCM device
static snd_pcm_t *pcm_handle;



BOOL Mic_Init()
{
    if(Mic_Inited)
        return TRUE;

    snd_pcm_hw_params_t *hwparams;

    // Open the first sound card in capture
    if (snd_pcm_open(&pcm_handle, "plughw:0,0", SND_PCM_STREAM_CAPTURE, 0) < 0)
        return(FALSE);

    // Allocate the snd_pcm_hw_params_t structure and fill it.
    snd_pcm_hw_params_alloca(&hwparams);
    if (snd_pcm_hw_params_any(pcm_handle, hwparams) < 0)
        return(FALSE);

    //Set the access
    if (snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0)
        return(FALSE);

    //dir 0 == exacte (Rate = 16K exacte)
    if (snd_pcm_hw_params_set_rate(pcm_handle, hwparams, 16000, 0) < 0)
        return(FALSE);
    /* Set sample format */
    if (snd_pcm_hw_params_set_format(pcm_handle, hwparams, SND_PCM_FORMAT_S8) < 0)
        return(FALSE);
    // Set one channel (mono)
    if (snd_pcm_hw_params_set_channels(pcm_handle, hwparams, 1) < 0)
        return(FALSE);

    // Set 2 periods
    if (snd_pcm_hw_params_set_periods(pcm_handle, hwparams, 2, 0) < 0)
        return(FALSE);

    // Set the buffer sise
     if (snd_pcm_hw_params_set_buffer_size(pcm_handle, hwparams, MIC_BUFSIZE) < 0)
        return(FALSE);

    //Set the params
    if (snd_pcm_hw_params(pcm_handle, hwparams) < 0)
        return(FALSE);

    Mic_Inited = TRUE;

    return TRUE;
}

void Mic_Reset()
{
    if(!Mic_Inited)
        return;

    memset(Mic_Buffer[0], 0, MIC_BUFSIZE);
    memset(Mic_Buffer[1], 0, MIC_BUFSIZE);
    Mic_BufPos = 0;

    Mic_PlayBuf = 1;
}

void Mic_DeInit()
{
    if(!Mic_Inited)
        return;

    Mic_Inited = FALSE;

    snd_pcm_drop(pcm_handle);
    snd_pcm_close(pcm_handle);
}

//static u8 dummySound = 0;
u8 Mic_ReadSample()
{
    if(!Mic_Inited)
        return 0;

    u8 tmp = Mic_Buffer[Mic_PlayBuf][Mic_BufPos >> 1];
    u8 ret;

    if(Mic_BufPos & 0x1)
    {
        ret = ((tmp & 0x1) << 7);
    }
    else
    {
        ret = ((tmp & 0xFE) >> 1);
    }

    Mic_BufPos++;
    if(Mic_BufPos >= (MIC_BUFSIZE << 1))
    {
        Mic_BufPos = 0;
        snd_pcm_readi(pcm_handle, Mic_Buffer[Mic_PlayBuf], MIC_BUFSIZE);
        Mic_PlayBuf ^= 1;
    }

    return ret;
}
#endif

Warning : In Zelda I can only test a blow... Than I can't know if this file work really fine. I hope this file help DeSmuME Develppement.

ps : Sorry for my english, as you see I'm french wink.

Board footer

Powered by FluxBB