ReactOS  r74227
mpg123 volume and equalizer

Enumerations

enum  mpg123_channels { MPG123_LEFT =0x1, MPG123_RIGHT =0x2, MPG123_LR =0x3 }
 

Functions

MPG123_EXPORT int mpg123_eq (mpg123_handle *mh, enum mpg123_channels channel, int band, double val)
 
MPG123_EXPORT double mpg123_geteq (mpg123_handle *mh, enum mpg123_channels channel, int band)
 
MPG123_EXPORT int mpg123_reset_eq (mpg123_handle *mh)
 
MPG123_EXPORT int mpg123_volume (mpg123_handle *mh, double vol)
 
MPG123_EXPORT int mpg123_volume_change (mpg123_handle *mh, double change)
 
MPG123_EXPORT int mpg123_getvolume (mpg123_handle *mh, double *base, double *really, double *rva_db)
 

Detailed Description

Enumeration Type Documentation

Enumerator
MPG123_LEFT 

The Left Channel.

MPG123_RIGHT 

The Right Channel.

MPG123_LR 

Both left and right channel; same as MPG123_LEFT|MPG123_RIGHT

Definition at line 698 of file mpg123.h.

699 {
700  MPG123_LEFT=0x1
701  ,MPG123_RIGHT=0x2
702  ,MPG123_LR=0x3
703 };

Function Documentation

MPG123_EXPORT int mpg123_eq ( mpg123_handle mh,
enum mpg123_channels  channel,
int  band,
double  val 
)

Set the 32 Band Audio Equalizer settings.

Parameters
channelCan be MPG123_LEFT, MPG123_RIGHT or MPG123_LEFT|MPG123_RIGHT for both.
bandThe equaliser band to change (from 0 to 31)
valThe (linear) adjustment factor.
Returns
MPG123_OK on success

Definition at line 386 of file libmpg123.c.

387 {
388  if(mh == NULL) return MPG123_BAD_HANDLE;
389  if(band < 0 || band > 31){ mh->err = MPG123_BAD_BAND; return MPG123_ERR; }
390  switch(channel)
391  {
393  mh->equalizer[0][band] = mh->equalizer[1][band] = DOUBLE_TO_REAL(val);
394  break;
395  case MPG123_LEFT: mh->equalizer[0][band] = DOUBLE_TO_REAL(val); break;
396  case MPG123_RIGHT: mh->equalizer[1][band] = DOUBLE_TO_REAL(val); break;
397  default:
399  return MPG123_ERR;
400  }
401  mh->have_eq_settings = TRUE;
402  return MPG123_OK;
403 }
real equalizer[2][32]
Definition: frame.h:125
#define DOUBLE_TO_REAL(x)
#define TRUE
Definition: numbers.c:17
smooth NULL
Definition: ftsmooth.c:464
GLuint GLfloat * val
Definition: glext.h:7180
MPG123_EXPORT double mpg123_geteq ( mpg123_handle mh,
enum mpg123_channels  channel,
int  band 
)

Get the 32 Band Audio Equalizer settings.

Parameters
channelCan be MPG123_LEFT, MPG123_RIGHT or MPG123_LEFT|MPG123_RIGHT for (arithmetic mean of) both.
bandThe equaliser band to change (from 0 to 31)
Returns
The (linear) adjustment factor (zero for pad parameters)

Definition at line 405 of file libmpg123.c.

406 {
407  double ret = 0.;
408 
409  /* Handle this gracefully. When there is no band, it has no volume. */
410  if(mh != NULL && band > -1 && band < 32)
411  switch(channel)
412  {
414  ret = 0.5*(REAL_TO_DOUBLE(mh->equalizer[0][band])+REAL_TO_DOUBLE(mh->equalizer[1][band]));
415  break;
416  case MPG123_LEFT: ret = REAL_TO_DOUBLE(mh->equalizer[0][band]); break;
417  case MPG123_RIGHT: ret = REAL_TO_DOUBLE(mh->equalizer[1][band]); break;
418  /* Default case is already handled: ret = 0 */
419  }
420 
421  return ret;
422 }
real equalizer[2][32]
Definition: frame.h:125
#define REAL_TO_DOUBLE(x)
smooth NULL
Definition: ftsmooth.c:464
int ret
MPG123_EXPORT int mpg123_getvolume ( mpg123_handle mh,
double base,
double really,
double rva_db 
)

Return current volume setting, the actual value due to RVA, and the RVA adjustment itself. It's all as double float value to abstract the sample format. The volume values are linear factors / amplitudes (not percent) and the RVA value is in decibels.

Definition at line 1007 of file frame.c.

1008 {
1009  if(mh == NULL) return MPG123_ERR;
1010  if(base) *base = mh->p.outscale;
1011  if(really) *really = mh->lastscale;
1012  get_rva(mh, NULL, rva_db);
1013  return MPG123_OK;
1014 }
struct mpg123_pars_struct p
Definition: frame.h:286
smooth NULL
Definition: ftsmooth.c:464
static int get_rva(mpg123_handle *fr, double *peak, double *gain)
Definition: frame.c:953
double lastscale
Definition: frame.h:234
MPG123_EXPORT int mpg123_reset_eq ( mpg123_handle mh)

Reset the 32 Band Audio Equalizer settings to flat

Returns
MPG123_OK on success

Definition at line 167 of file frame.c.

Referenced by frame_init_par().

168 {
169  int i;
170  if(mh == NULL) return MPG123_BAD_HANDLE;
171 
172  mh->have_eq_settings = 0;
173  for(i=0; i < 32; ++i) mh->equalizer[0][i] = mh->equalizer[1][i] = DOUBLE_TO_REAL(1.0);
174 
175  return MPG123_OK;
176 }
real equalizer[2][32]
Definition: frame.h:125
#define DOUBLE_TO_REAL(x)
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:464
MPG123_EXPORT int mpg123_volume ( mpg123_handle mh,
double  vol 
)

Set the absolute output volume including the RVA setting, vol<0 just applies (a possibly changed) RVA setting.

Definition at line 942 of file frame.c.

Referenced by mpg123_volume_change().

943 {
944  if(mh == NULL) return MPG123_ERR;
945 
946  if(vol >= 0) mh->p.outscale = vol;
947  else mh->p.outscale = 0.;
948 
949  do_rva(mh);
950  return MPG123_OK;
951 }
struct mpg123_pars_struct p
Definition: frame.h:286
smooth NULL
Definition: ftsmooth.c:464
void do_rva(mpg123_handle *fr)
Definition: frame.c:976
MPG123_EXPORT int mpg123_volume_change ( mpg123_handle mh,
double  change 
)

Adjust output volume including the RVA setting by chosen amount

Definition at line 936 of file frame.c.

937 {
938  if(mh == NULL) return MPG123_ERR;
939  return mpg123_volume(mh, change + (double) mh->p.outscale);
940 }
struct mpg123_pars_struct p
Definition: frame.h:286
smooth NULL
Definition: ftsmooth.c:464
int attribute_align_arg mpg123_volume(mpg123_handle *mh, double vol)
Definition: frame.c:942