summaryrefslogtreecommitdiff
path: root/recordmydesktop/src/opendev.c
diff options
context:
space:
mode:
Diffstat (limited to 'recordmydesktop/src/opendev.c')
-rw-r--r--recordmydesktop/src/opendev.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/recordmydesktop/src/opendev.c b/recordmydesktop/src/opendev.c
index 1461023..6e13933 100644
--- a/recordmydesktop/src/opendev.c
+++ b/recordmydesktop/src/opendev.c
@@ -30,13 +30,18 @@
#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 *buffsize,
+ snd_pcm_uframes_t *periodsize,
+ unsigned int *periodtime,
+ int *hard_pause){
snd_pcm_t *mhandle;
snd_pcm_hw_params_t *hwparams;
unsigned int periods=2;
unsigned int exactrate = *frequency;
- snd_pcm_uframes_t buffsize=1024;
snd_pcm_hw_params_alloca(&hwparams);
@@ -79,7 +84,7 @@ snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int *channels,unsigned int *freq
return NULL;
}
- if (snd_pcm_hw_params_set_buffer_size_near(mhandle, hwparams,&buffsize)<0){
+ if (snd_pcm_hw_params_set_buffer_size_near(mhandle, hwparams,buffsize)<0){
fprintf(stderr, "Couldn't set buffer size.\n");
return NULL;
}
@@ -93,11 +98,11 @@ snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int *channels,unsigned int *freq
}
if(periodsize!=NULL)
snd_pcm_hw_params_get_period_size(hwparams,periodsize,0);
- snd_pcm_hw_params_get_buffer_size(hwparams,&buffsize);
if(periodtime!=NULL)
snd_pcm_hw_params_get_period_time(hwparams,periodtime,0);
fprintf(stderr,"Recording on device %s is set to:\n%d channels at %dHz\n",pcm_dev,*channels,*frequency);
+ fprintf(stderr,"Buffer size set to %d frames.\n",(int)(*buffsize));
snd_pcm_prepare(mhandle);
return mhandle;
© All Rights Reserved