Пример #1
0
void process_cmd(uint32 cmd) {
	/* cmd is channel to look at +1 */
	cmd--;
	switch(chans[cmd].cmd) {
		case AICA_CMD_NONE:
			break;
		case AICA_CMD_START:
			start_channel(cmd);
			active = 0;
			break;
		case AICA_CMD_STOP:
			stop_channel(cmd);
			active = 0;
			break;
		case AICA_CMD_VOL:
			vol_channel(cmd);
			break;
	}
}
Пример #2
0
static void handle_pri_event(struct pri *pri, pri_event *e)
{
	switch(e->e) {
	case PRI_EVENT_DCHAN_UP:
		printf("-- D-Channel is now up!  :-)\n");
		break;
	case PRI_EVENT_DCHAN_DOWN:
		printf("-- D-Channel is now down! :-(\n");
		break;
	case PRI_EVENT_RESTART:
		printf("-- Restarting channel %d\n", e->restart.channel);
		hangup_channel(e->restart.channel);
		break;
	case PRI_EVENT_CONFIG_ERR:
		printf("-- Configuration error detected: %s\n", e->err.err);
		break;
	case PRI_EVENT_RING:
		printf("-- Ring on channel %d (from %s to %s), answering...\n", e->ring.channel, e->ring.callingnum, e->ring.callednum);
		start_channel(pri, e);
		break;
	case PRI_EVENT_HANGUP:
		printf("-- Hanging up channel %d\n", e->hangup.channel);
		hangup_channel(e->hangup.channel);
		break;
	case PRI_EVENT_RINGING:
	case PRI_EVENT_ANSWER:
		fprintf(stderr, "--!! What?  We shouldn't be making any calls...\n");
		break;
	case PRI_EVENT_HANGUP_ACK:
		/* Ignore */
		break;
	case PRI_EVENT_INFO_RECEIVED:
		fprintf(stdout, "number is: %s\n", e->ring.callednum);
		if(!number_incommplete(e->ring.callednum)) {
			fprintf(stdout, "final number is: %s\n", e->ring.callednum);
			pri_answer(pri, e->ring.call, 0, 1);
		}
		
		break;
	default:
		fprintf(stderr, "--!! Unknown PRI event %d\n", e->e);
	}
}
Пример #3
0
/**
 * psp_sound_init:  Initialize the sound interface.
 *
 * [Parameters]
 *     None
 * [Return value]
 *     Zero on success, negative on error
 */
static int psp_sound_init(void)
{
    if (stereo_buffer.started) {
        /* Already initialized! */
        return 0;
    }

#ifdef DUMP_AUDIO
    dump_fd = sceIoOpen("audio.pcm",
                        PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0600);
    if (dump_fd < 0) {
        DMSG("open(audio.pcm): %s", psp_strerror(dump_fd));
        dump_fd = 0;
    }
#endif

    if (!start_channel(&stereo_buffer)) {
        DMSG("Failed to start playback");
        return -1;
    }

    /* If the Media Engine is in use, reassign the sound RAM access
     * functions so we read/write through the cache as appropriate. */
    if (me_available && config_get_use_me()) {
        SoundRam_uncached = (uint8_t *)((uintptr_t)SoundRam | 0x40000000);
        unsigned int i;
        for (i = 0x5A0; i < 0x5B0; i++) {
            ReadByteList [i] = psp_SoundRamReadByte;
            ReadWordList [i] = psp_SoundRamReadWord;
            ReadLongList [i] = psp_SoundRamReadLong;
            WriteByteList[i] = psp_SoundRamWriteByte;
            WriteWordList[i] = psp_SoundRamWriteWord;
            WriteLongList[i] = psp_SoundRamWriteLong;
        }
    }

    return 0;
}