FT800 Series Programmer Guide
Version 2.1
Document Reference No.: BRT_000030 Clearance No.: BRT#037
18
Copyright © Bridgetek Limited
2.4
Audio playback
FT800 supports three types of audio format: 4 Bit IMA ADPCM, 8 Bit signed PCM, 8 Bit u-
Law. For IMA ADPCM format, please note the byte order: within one byte, first sample
(4 bits) shall locate from bit 0 to bit 3, while the second sample (4 bits) shall locate from
bit 4 to bit 7.
For the audio data in FT800 RAM to play, FT800 requires the start address in
REG_PLAYBACK_START to be 64 bit (8 Bytes) aligned. In addition, the length of audio
data specified by REG_PLAYBACK_LENGTH is required to be 64 bit (8 Bytes) aligned.
To learn how to play back the audio data, please check the sample code below:
wr8
(
REG_VOL_PB
,
0xFF
);
//configure audio playback volume
wr32
(
REG_PLAYBACK_START
,
0
);
//configure audio buffer starting address
wr32
(
REG_PLAYBACK_LENGTH
,
100
*
1024
);
//configure audio buffer length
wr16
(
REG_PLAYBACK_FREQ
,
44100
);
//configure audio sampling frequency
wr8
(
REG_PLAYBACK_FORMAT
,
ULAW_SAMPLES
);
//configure audio format
wr8
(
REG_PLAYBACK_LOOP
,
0
);
//configure once or continuous playback
wr8
(
REG_PLAYBACK_PLAY
,
1
);
//start the audio playback
Code snippet 5 Audio playback
AudioPlay_Status
=
rd8
(
REG_PLAYBACK_PLAY
);
//1-audio playback is going on,
0-audio playback has finished
Code snippet 6 Check the status of audio playback
wr32
(
REG_PLAYBACK_LENGTH
,
0
);
//configure the playback length to 0
wr8
(
REG_PLAYBACK_PLAY
,
1
);
//start audio playback
Code snippet 7 Stop the audio playback