Commit 9be218d5 authored by Renaud Dartus's avatar Renaud Dartus

Ajout des fonctions de r�glage du volume (touches : +, -, m)
parent a61212cc
...@@ -57,12 +57,19 @@ ...@@ -57,12 +57,19 @@
/* Default stereo mode (0 stands for mono, 1 for stereo) */ /* Default stereo mode (0 stands for mono, 1 for stereo) */
#define AOUT_DEFAULT_STEREO 1 #define AOUT_DEFAULT_STEREO 1
/* #define AOUT_DEFAULT_STEREO 0 */
/* Audio output rate, in Hz */ /* Audio output rate, in Hz */
#define AOUT_MIN_RATE 22050 /* XXX?? */ #define AOUT_MIN_RATE 22050 /* XXX?? */
#define AOUT_DEFAULT_RATE 44100 #define AOUT_DEFAULT_RATE 44100
#define AOUT_MAX_RATE 48000 #define AOUT_MAX_RATE 48000
/* Volume (default 100) */
#define VOL 100
#define VOLSTEP 5
#define VOLMAX 300
/* Number of audio output frames contained in an audio output fifo. /* Number of audio output frames contained in an audio output fifo.
* (AOUT_FIFO_SIZE + 1) must be a power of 2, in order to optimise the * (AOUT_FIFO_SIZE + 1) must be a power of 2, in order to optimise the
* %(AOUT_FIFO_SIZE + 1) operation with an &AOUT_FIFO_SIZE. * %(AOUT_FIFO_SIZE + 1) operation with an &AOUT_FIFO_SIZE.
...@@ -227,6 +234,10 @@ typedef struct aout_thread_s ...@@ -227,6 +234,10 @@ typedef struct aout_thread_s
* for the OSS output */ * for the OSS output */
p_aout_sys_t p_sys; p_aout_sys_t p_sys;
/* there is the current volume */
int vol;
} aout_thread_t; } aout_thread_t;
/* Those are from <linux/soundcard.h> but are needed because of formats /* Those are from <linux/soundcard.h> but are needed because of formats
......
This diff is collapsed.
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#include "plugins.h" #include "plugins.h"
#include "input.h" #include "input.h"
#include "audio_output.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "interface.h" #include "interface.h"
#include "intf_cmd.h" #include "intf_cmd.h"
...@@ -263,6 +265,8 @@ int intf_SelectChannel( intf_thread_t * p_intf, int i_channel ) ...@@ -263,6 +265,8 @@ int intf_SelectChannel( intf_thread_t * p_intf, int i_channel )
*****************************************************************************/ *****************************************************************************/
int intf_ProcessKey( intf_thread_t *p_intf, int i_key ) int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
{ {
static int i_volbackup;
switch( i_key ) switch( i_key )
{ {
case 'Q': /* quit order */ case 'Q': /* quit order */
...@@ -286,14 +290,22 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key ) ...@@ -286,14 +290,22 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
intf_SelectChannel( p_intf, i_key - '0' ); intf_SelectChannel( p_intf, i_key - '0' );
break; break;
case '+': /* volume + */ case '+': /* volume + */
/* XXX?? */ if( (p_main->p_aout != NULL) && (p_main->p_aout->vol < VOLMAX) )
p_main->p_aout->vol += VOLSTEP;
break; break;
case '-': /* volume - */ case '-': /* volume - */
/* XXX?? */ if( (p_main->p_aout != NULL) && (p_main->p_aout->vol > VOLSTEP) )
p_main->p_aout->vol -= VOLSTEP;
break; break;
case 'M': /* toggle mute */ case 'M': /* toggle mute */
case 'm': case 'm':
/* XXX?? */ if( (p_main->p_aout != NULL) && (p_main->p_aout->vol))
{
i_volbackup = p_main->p_aout->vol;
p_main->p_aout->vol = 0;
}
else if( (p_main->p_aout != NULL) && (!p_main->p_aout->vol))
p_main->p_aout->vol = i_volbackup;
break; break;
case 'g': /* gamma - */ case 'g': /* gamma - */
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma > -INTF_GAMMA_LIMIT) ) if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment