ReactOS  r76032
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

another channel enumeration, for left/right choice

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 799 of file mpg123.h.

800 {
801  MPG123_LEFT=0x1
802  ,MPG123_RIGHT=0x2
803  ,MPG123_LR=0x3
804 };

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
mhhandle
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 397 of file libmpg123.c.

398 {
399 #ifndef NO_EQUALIZER
400  if(mh == NULL) return MPG123_BAD_HANDLE;
401  if(band < 0 || band > 31){ mh->err = MPG123_BAD_BAND; return MPG123_ERR; }
402  switch(channel)
403  {
405  mh->equalizer[0][band] = mh->equalizer[1][band] = DOUBLE_TO_REAL(val);
406  break;
407  case MPG123_LEFT: mh->equalizer[0][band] = DOUBLE_TO_REAL(val); break;
408  case MPG123_RIGHT: mh->equalizer[1][band] = DOUBLE_TO_REAL(val); break;
409  default:
411  return MPG123_ERR;
412  }
413  mh->have_eq_settings = TRUE;
414 #endif
415  return MPG123_OK;
416 }
real equalizer[2][32]
Definition: frame.h:126
#define TRUE
Definition: types.h:120
#define DOUBLE_TO_REAL(x)
smooth NULL
Definition: ftsmooth.c:557
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
mhhandle
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 418 of file libmpg123.c.

419 {
420  double ret = 0.;
421 #ifndef NO_EQUALIZER
422 
423  /* Handle this gracefully. When there is no band, it has no volume. */
424  if(mh != NULL && band > -1 && band < 32)
425  switch(channel)
426  {
428  ret = 0.5*(REAL_TO_DOUBLE(mh->equalizer[0][band])+REAL_TO_DOUBLE(mh->equalizer[1][band]));
429  break;
430  case MPG123_LEFT: ret = REAL_TO_DOUBLE(mh->equalizer[0][band]); break;
431  case MPG123_RIGHT: ret = REAL_TO_DOUBLE(mh->equalizer[1][band]); break;
432  /* Default case is already handled: ret = 0 */
433  }
434 #endif
435  return ret;
436 }
real equalizer[2][32]
Definition: frame.h:126
#define REAL_TO_DOUBLE(x)
smooth NULL
Definition: ftsmooth.c:557
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.

Parameters
mhhandle
basereturn address for base volume (linear factor)
reallyreturn address for actual volume (linear factor)
rva_dbreturn address for RVA value (decibels)
Returns
MPG123_OK on success

Definition at line 1011 of file frame.c.

1012 {
1013  if(mh == NULL) return MPG123_ERR;
1014  if(base) *base = mh->p.outscale;
1015  if(really) *really = mh->lastscale;
1016  get_rva(mh, NULL, rva_db);
1017  return MPG123_OK;
1018 }
struct mpg123_pars_struct p
Definition: frame.h:287
smooth NULL
Definition: ftsmooth.c:557
static int get_rva(mpg123_handle *fr, double *peak, double *gain)
Definition: frame.c:957
double lastscale
Definition: frame.h:235
MPG123_EXPORT int mpg123_reset_eq ( mpg123_handle mh)

Reset the 32 Band Audio Equalizer settings to flat

Parameters
mhhandle
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 #ifndef NO_EQUALIZER
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 #endif
175  return MPG123_OK;
176 }
real equalizer[2][32]
Definition: frame.h:126
#define DOUBLE_TO_REAL(x)
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:557
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.

Parameters
mhhandle
volvolume value (linear factor)
Returns
MPG123_OK on success

Definition at line 946 of file frame.c.

Referenced by mpg123_volume_change().

947 {
948  if(mh == NULL) return MPG123_ERR;
949 
950  if(vol >= 0) mh->p.outscale = vol;
951  else mh->p.outscale = 0.;
952 
953  do_rva(mh);
954  return MPG123_OK;
955 }
struct mpg123_pars_struct p
Definition: frame.h:287
smooth NULL
Definition: ftsmooth.c:557
void do_rva(mpg123_handle *fr)
Definition: frame.c:980
MPG123_EXPORT int mpg123_volume_change ( mpg123_handle mh,
double  change 
)

Adjust output volume including the RVA setting by chosen amount

Parameters
mhhandle
changevolume value (linear factor increment)
Returns
MPG123_OK on success

Definition at line 940 of file frame.c.

941 {
942  if(mh == NULL) return MPG123_ERR;
943  return mpg123_volume(mh, change + (double) mh->p.outscale);
944 }
struct mpg123_pars_struct p
Definition: frame.h:287
smooth NULL
Definition: ftsmooth.c:557
int attribute_align_arg mpg123_volume(mpg123_handle *mh, double vol)
Definition: frame.c:946