Jumper and Pin Information
|
Electrical Characteristics For electrical characteristics of the Audio Codec please refer to the WM9711 datasheet AC97 Setup SETUP(AC97) { active = Y; // enabled or not line_gain_L = 31; // 0 - 63 line_gain_R = 31; // 0 - 63 mic_gain_L = 31; // 0 - 63 mic_gain_R = 31; // 0 - 63 rec_sel = MIC; // MIC / LINE rec_rate = 44100; // 0 - 48000 treble = 0; // 0 - 15 bass = 7; // 0 - 15 threeD = 0; // 0 - 15 master_volume = 100; //0 low - 100 high speaker_volume = 100; //0 low - 100 high headphone_volume = 100; //0 low - 100 high balance = 50; //0-Left 50-Center 100-Right stereo_speaker = Y; //Y when using module with stereo amp, N when using single speaker pbdonefnc = EndFunc; // function that is called when playback is finished pbprogfnc = UpdateVal; // function that is called every 100ms during playback pbmode = fore; // halts further execution of itronSmart code until playback finishes pbmode = back; // playback occurs in the background and the pbdonefnc is called when playback finishes (default) } The above setup is suitable for firmware versions 49.03+ (maximum of 16 parameters allowed) Values for parameters 0-63 are inverted 0 being high and 63 being low During playback the system variables AC97LEN_H, AC97LEN_M, AC97LEN_S, AC97LEN_D hold the length (hours, minutes, seconds, 1/10 sec) and AC97PRG_H, AC97PRG_M, AC97PRG_S, AC97PRG_D hold the current play position. These variables can be updated in the pbprogfnc for the AC97. Playing and Stopping a File To play a file from the RAM you need to load the track into the library then load into AC97 using the line below LIB(Track1,"SDHC/Track1.wav"); LOAD(AC97,Track1); v49+ To load track straight from SD card to decrease loading time use the line below LOAD(AC97,"SDHC/Track1.wav"); v49.02+ To stop the file playing you will need to clear AC97 by using the line below LOAD(AC97,""); |
Example Code Demonstration that has two buttons to play the related audio file as well as a stop button. The playing time of the track and total duration are also shown. The track is played from the SDCard when the key is pressed. You will need two .wav files on the SDCard, named as Track1 and Track2 respectively. ![]() Picture shows how the example code will look SETUP(AC97) { active = Y; // enabled or not treble = 0; // 0 - 15 bass = 7; // 0 - 15 threeD = 0; // 0 - 15 master_volume = 100; //0 - 100 speaker_volume = 50; //0 - 100 headphone_volume = 50; //0 - 100 balance = 50; //0-Left 50-Center 100-Right stereo_speaker = Y; //Y when using module with stereo amp, N when using single speaker pbdonefnc = EndFunc; // function that is called when playback is finished pbprogfnc = UpdateVal; // function that is called every 100ms during playback } STYLE(bstyle,DRAW) { type=B; maxX=480; maxY=272; back=lightcyan; col=black; width=1; rotate=0; curRel=cc; } STYLE(ps, Page) { back = white; } STYLE(SS1, Text) { font = Ascii8; col = black; curRel=RC; xtrim=N; } STYLE(SS, Text) { font = Ascii8; col = black; curRel=CC; } STYLE(SS2, Text) { font = Ascii8; col = black; curRel=LC; xtrim=N; } PAGE(page1, ps) { POSN(110,50); DRAW(Song1,200,80,bstyle); TEXT(Song1T,"Song 1",SS); KEY(Song1K,[RUN(EndFunc);LOAD(AC97,"SDHC/Track1.wav");],200,80,TOUCH); POSN(110,222); DRAW(Song2,200,80,bstyle); TEXT(Song2T,"Song 2",SS); KEY(Song2K,[RUN(EndFunc);LOAD(AC97,"SDHC/Track2.wav");],200,80,TOUCH); POSN(390,136); DRAW(Stop1, 100,40,bstyle); TEXT(Stop1T,"Stop",SS); KEY(Stop1K,[RUN(EndFunc);],100,40,TOUCH); POSN(252,136); TEXT(Played,%*02d%AC97PRG_M,SS1); POSN(254,136); TEXT(PlayedS,":",SS); POSN(259,136); TEXT(Played2,%*02d%AC97PRG_S,SS2); POSN(280,136); TEXT(PDS,"/",SS); POSN(302,136); TEXT(Duration,%*02d%AC97LEN_M,SS1); POSN(304,136); TEXT(DurationS,":",SS); POSN(309,136); TEXT(Duration2,%*02d%AC97LEN_S,SS2); } FUNC(UpdateVal) { TEXT(Played,%*02d%AC97PRG_M); TEXT(Played2,%*02d%AC97PRG_S); TEXT(Duration,%*02d%AC97LEN_M); TEXT(Duration2,%*02d%AC97LEN_S);; } FUNC(EndFunc) { LOAD(AC97,""); } SHOW(page1); |
|