Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,86 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Run with the accompanying host fixture, once with and once without firmware.
|
||||
#include <coco.h>
|
||||
#include <cmoc.h>
|
||||
#include <vcc/ssc.h>
|
||||
|
||||
static void wait_ticks(unsigned int count)
|
||||
{
|
||||
unsigned int start = getTimer();
|
||||
while ((unsigned int)(getTimer() - start) < count) {
|
||||
asm { nop }
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
ssc_phrase phrase;
|
||||
unsigned int start, saved;
|
||||
unsigned char result, saw_input = 0;
|
||||
unsigned char low = *(unsigned char *)0xFF01 & 63;
|
||||
unsigned char high = *(unsigned char *)0xFF03 & 63;
|
||||
unsigned char sound = *(unsigned char *)0xFF23 & 63;
|
||||
|
||||
if (ssc_begin_phrase(&phrase, "") != SSC_INVALID ||
|
||||
ssc_begin_phrase(&phrase, "123456789012345678901234567890123456789012345678901234567890123") != SSC_INVALID ||
|
||||
ssc_begin_phrase(&phrase, "BAD\rDATA") != SSC_INVALID ||
|
||||
ssc_say("TEST", 0) != SSC_TIMEOUT ||
|
||||
ssc_play_effect(3, 1, 15, 2, 100) != SSC_INVALID ||
|
||||
ssc_play_noise(0, 32, 15, 2, 100) != SSC_INVALID)
|
||||
return 1;
|
||||
|
||||
saved = ssc_route_audio();
|
||||
if ((*(unsigned char *)0xFF01 & 63) != ((low & 7) | 0x30) ||
|
||||
(*(unsigned char *)0xFF03 & 63) != ((high & 7) | 0x38) ||
|
||||
(*(unsigned char *)0xFF23 & 63) != ((sound & 7) | 0x38))
|
||||
return 2;
|
||||
ssc_restore_audio(saved);
|
||||
if ((*(unsigned char *)0xFF01 & 63) != low || (*(unsigned char *)0xFF03 & 63) != high ||
|
||||
(*(unsigned char *)0xFF23 & 63) != sound)
|
||||
return 3;
|
||||
|
||||
saved = ssc_route_audio();
|
||||
result = ssc_say("blue planet earth", 8192);
|
||||
if (result == SSC_TIMEOUT) {
|
||||
printf("SSC UNAVAILABLE\n");
|
||||
ssc_restore_audio(saved);
|
||||
return 0;
|
||||
}
|
||||
if (result != SSC_OK)
|
||||
return 4;
|
||||
printf("FIRST SUBMITTED\n");
|
||||
start = getTimer();
|
||||
while ((unsigned int)(getTimer() - start) < 180) {
|
||||
if (!(ssc_status() & SSC_SPEECH_IDLE) && !(readJoystickButtons() & JOYSTK_BUTTON_1_RIGHT)) {
|
||||
if (readJoystickPositions()[JOYSTK_RIGHT_HORIZ] > 50)
|
||||
saw_input = 1;
|
||||
ssc_route_audio();
|
||||
}
|
||||
}
|
||||
if (!saw_input)
|
||||
return 5;
|
||||
printf("INPUT DURING SPEECH\n");
|
||||
if (ssc_begin_phrase(&phrase, "cold red mars") != SSC_OK)
|
||||
return 6;
|
||||
start = getTimer();
|
||||
while ((result = ssc_service(&phrase)) == SSC_PENDING) {
|
||||
if ((unsigned int)(getTimer() - start) >= 120)
|
||||
return 7;
|
||||
}
|
||||
if (result != SSC_OK || ssc_service(&phrase) != SSC_OK)
|
||||
return 8;
|
||||
printf("SECOND SUBMITTED\n");
|
||||
wait_ticks(180);
|
||||
|
||||
printf("TONE TEST\n");
|
||||
if (ssc_play_effect(0, 250, 12, 8, 8192) != SSC_OK)
|
||||
return 9;
|
||||
wait_ticks(60);
|
||||
printf("NOISE TEST\n");
|
||||
if (ssc_play_noise(2, 16, 12, 8, 8192) != SSC_OK)
|
||||
return 10;
|
||||
wait_ticks(60);
|
||||
ssc_restore_audio(saved);
|
||||
printf("SSC API PASSED\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user