summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-06-19 08:23:44 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-06-19 08:23:44 +0000
commitd84867075fd9e3494ceca991affc4d0388ae1964 (patch)
treeebd0d2b17bc675bc21b94e543789013dcdf5aa48 /plugins
parentf5356b547582a16837050dc0e726893e9132b46d (diff)
downloadpcsxr-d84867075fd9e3494ceca991affc4d0388ae1964.tar.gz
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@23747 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dfsound/alsa.c42
-rw-r--r--plugins/dfsound/alsa.h28
-rw-r--r--plugins/dfsound/nullsnd.c2
-rw-r--r--plugins/dfsound/oss.c7
-rw-r--r--plugins/dfsound/oss.h33
5 files changed, 27 insertions, 85 deletions
diff --git a/plugins/dfsound/alsa.c b/plugins/dfsound/alsa.c
index 4806b4c7..5daa2857 100644
--- a/plugins/dfsound/alsa.c
+++ b/plugins/dfsound/alsa.c
@@ -27,8 +27,6 @@
#define ALSA_PCM_NEW_SW_PARAMS_API
#include <alsa/asoundlib.h>
-#define ALSA_MEM_DEF
-#include "alsa.h"
static snd_pcm_t *handle = NULL;
static snd_pcm_uframes_t buffer_size;
@@ -41,26 +39,26 @@ void SetupSound(void)
int pspeed;
int pchannels;
int format;
- int buffer_time;
- int period_time;
+#if 0
+ int buffer_time = 500000;
+ int period_time = buffer_time / 4;
+#endif
int err;
- if(iDisStereo) pchannels=1;
+ if (iDisStereo) pchannels = 1;
else pchannels=2;
- pspeed=44100;
- format=SND_PCM_FORMAT_S16;
- buffer_time=500000;
- period_time=buffer_time/4;
+ pspeed = 44100;
+ format = SND_PCM_FORMAT_S16;
- if((err=snd_pcm_open(&handle, "default",
- SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK))<0)
+ if ((err = snd_pcm_open(&handle, "default",
+ SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0)
{
printf("Audio open error: %s\n", snd_strerror(err));
return;
}
- if((err=snd_pcm_nonblock(handle, 0))<0)
+ if((err = snd_pcm_nonblock(handle, 0))<0)
{
printf("Can't set blocking moded: %s\n", snd_strerror(err));
return;
@@ -98,6 +96,7 @@ void SetupSound(void)
return;
}
+#if 0
if((err=snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, 0))<0)
{
printf("Buffer time error: %s\n", snd_strerror(err));
@@ -109,6 +108,7 @@ void SetupSound(void)
printf("Period time error: %s\n", snd_strerror(err));
return;
}
+#endif
if((err=snd_pcm_hw_params(handle, hwparams))<0)
{
@@ -123,7 +123,7 @@ void SetupSound(void)
return;
}
- buffer_size=snd_pcm_status_get_avail(status);
+ buffer_size = snd_pcm_status_get_avail(status);
}
// REMOVE SOUND
@@ -142,13 +142,13 @@ unsigned long SoundGetBytesBuffered(void)
{
unsigned long l;
- if(handle == NULL) // failed to open?
+ if (handle == NULL) // failed to open?
return SOUNDSIZE;
l = snd_pcm_avail_update(handle);
- if(l<0) return 0;
- if(l<buffer_size/2) // can we write in at least the half of fragments?
- l=SOUNDSIZE; // -> no? wait
- else l=0; // -> else go on
+ if(l < 0) return 0;
+ if(l < buffer_size / 2) // can we write in at least the half of fragments?
+ l = SOUNDSIZE; // -> no? wait
+ else l = 0; // -> else go on
return l;
}
@@ -156,12 +156,12 @@ unsigned long SoundGetBytesBuffered(void)
// FEED SOUND DATA
void SoundFeedStreamData(unsigned char* pSound,long lBytes)
{
- if(handle == NULL) return;
+ if (handle == NULL) return;
- if(snd_pcm_state(handle) == SND_PCM_STATE_XRUN)
+ if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN)
snd_pcm_prepare(handle);
snd_pcm_writei(handle,pSound,
- iDisStereo == 1 ? lBytes/2 : lBytes/4);
+ iDisStereo ? lBytes / 2 : lBytes / 4);
}
#endif
diff --git a/plugins/dfsound/alsa.h b/plugins/dfsound/alsa.h
deleted file mode 100644
index b45eae95..00000000
--- a/plugins/dfsound/alsa.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/***************************************************************************
- alsa.h - description
- -------------------
- begin : Sat Mar 01 2003
- copyright : (C) 2002 by Pete Bernert
- email : BlackDove@addcom.de
- ***************************************************************************/
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef _ALSA_SOUND_H
-#define _ALSA_SOUND_H
-
-#ifdef ALSA_MEM_DEF
-#define ALSA_MEM_EXTERN
-#else
-#define ALSA_MEM_EXTERN extern
-#endif
-
-ALSA_MEM_EXTERN int sound_buffer_size;
-
-#endif // _ALSA_SOUND_H
diff --git a/plugins/dfsound/nullsnd.c b/plugins/dfsound/nullsnd.c
index fd7ce015..ebbefa2e 100644
--- a/plugins/dfsound/nullsnd.c
+++ b/plugins/dfsound/nullsnd.c
@@ -19,7 +19,7 @@ void RemoveSound(void)
// GET BYTES BUFFERED
unsigned long SoundGetBytesBuffered(void)
{
- return 0;
+ return 0;
}
// FEED SOUND DATA
diff --git a/plugins/dfsound/oss.c b/plugins/dfsound/oss.c
index 59c34d74..2407053c 100644
--- a/plugins/dfsound/oss.c
+++ b/plugins/dfsound/oss.c
@@ -27,8 +27,11 @@
// oss globals
////////////////////////////////////////////////////////////////////////
-#define OSS_MEM_DEF
-#include "oss.h"
+#define OSS_MODE_STEREO 1
+#define OSS_MODE_MONO 0
+
+#define OSS_SPEED_44100 44100
+
static int oss_audio_fd = -1;
extern int errno;
diff --git a/plugins/dfsound/oss.h b/plugins/dfsound/oss.h
deleted file mode 100644
index b4664ab6..00000000
--- a/plugins/dfsound/oss.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/***************************************************************************
- oss_sound.h - description
- -------------------
- begin : Wed Dec 8 1999
- copyright : (C) 1999 by Marcin "Duddie" Dudar
- email : duddie@psemu.com
- ***************************************************************************/
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef _OSS_SOUND_H
-#define _OSS_SOUND_H
-
-#ifdef OSS_MEM_DEF
-#define OSS_MEM_EXTERN
-#else
-#define OSS_MEM_EXTERN extern
-#endif
-
-OSS_MEM_EXTERN int sound_buffer_size;
-
-#define OSS_MODE_STEREO 1
-#define OSS_MODE_MONO 0
-
-#define OSS_SPEED_44100 44100
-
-#endif // _OSS_SOUND_H