mirror of
https://github.com/libretro/smsplus-gx.git
synced 2024-12-03 15:20:41 +00:00
Merge pull request #5 from gameblabla/gcw0_alsa_fixes
Numerous audio fixes plus fixing up the GCW0 port
This commit is contained in:
commit
8cc0b79f01
@ -1011,54 +1011,10 @@ static void Force_IPU_Mode()
|
||||
set_keep_aspect_ratio(0);
|
||||
}
|
||||
|
||||
/*
|
||||
static void Controls_joystick()
|
||||
{
|
||||
int16_t x_move = 0, y_move = 0;
|
||||
|
||||
for(uint_fast8_t i=0;i<2;i++)
|
||||
{
|
||||
x_move = SDL_JoystickGetAxis(sdl_joy[i+1], 0);
|
||||
y_move = SDL_JoystickGetAxis(sdl_joy[i+1], 1);
|
||||
|
||||
if (x_move > joy_commit_range)
|
||||
input.pad[i] |= INPUT_RIGHT;
|
||||
else if (input.pad[i] & INPUT_RIGHT)
|
||||
input.pad[i] &= ~INPUT_RIGHT;
|
||||
|
||||
if (x_move < -joy_commit_range)
|
||||
input.pad[i] |= INPUT_LEFT;
|
||||
else if (input.pad[i] & INPUT_LEFT)
|
||||
input.pad[i] &= ~INPUT_LEFT;
|
||||
|
||||
if (y_move > joy_commit_range)
|
||||
input.pad[i] |= INPUT_DOWN;
|
||||
else if (input.pad[i] & INPUT_DOWN)
|
||||
input.pad[i] &= ~INPUT_DOWN;
|
||||
|
||||
if(y_move < -joy_commit_range)
|
||||
input.pad[i] |= INPUT_UP;
|
||||
else if (input.pad[i] & INPUT_UP)
|
||||
input.pad[i] &= ~INPUT_UP;
|
||||
|
||||
if(SDL_JoystickGetButton(sdl_joy[i+1], 2) == SDL_PRESSED)
|
||||
input.pad[i] |= INPUT_BUTTON1;
|
||||
else if (input.pad[i] & INPUT_BUTTON1)
|
||||
input.pad[i] &= ~INPUT_BUTTON1;
|
||||
|
||||
if(SDL_JoystickGetButton(sdl_joy[i+1], 1) == SDL_PRESSED)
|
||||
input.pad[i] |= INPUT_BUTTON2;
|
||||
else if (input.pad[i] & INPUT_BUTTON2)
|
||||
input.pad[i] &= ~INPUT_BUTTON2;
|
||||
}
|
||||
|
||||
SDL_JoystickUpdate();
|
||||
}
|
||||
*/
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int joy_axis[2];
|
||||
int32_t joy_axis[2] = {0, 0};
|
||||
uint_fast8_t i;
|
||||
SDL_Event event;
|
||||
|
||||
@ -1119,8 +1075,8 @@ int main (int argc, char *argv[])
|
||||
SDL_JoystickEventState(SDL_ENABLE);
|
||||
|
||||
|
||||
//joy_numb = SDL_NumJoysticks();
|
||||
//if (joy_numb > 3) joy_numb = 3;
|
||||
joy_numb = SDL_NumJoysticks();
|
||||
if (joy_numb > 3) joy_numb = 3;
|
||||
|
||||
for(i=0;i<joy_numb;i++)
|
||||
{
|
||||
@ -1161,8 +1117,6 @@ int main (int argc, char *argv[])
|
||||
// Loop until the user closes the window
|
||||
while (!quit)
|
||||
{
|
||||
//Controls_joystick();
|
||||
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
switch(event.type)
|
||||
|
@ -128,9 +128,11 @@ void Sound_Init(void)
|
||||
void Sound_Update(void)
|
||||
{
|
||||
uint32_t i;
|
||||
long len = (SOUND_FREQUENCY / snd.fps), ret;
|
||||
long len = SOUND_FREQUENCY / snd.fps, ret;
|
||||
|
||||
for (i = 0; i < (4 * len); i++)
|
||||
if (!handle) return;
|
||||
|
||||
for (i = 0; i < (len); i++)
|
||||
{
|
||||
buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel;
|
||||
buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel;
|
||||
|
@ -36,7 +36,7 @@ void Sound_Update()
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < (4 * (SOUND_FREQUENCY / snd.fps)); i++)
|
||||
for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++)
|
||||
{
|
||||
buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel;
|
||||
buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel;
|
||||
|
@ -66,7 +66,7 @@ void Sound_Update()
|
||||
|
||||
if (!oss_audio_fd) return;
|
||||
|
||||
for (i = 0; i < (4 * (SOUND_FREQUENCY / snd.fps)); i++)
|
||||
for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++)
|
||||
{
|
||||
buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel;
|
||||
buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel;
|
||||
|
@ -72,7 +72,7 @@ void Sound_Update()
|
||||
{
|
||||
#ifndef NONBLOCKING_AUDIO
|
||||
int32_t i;
|
||||
for (i = 0; i < (4 * (SOUND_FREQUENCY / snd.fps)); i++)
|
||||
for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++)
|
||||
{
|
||||
buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel;
|
||||
buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel;
|
||||
|
@ -38,7 +38,7 @@ void Sound_Init()
|
||||
void Sound_Update()
|
||||
{
|
||||
int32_t i;
|
||||
for (i = 0; i < (4 * (SOUND_FREQUENCY / snd.fps)); i++)
|
||||
for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++)
|
||||
{
|
||||
buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel;
|
||||
buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel;
|
||||
|
@ -138,7 +138,7 @@ void Sound_Init()
|
||||
void Sound_Update()
|
||||
{
|
||||
int32_t i;
|
||||
for (i = 0; i < (4 * (SOUND_FREQUENCY / snd.fps)); i++)
|
||||
for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++)
|
||||
{
|
||||
buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel;
|
||||
buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel;
|
||||
@ -158,11 +158,16 @@ void Sound_Close()
|
||||
buffered_bytes = BUFFSIZE;
|
||||
SDL_CondSignal(sound_cv);
|
||||
SDL_UnlockMutex(sound_mutex);
|
||||
SDL_Delay(100);
|
||||
SDL_Delay(25);
|
||||
SDL_DestroyCond(sound_cv);
|
||||
SDL_DestroyMutex(sound_mutex);
|
||||
}
|
||||
SDL_CloseAudio();
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
buffer = NULL;
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user