/* * NAME: synth->frame() * DESCRIPTION: perform PCM synthesis of frame subband samples */ void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame) { unsigned int nch, ns; void (*synth_frame)(struct mad_synth *, struct mad_frame const *, unsigned int, unsigned int); nch = MAD_NCHANNELS(&frame->header); ns = MAD_NSBSAMPLES(&frame->header); synth->pcm.samplerate = frame->header.samplerate; synth->pcm.channels = nch; synth->pcm.length = 32 * ns; synth_frame = synth_full; if (frame->options & MAD_OPTION_HALFSAMPLERATE) { synth->pcm.samplerate /= 2; synth->pcm.length /= 2; synth_frame = synth_half; } synth_frame(synth, frame, nch, ns); synth->phase = (synth->phase + ns) % 16; }
//extern unsigned char set__; void mad_synth_frame(struct mad_synth *synth, struct mad_frame /*const*/ *frame) { unsigned int nch, ns; static int samplerate=0; void (*synth_frame)(struct mad_synth *, struct mad_frame /*const*/ *, unsigned int, unsigned int); nch = MAD_NCHANNELS(&frame->header); ns = MAD_NSBSAMPLES(&frame->header); synth->pcm.samplerate = frame->header.samplerate; //--set_dac_sample_rate(synth->pcm.samplerate); //while(g_ulFlags!=7); //if(set__) { vPortEnterCritical( ); SoundSetFormat(frame->header.samplerate,16,1); //set__=0; vPortExitCritical( ); } synth->pcm.channels = nch; synth->pcm.length = 32 * ns; samplerate = synth->pcm.samplerate; synth_frame = synth_full; if (frame->options & MAD_OPTION_HALFSAMPLERATE) { synth->pcm.samplerate /= 2; synth->pcm.length /= 2; //--set_dac_sample_rate(synth->pcm.samplerate); vPortEnterCritical( ); SoundSetFormat(frame->header.samplerate,16,1); vPortExitCritical( ); synth_frame = synth_half; } synth_frame(synth, frame, nch, ns); synth->phase = (synth->phase + ns) % 16; }