Example #1
0
void SaveSettings()
{
	cfgSaveInt("config","Dynarec.Enabled",	settings.dynarec.Enable);
	cfgSaveInt("config","Dreamcast.Cable",	settings.dreamcast.cable);
	cfgSaveInt("config","Dreamcast.RTC",	settings.dreamcast.RTC);
	cfgSaveInt("config","Dreamcast.Region",	settings.dreamcast.region);
	cfgSaveInt("config","Dreamcast.Broadcast",settings.dreamcast.broadcast);
}
Example #2
0
s32  cfgLoadInt(const wchar * Section, const wchar * Key,s32 Default)
{
	if(!cfgdb.has_entry(string(Section), string(Key)))
	{
			cfgSaveInt(Section, Key, Default);
	}
	return cfgdb.get_int(string(Section), string(Key), Default);
}
Example #3
0
void os_InitAudio()
{

    if (cfgLoadInt("audio","disable",0))
        return;

    cfgSaveInt("audio","disable",0);

    long loops;
    int size;

    snd_pcm_hw_params_t *params;
    unsigned int val;
    int dir;
    snd_pcm_uframes_t frames;

    /* Open PCM device for playback. */
    int rc = snd_pcm_open(&handle, "default",
                          SND_PCM_STREAM_PLAYBACK, 0);

    if (rc<0)
        rc = snd_pcm_open(&handle, "plughw:0,0,0",
                          SND_PCM_STREAM_PLAYBACK, 0);

    if (rc<0)
        rc = snd_pcm_open(&handle, "plughw:0,0",
                          SND_PCM_STREAM_PLAYBACK, 0);

    if (rc < 0) {
        fprintf(stderr,
                "unable to open pcm device: %s\n",
                snd_strerror(rc));
        return;
    }

    /* Allocate a hardware parameters object. */

    snd_pcm_hw_params_alloca(&params);
    /* Fill it in with default values. */
    rc=snd_pcm_hw_params_any(handle, params);
    if (rc < 0) {
        fprintf(stderr,
                "Error:snd_pcm_hw_params_any %s\n",
                snd_strerror(rc));
        return;
    }
    /* Set the desired hardware parameters. */

    /* Interleaved mode */
    rc=snd_pcm_hw_params_set_access(handle, params,
                                    SND_PCM_ACCESS_RW_INTERLEAVED);
    if (rc < 0) {
        fprintf(stderr,
                "Error:snd_pcm_hw_params_set_access %s\n",
                snd_strerror(rc));
        return;
    }
    /* Signed 16-bit little-endian format */
    rc=snd_pcm_hw_params_set_format(handle, params,
                                    SND_PCM_FORMAT_S16_LE);
    if (rc < 0) {
        fprintf(stderr,
                "Error:snd_pcm_hw_params_set_format %s\n",
                snd_strerror(rc));
        return;
    }
    /* Two channels (stereo) */
    rc=snd_pcm_hw_params_set_channels(handle, params, 2);
    if (rc < 0) {
        fprintf(stderr,
                "Error:snd_pcm_hw_params_set_channels %s\n",
                snd_strerror(rc));
        return;
    }
    /* 44100 bits/second sampling rate (CD quality) */
    val = 44100;
    rc=snd_pcm_hw_params_set_rate_near(handle, params,
                                       &val, &dir);
    if (rc < 0) {
        fprintf(stderr,
                "Error:snd_pcm_hw_params_set_rate_near %s\n",
                snd_strerror(rc));
        return;
    }
    /* Set period size to settings.aica.BufferSize frames. */
    frames = settings.aica.BufferSize;
    rc=snd_pcm_hw_params_set_period_size_near(handle,
            params, &frames, &dir);
    if (rc < 0) {
        fprintf(stderr,
                "Error:snd_pcm_hw_params_set_buffer_size_near %s\n",
                snd_strerror(rc));
        return;
    }
    frames*=4;
    rc=snd_pcm_hw_params_set_buffer_size_near(handle,
            params, &frames);
    if (rc < 0) {
        fprintf(stderr,
                "Error:snd_pcm_hw_params_set_buffer_size_near %s\n",
                snd_strerror(rc));
        return;
    }

    /* Write the parameters to the driver */
    rc = snd_pcm_hw_params(handle, params);
    if (rc < 0) {
        fprintf(stderr,
                "unable to set hw parameters: %s\n",
                snd_strerror(rc));
        return;
    }

    aud_thread.Start();
}