12.07.2015 Views

VS1033 - MP3/AAC/WMA/MIDI AUDIO CODEC - VLSI Solution

VS1033 - MP3/AAC/WMA/MIDI AUDIO CODEC - VLSI Solution

VS1033 - MP3/AAC/WMA/MIDI AUDIO CODEC - VLSI Solution

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>VLSI</strong><strong>Solution</strong> y<strong>VS1033</strong>c<strong>VS1033</strong>C9. OPERATIONunsigned char db[512]; /* data buffer for saving to disk */void RecordAdpcm1003(void) { /* VS1003b/<strong>VS1033</strong>c */u_int16 w = 0, idx = 0;}... /* Check and locate free space on disk */SetMp3Vol(0x1414); /* Recording monitor volume */WriteMp3SpiReg(SCI_BASS, 0); /* Bass/treble disabled */WriteMp3SpiReg(SCI_CLOCKF, 0x4430); /* 2.0x 12.288MHz */Wait(100);WriteMp3SpiReg(SCI_AICTRL0, 12); /* Div -> 12=8kHz 8=12kHz 6=16kHz */Wait(100);WriteMp3SpiReg(SCI_AICTRL1, 0); /* Auto gain */Wait(100);if (line_in) {WriteMp3SpiReg(SCI_MODE, 0x5804); /* Normal SW reset + other bits */} else {WriteMp3SpiReg(SCI_MODE, 0x1804); /* Normal SW reset + other bits */}for (idx=0; idx < sizeof(header); idx++) { /* Save header first */db[idx] = header[idx];}/* Fix rate if needed *//*db[24] = rate;*//*db[25] = rate>>8;*//* Record loop */while (recording_on) {do {w = ReadMp3SpiReg(SCI_HDAT1);} while (w < 256 || w >= 896); /* wait until 512 bytes available */while (idx < 512) {w = ReadMp3SpiReg(SCI_HDAT0);db[idx++] = w>>8;db[idx++] = w&0xFF;}idx = 0;write_block(datasector++, db); /* Write output block to disk */}... /* Fix WAV header information */... /* Then update FAT information */Reset<strong>MP3</strong>(); /* Normal reset, restore default settings */SetMp3Vol(vol);Version 1.00, 2008-02-01 49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!