mp3format := PMPEGLAYER3WAVEFORMAT(Pointer(LocalAlloc(LPTR, maxFormatSize))); // define MP3 input format
mp3format^.wfx.cbSize := MPEGLAYER3_WFX_EXTRA_BYTES;
mp3format^.wfx.wFormatTag := WAVE_FORMAT_MPEGLAYER3;
mp3format^.wfx.nChannels := 2;
mp3format^.wfx.nAvgBytesPerSec := 128 * (1024 div 8); // not really used but must be one of 64, 96, 112, 128, 160kbps
mp3format^.wfx.wBitsPerSample := 0; // MUST BE ZERO
mp3format^.wfx.nBlockAlign := 1; // MUST BE ONE
mp3format^.wfx.nSamplesPerSec := 44100; // 44.1kHz
mp3format^.fdwFlags := MPEGLAYER3_FLAG_PADDING_OFF;
mp3format^.nBlockSize := MP3_BLOCK_SIZE;