summaryrefslogtreecommitdiff
path: root/recordmydesktop/src/opendev.c
diff options
context:
space:
mode:
authorbiocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-07-29 16:13:37 +0000
committerbiocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-07-29 16:13:37 +0000
commit4eeb8595e11d5a6ea62e8f235c99189c8e402b1d (patch)
tree63899b4413b1dca683ff4967d5ca9320a79c66a1 /recordmydesktop/src/opendev.c
parente89b002f4a18baa57763cf7581b5453f11b3a23f (diff)
change in channels bug fixed
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@33 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src/opendev.c')
-rw-r--r--recordmydesktop/src/opendev.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/recordmydesktop/src/opendev.c b/recordmydesktop/src/opendev.c
index d8a4179..c0be942 100644
--- a/recordmydesktop/src/opendev.c
+++ b/recordmydesktop/src/opendev.c
@@ -30,7 +30,7 @@
#include <recordmydesktop.h>
-snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int channels,unsigned int *frequency,snd_pcm_uframes_t *periodsize,unsigned int *periodtime,int *hard_pause){
+snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int *channels,unsigned int *frequency,snd_pcm_uframes_t *periodsize,unsigned int *periodtime,int *hard_pause){
snd_pcm_t *mhandle;
snd_pcm_hw_params_t *hwparams;
@@ -64,15 +64,19 @@ snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int channels,unsigned int *frequ
fprintf(stderr, "Playback frequency %dHz is not available...\nUsing %dHz instead.\n",*frequency,exactrate);
*frequency=exactrate;
}
- if (snd_pcm_hw_params_set_channels_near(mhandle, hwparams, &channels)<0){
+ if (snd_pcm_hw_params_set_channels_near(mhandle, hwparams, channels)<0){
fprintf(stderr, "Couldn't set channels number.\n");
return NULL;
}
+ if(*channels>2){
+ fprintf(stderr,"Channels number should be 1(mono) or 2(stereo).\n");
+ return NULL;
+ }
if (snd_pcm_hw_params_set_periods_near(mhandle, hwparams, &periods,0)<0) {
fprintf(stderr, "Couldn't set periods.\n");
return NULL;
}
- buffsize=(((exactrate*channels)))>>channels;
+ buffsize=(exactrate*(*channels))/2;
if (snd_pcm_hw_params_set_buffer_size_near(mhandle, hwparams,&buffsize)<0){
fprintf(stderr, "Couldn't set buffer size.\n");
return NULL;
© All Rights Reserved