ReactOS  0.4.14-dev-815-ge410a12
synth_mono.h
Go to the documentation of this file.
1 /*
2  monosynth.h: generic mono related synth functions
3 
4  copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
5  see COPYING and AUTHORS files in distribution or http://mpg123.org
6  initially written by Michael Hipp, generalized by Thomas Orgis
7 
8  This header is used multiple times to create different variants of these functions.
9  See decode.c and synth.h .
10  Hint: BLOCK, MONO_NAME, MONO2STEREO_NAME, SYNTH_NAME and SAMPLE_T do vary.
11 
12  Thomas looked closely at the decode_1to1, decode_2to1 and decode_4to1 contents, seeing that they are too similar to be separate files.
13  This is what resulted...
14 
15  Reason to separate this from synth.h:
16  There are decoders that have a special synth_1to1 but still can use these generic derivations for the mono stuff.
17  It generally makes a good deal of sense to set SYNTH_NAME to opt_synth_1to1(fr) (or opt_synth_2to1(fr), etc.).
18 */
19 
20 /* Mono synth, wrapping over SYNTH_NAME */
21 int MONO_NAME(real *bandPtr, mpg123_handle *fr)
22 {
23  SAMPLE_T samples_tmp[BLOCK];
24  SAMPLE_T *tmp1 = samples_tmp;
25  int i,ret;
26 
27  /* save buffer stuff, trick samples_tmp into there, decode, restore */
28  unsigned char *samples = fr->buffer.data;
29  int pnt = fr->buffer.fill;
30  fr->buffer.data = (unsigned char*) samples_tmp;
31  fr->buffer.fill = 0;
32  ret = SYNTH_NAME(bandPtr, 0, fr, 0); /* decode into samples_tmp */
33  fr->buffer.data = samples; /* restore original value */
34 
35  /* now append samples from samples_tmp */
36  samples += pnt; /* just the next mem in frame buffer */
37  for(i=0;i<(BLOCK/2);i++)
38  {
39  *( (SAMPLE_T *)samples) = *tmp1;
40  samples += sizeof(SAMPLE_T);
41  tmp1 += 2;
42  }
43  fr->buffer.fill = pnt + (BLOCK/2)*sizeof(SAMPLE_T);
44 
45  return ret;
46 }
47 
48 /* Mono to stereo synth, wrapping over SYNTH_NAME */
50 {
51  int i,ret;
52  unsigned char *samples = fr->buffer.data;
53 
54  ret = SYNTH_NAME(bandPtr,0,fr,1);
55  samples += fr->buffer.fill - BLOCK*sizeof(SAMPLE_T);
56 
57  for(i=0;i<(BLOCK/2);i++)
58  {
59  ((SAMPLE_T *)samples)[1] = ((SAMPLE_T *)samples)[0];
60  samples+=2*sizeof(SAMPLE_T);
61  }
62 
63  return ret;
64 }
GLsizei samples
Definition: glext.h:7006
_Tp _STLP_CALL real(const complex< _Tp > &__z)
Definition: _complex.h:727
struct outbuffer buffer
Definition: frame.h:265
#define SAMPLE_T
Definition: synth.c:24
int MONO2STEREO_NAME(real *bandPtr, mpg123_handle *fr)
Definition: synth_mono.h:49
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define BLOCK
Definition: synth.c:1138
#define SYNTH_NAME
Definition: synth.c:1180
int ret
int MONO_NAME(real *bandPtr, mpg123_handle *fr)
Definition: synth_mono.h:21