Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensynth_mono.h
Go to the documentation of this file.
00001 /* 00002 monosynth.h: generic mono related synth functions 00003 00004 copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1 00005 see COPYING and AUTHORS files in distribution or http://mpg123.org 00006 initially written by Michael Hipp, generalized by Thomas Orgis 00007 00008 This header is used multiple times to create different variants of these functions. 00009 See decode.c and synth.h . 00010 Hint: BLOCK, MONO_NAME, MONO2STEREO_NAME, SYNTH_NAME and SAMPLE_T do vary. 00011 00012 Thomas looked closely at the decode_1to1, decode_2to1 and decode_4to1 contents, seeing that they are too similar to be separate files. 00013 This is what resulted... 00014 00015 Reason to separate this from synth.h: 00016 There are decoders that have a special synth_1to1 but still can use these generic derivations for the mono stuff. 00017 It generally makes a good deal of sense to set SYNTH_NAME to opt_synth_1to1(fr) (or opt_synth_2to1(fr), etc.). 00018 */ 00019 00020 /* Mono synth, wrapping over SYNTH_NAME */ 00021 int MONO_NAME(real *bandPtr, mpg123_handle *fr) 00022 { 00023 SAMPLE_T samples_tmp[BLOCK]; 00024 SAMPLE_T *tmp1 = samples_tmp; 00025 int i,ret; 00026 00027 /* save buffer stuff, trick samples_tmp into there, decode, restore */ 00028 unsigned char *samples = fr->buffer.data; 00029 int pnt = fr->buffer.fill; 00030 fr->buffer.data = (unsigned char*) samples_tmp; 00031 fr->buffer.fill = 0; 00032 ret = SYNTH_NAME(bandPtr, 0, fr, 0); /* decode into samples_tmp */ 00033 fr->buffer.data = samples; /* restore original value */ 00034 00035 /* now append samples from samples_tmp */ 00036 samples += pnt; /* just the next mem in frame buffer */ 00037 for(i=0;i<(BLOCK/2);i++) 00038 { 00039 *( (SAMPLE_T *)samples) = *tmp1; 00040 samples += sizeof(SAMPLE_T); 00041 tmp1 += 2; 00042 } 00043 fr->buffer.fill = pnt + (BLOCK/2)*sizeof(SAMPLE_T); 00044 00045 return ret; 00046 } 00047 00048 /* Mono to stereo synth, wrapping over SYNTH_NAME */ 00049 int MONO2STEREO_NAME(real *bandPtr, mpg123_handle *fr) 00050 { 00051 int i,ret; 00052 unsigned char *samples = fr->buffer.data; 00053 00054 ret = SYNTH_NAME(bandPtr,0,fr,1); 00055 samples += fr->buffer.fill - BLOCK*sizeof(SAMPLE_T); 00056 00057 for(i=0;i<(BLOCK/2);i++) 00058 { 00059 ((SAMPLE_T *)samples)[1] = ((SAMPLE_T *)samples)[0]; 00060 samples+=2*sizeof(SAMPLE_T); 00061 } 00062 00063 return ret; 00064 } Generated on Fri May 25 2012 04:31:42 for ReactOS by
1.7.6.1
|