コード例 #1
0
void PLATFORM_Initialise(int *argc, char *argv[])
{
    int i, j;
    int help_only = FALSE;
    int scale = 2;
    for (i = j = 1; i < *argc; i++) {
        if (strcmp(argv[i], "-scale") == 0) {
            scale = Util_sscandec(argv[++i]);
        }
        else {
            if (strcmp(argv[i], "-help") == 0) {
                help_only = TRUE;
                Log_print("\t-scale <n>       Scale width and height by <n>");
            }
            argv[j++] = argv[i];
        }
    }
    *argc = j;

    if(!help_only) {
        int config[JAVANVM_InitGraphicsSIZE];
        config[JAVANVM_InitGraphicsScalew] = scale;
        config[JAVANVM_InitGraphicsScaleh] = scale;
        config[JAVANVM_InitGraphicsScreen_WIDTH] = Screen_WIDTH;
        config[JAVANVM_InitGraphicsScreen_HEIGHT] = Screen_HEIGHT;
        config[JAVANVM_InitGraphicsATARI_VISIBLE_WIDTH] = 336;
        config[JAVANVM_InitGraphicsATARI_LEFT_MARGIN] = 24;
        JAVANVM_InitGraphics((void *)&config[0]);
        JAVANVM_InitPalette((void *)&Colours_table[0]);
#ifdef SOUND
        SoundSetup();
#endif
    }
    return;
}
コード例 #2
0
void Sound_Reinit(void)
{
    SoundSetup();
}
コード例 #3
0
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------
	SoundEngine* soundengine = new SoundEngine( SAMPLERATE );
	SoundSetup( soundengine, SAMPLERATE, BUFSIZE );
	int* tempBuf = (int*)malloc(sizeof(int)*soundengine->granulizerBufferSize);
	int displayBuf[CIRCLEDIVS];
	int time = 0;
	u8 squares = 10;
	while(1) {
   	// -------------------- //
		// -- INPUT HANDLING -- //
   	// -------------------- //
		touchPosition touch;
		touchRead( &touch );
		scanKeys();
		u32 down=0, up=0, held=0;
		down=keysDown();
		held=keysHeld();
		up=keysUp();
		if(down&KEY_UP) squares++;
		if(down&KEY_DOWN) squares--;
		if(down&KEY_TOUCH) soundengine->granulizer->SetPlaybackRate(0,1);
		if(held&KEY_TOUCH) {
			soundengine->granulizer->SetPlaybackPos(touch.px,SCREEN_WIDTH);
			soundengine->granulizer->SetGrainSize(touch.py);
		}
		if(up&KEY_TOUCH) {
			soundengine->granulizer->SetPlaybackRate(1,1);
			soundengine->stop(0);
		}
		// -------------- //
		// -- GRAPHICS -- //
		// -------------- //
		for(int i=0; i<soundengine->granulizerBufferSize; i++) {
			tempBuf[i]=abs(soundengine->granulizerBuffer[i]);
		}
		downSampleArray(tempBuf,soundengine->granulizerBufferSize,displayBuf,CIRCLEDIVS);
		for(int i=0; i<CIRCLEDIVS; i++) {
			int maxRadius=700;
			int radius=maxRadius*displayBuf[i]/MAXAMP;
			int nextRadius=maxRadius*displayBuf[(i+1)%CIRCLEDIVS]/MAXAMP;
			int angle=DEGREES_IN_CIRCLE*i/CIRCLEDIVS;
			int nextAngle=DEGREES_IN_CIRCLE*((i+1)%CIRCLEDIVS)/CIRCLEDIVS;
			int x=sinLerp(angle)*radius/DEGREES_IN_CIRCLE+(SCREEN_WIDTH/2);
			int y=cosLerp(angle)*radius/DEGREES_IN_CIRCLE+(SCREEN_HEIGHT/2);
			int nextX=sinLerp(nextAngle)*nextRadius/DEGREES_IN_CIRCLE+(SCREEN_WIDTH/2);
			int nextY=cosLerp(nextAngle)*nextRadius/DEGREES_IN_CIRCLE+(SCREEN_HEIGHT/2);
			GraphicsEng::Instance()->DrawLine(x,y,nextX,nextY,RGB15(31,31,31),ALPHA_ON,SUB_LAYER);
		} 
		for(int i=0; i<GLOBALBUFFERSIZE; i++) {
			int val = soundengine->globalBuffer[(soundengine->globalBufferCursor+i)%GLOBALBUFFERSIZE];
			val = val*(SCREEN_HEIGHT/2)/MAXAMP;
			GraphicsEng::Instance()->DrawPoint(	SCREEN_WIDTH*i/GLOBALBUFFERSIZE,
																					(SCREEN_HEIGHT/2)+val,
																					RGB15(31,31,31),
																					ALPHA_ON,
																					MAIN_LAYER);
		}
		GraphicsEng::Instance()->Update();
		time++;
	}
}