コード例 #1
0
ファイル: config.c プロジェクト: VCCE/VCC
void LoadConfig(SystemState *LCState)
{
	HANDLE hr=NULL;

	buildTransDisp2ScanTable();

	LoadString(NULL, IDS_APP_TITLE,AppName, MAX_LOADSTRING);
	GetModuleFileName(NULL,ExecDirectory,MAX_PATH);
	PathRemoveFileSpec(ExecDirectory);
	strcpy(CurrentConfig.PathtoExe,ExecDirectory);
	strcpy(IniFilePath,ExecDirectory);
	strcat(IniFilePath,"\\");
	strcat(IniFilePath,IniFileName);
	LCState->ScanLines=0;
	NumberOfSoundCards=GetSoundCardList(SoundCards);
	ReadIniFile();
	CurrentConfig.RebootNow=0;
	UpdateConfig();
	RefreshJoystickStatus();
	SoundInit(EmuState.WindowHandle,SoundCards[CurrentConfig.SndOutDev].Guid,CurrentConfig.AudioRate);
	hr=CreateFile(IniFilePath,NULL,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
	if (hr==INVALID_HANDLE_VALUE) //No Ini File go create it
		WriteIniFile();
	else
		CloseHandle(hr);
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: Start the buzzer's engine sound.
//-----------------------------------------------------------------------------
void C_ASW_Buzzer::OnDataChanged( DataUpdateType_t type )
{
	BaseClass::OnDataChanged( type );

	if (( m_nEnginePitch1 <= 0 ) )
	{
		SoundShutdown();
	}
	else
	{
		SoundInit();		
	}
	UpdateFireEmitters();

	if ( type == DATA_UPDATE_CREATED )
	{
		// We want to think every frame.
		SetNextClientThink( CLIENT_THINK_ALWAYS );

		if ( !m_pTrailEffect )
		{
			m_pTrailEffect = this->ParticleProp()->Create( "buzzer_trail", PATTACH_ABSORIGIN_FOLLOW );
		}
	}
}
コード例 #3
0
ファイル: Splinter.c プロジェクト: andrew-ayers/CoCoFun
void SplinterInit() {
  // High speed mode
  initCoCoSupport();
  setHighSpeed(1);
  BlitterInit();

  //while(1) {
  //  printf("%d %d\n", CoCoMiscReadJoystick(0, 2), CoCoMiscReadJoystick(1, 2));
  //}

  // Black out the screen
  CoCoMiscPaletteFade(splinterRGBColorPalette, splinterCMPColorPalette, 0, 0);
  hscreen(2);
  SoundInit();
  BlitterInitGrafxDataNumberData(GrafxDataNumberData);
  FixedPointInitialize();

  // Draw and show the do you have an rgb monitor screen...
  SplinterShowMonitorScreen();  
  
  // Black out the screen
  CoCoMiscPaletteFade(splinterRGBColorPalette, splinterCMPColorPalette, 0, 0);
  
  // Initialize objects
  BricksInit();
  SplinterScoreInit(&splinterScore);
  SplinterBallInit();
}
コード例 #4
0
ファイル: w32time.cpp プロジェクト: corpsofengineers/ffed3d
void SystemInit (void)
{
	TimerInit();
	DirInit();
	VideoInit();		// Must be before sound/input because of window
	InputInit();
	SoundInit();
	//LuaStart();
}
コード例 #5
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : bool - 
//-----------------------------------------------------------------------------
void C_ASW_Flare_Projectile::OnDataChanged( DataUpdateType_t updateType )
{
	if ( updateType == DATA_UPDATE_CREATED )
	{
		SetNextClientThink(gpGlobals->curtime);
		//SetSortOrigin( GetAbsOrigin() );
		SoundInit();
	}

	BaseClass::OnDataChanged( updateType );
}
コード例 #6
0
ファイル: sound.cpp プロジェクト: KranX/Vangers
void InstallSOUND(void)
{
    if(!SoundInit(EFFECT_KHZ, 16)) {
        std::cout<<"\nInitialization of sound failed, mute mode accepted...\n";
        MuteLog = 1;
        return;
    }
    EffectInUsePriory = EffectInUse = 1;

//	xsInitCD();
    xsInitMusic();
}
コード例 #7
0
void SoundMix::Init()
{
	int stereo_channels = MIX_DEFAULT_CHANNELS;

	if ( Config::GetStereo() == 1 )
	{
		stereo_channels = 2;
	}
	else
	{
		stereo_channels = 1;
	}
  
	// start SDL with audio support
	if ( SDL_InitSubSystem (SDL_INIT_AUDIO) != 0 )
	{
		Logger::WriteLine( "Initializing SDL Audio failed...", __FILE__, __LINE__, LEVEL_ERROR );
		Config::SetMusic( false );
		Config::SetSound( false );
	}
	else if ( Mix_OpenAudio( Config::GetFrequency(), MIX_DEFAULT_FORMAT, stereo_channels, Config::GetChunkSize() ) < 0 )
	{
		Logger::WriteLine( "Open SDL Audio failed...", __FILE__, __LINE__, LEVEL_ERROR );
		Config::SetMusic( false );
		Config::SetSound( false );
	}

	std::cout << "Starting sound system...\n";
	if ( Config::GetMusic() )
	{
		std::cout << "->Enabling music support....\n";
		MusicVolume( Config::GetMusicVolume() );
		//Mix_VolumeMusic( Config::GetMusicVolume() );
	}
	else
	{
		std::cout << "->Music support disabled....\n";
	}

	if ( Config::GetSound() )
	{
		if ( SoundInit( Config::GetMulPath() ) )
		{
			// allocate mixing channels
			std::cout << "->Enabling sound support....\n";
		}
		else
		{
			std::cout << "->Sound support disabled....\n";
       		Config::SetSound( 0 );
		}
	}
}
コード例 #8
0
ファイル: karplus.cpp プロジェクト: kumaashi/dumped
//------------//------------//------------//------------//------------//------------
// ep
//------------//------------//------------//------------//------------//------------
int main(int argc, char *argv[])
{
  HANDLE h = SoundInit(FillFunc);
  printf("    Play : Z, X, C, V, B, N, M, K\nAutoPlay : Hold SpaceKey.\n");
  while(h && !(GetAsyncKeyState(VK_ESCAPE) & 0x8000)) {
    Sleep(0);
    static int root  = 0x6d;
    
    //AutoPlay
    if( GetAsyncKeyState(VK_SPACE) & 0x8000)
    {
      static unsigned long start = timeGetTime();
      unsigned long now = timeGetTime();
      static int count = 0;
      if( (now - start) > 6 )
      {
        //printf("%d\n", (now - start));
        start = now;
        static int count = 0;
        static int bass  = 1;
        count--;
        if(count < 0)
        {
          int table[] = { 10, 7, 3, 0, -7, -12, -24};
          for(int i = 0; i < 7; i++)
            if( (random() % 7) == 0) osc[i].On(root + table[i], i + 2);
          count = 16;
          bass++;
          if( (bass % 32) == 0)
          {
            root += (random() & 0x8) ? 4 : 0;
            root -= (random() & 0x8) ? 4 : 0;
          }
        }
      } else {
        Sleep(1);
      }
    }
    
    //kbd.
    if(GetAsyncKeyState('Z') & 0x0001) osc[0].On(root -24, 12);
    if(GetAsyncKeyState('X') & 0x0001) osc[1].On(root -12,  9);
    if(GetAsyncKeyState('C') & 0x0001) osc[2].On(root -5,   7);
    if(GetAsyncKeyState('V') & 0x0001) osc[3].On(root +0,   5);
    if(GetAsyncKeyState('B') & 0x0001) osc[4].On(root +3,   4);
    if(GetAsyncKeyState('N') & 0x0001) osc[5].On(root +7,   3);
    if(GetAsyncKeyState('M') & 0x0001) osc[6].On(root +10,  2);
    if(GetAsyncKeyState('K') & 0x0001) osc[7].On(root +12,  2);
  }
  SoundTerm(h);
  return 0;
}
コード例 #9
0
//-----------------------------------------------------------------------------
// Purpose: Start the manhack's engine sound.
//-----------------------------------------------------------------------------
void C_NPC_Manhack::OnDataChanged( DataUpdateType_t type )
{
	BaseClass::OnDataChanged( type );

	if (( m_nEnginePitch1 < 0 ) || ( m_nEnginePitch2 < 0 ) )
	{
		SoundShutdown();
	}
	else
	{
		SoundInit();
		if ( m_pEngineSound1 && m_pEngineSound2 )
		{
			float dt = ( m_flEnginePitch1Time >= gpGlobals->curtime ) ? m_flEnginePitch1Time - gpGlobals->curtime : 0.0f;
			CSoundEnvelopeController::GetController().SoundChangePitch( m_pEngineSound1, m_nEnginePitch1, dt );
			dt = ( m_flEnginePitch2Time >= gpGlobals->curtime ) ? m_flEnginePitch2Time - gpGlobals->curtime : 0.0f;
			CSoundEnvelopeController::GetController().SoundChangePitch( m_pEngineSound2, m_nEnginePitch2, dt );
		}
	}
}
コード例 #10
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : updateType - 
//-----------------------------------------------------------------------------
void C_ASW_AOEGrenade_Projectile::OnDataChanged( DataUpdateType_t updateType )
{
	if ( updateType == DATA_UPDATE_CREATED )
	{
		//SetSortOrigin( GetAbsOrigin() );
		SoundInit();
		SetNextClientThink(CLIENT_THINK_ALWAYS);
	}

	if ( updateType == DATA_UPDATE_DATATABLE_CHANGED )
	{
	}

	BaseClass::OnDataChanged( updateType );

	if ( m_bUpdateAOETargets )
	{
		UpdateTargetAOEEffects();
		m_bUpdateAOETargets = false;
	}

	UpdatePingEffects();
}
コード例 #11
0
/**
 * Performs one-time setup of peripherals
 */
static void vInit(void)
{
    /* Sets Clock Speed to 50MHz */
    ROM_SysCtlClockSet(
            SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN
            | SYSCTL_XTAL_16MHZ);

    /* Initializes Bumpers with Interrupt */
    BumpSensorsInit();
    GPIOPinIntEnable(GPIO_PORTE_BASE, (1 << 0) | (1 << 1));
    GPIOIntTypeSet(GPIO_PORTE_BASE, (1 << 0) | (1 << 1), GPIO_FALLING_EDGE);
    IntEnable(20);

    /* Initializes timer, required for scheduler */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
    TimerConfigure(TIMER0_BASE, TIMER_CFG_32_BIT_PER_UP);
    TimerEnable(TIMER0_BASE, TIMER_A);

    SoundInit();
    SoundVolumeSet(95);

    IntMasterEnable();

    /* Hardware initialization for Bouncy related peripherals */
    vBouncyInit();

    /* Hardware initialization for Gamepad related peripherals */
    vGamepadInit();

    initDriveControl();

    // Init the rangefinder
    initRangeFinder();

    return;
}
コード例 #12
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CFastZombie::PostNPCInit( void )
{
    SoundInit();
}
コード例 #13
0
ファイル: config.c プロジェクト: VCCE/VCC
LRESULT CALLBACK Config(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	#define TABS 8
	static char TabTitles[TABS][10]={"Audio","CPU","Display","Keyboard","Joysticks","Misc","Tape","BitBanger"};
	static unsigned char TabCount=0,SelectedTab=0;
	static HWND hWndTabDialog;
	static HWND g_hWndConfig[TABS];
	TCITEM Tabs;
	switch (message)
	{
		case WM_INITDIALOG:
			InitCommonControls();
			TempConfig=CurrentConfig;
			CpuIcons[0]=LoadIcon(EmuState.WindowInstance,(LPCTSTR)IDI_MOTO);
			CpuIcons[1]=LoadIcon(EmuState.WindowInstance,(LPCTSTR)IDI_HITACHI2);
			MonIcons[0]=LoadIcon(EmuState.WindowInstance,(LPCTSTR)IDI_COMPOSITE);
			MonIcons[1]=LoadIcon(EmuState.WindowInstance,(LPCTSTR)IDI_RGB);
			hWndTabDialog= GetDlgItem(hDlg,IDC_CONFIGTAB); //get handle of Tabbed Dialog
			//get handles to all the sub panels in the control
			g_hWndConfig[0]=CreateDialog(EmuState.WindowInstance,MAKEINTRESOURCE(IDD_AUDIO),hWndTabDialog,(DLGPROC) AudioConfig);
			g_hWndConfig[1]=CreateDialog(EmuState.WindowInstance,MAKEINTRESOURCE(IDD_CPU),hWndTabDialog,(DLGPROC) CpuConfig);
			g_hWndConfig[2]=CreateDialog(EmuState.WindowInstance,MAKEINTRESOURCE(IDD_DISPLAY),hWndTabDialog,(DLGPROC) DisplayConfig);
			g_hWndConfig[3]=CreateDialog(EmuState.WindowInstance,MAKEINTRESOURCE(IDD_INPUT),hWndTabDialog,(DLGPROC) InputConfig);
			g_hWndConfig[4]=CreateDialog(EmuState.WindowInstance,MAKEINTRESOURCE(IDD_JOYSTICK),hWndTabDialog,(DLGPROC) JoyStickConfig);
			g_hWndConfig[5]=CreateDialog(EmuState.WindowInstance,MAKEINTRESOURCE(IDD_MISC),hWndTabDialog,(DLGPROC) MiscConfig);
			g_hWndConfig[6]=CreateDialog(EmuState.WindowInstance,MAKEINTRESOURCE(IDD_CASSETTE),hWndTabDialog,(DLGPROC) TapeConfig);
			g_hWndConfig[7]=CreateDialog(EmuState.WindowInstance,MAKEINTRESOURCE(IDD_BITBANGER),hWndTabDialog,(DLGPROC) BitBanger);
			//Set the title text for all tabs
			for (TabCount=0;TabCount<TABS;TabCount++)
			{
				Tabs.mask= TCIF_TEXT | TCIF_IMAGE;
				Tabs.iImage=-1;
				Tabs.pszText=TabTitles[TabCount];
				TabCtrl_InsertItem(hWndTabDialog,TabCount,&Tabs);
			}
			
			TabCtrl_SetCurSel(hWndTabDialog,0);	//Set Initial Tab to 0
			for (TabCount = 0; TabCount < TABS; TabCount++)	//Hide All the Sub Panels
			{
				ShowWindow(g_hWndConfig[TabCount], SW_HIDE);
			}
			SetWindowPos(g_hWndConfig[0], HWND_TOP, 10, 30, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
			RefreshJoystickStatus();
		break;

		case WM_NOTIFY:
			if ((LOWORD(wParam))==IDC_CONFIGTAB)
			{
				SelectedTab=TabCtrl_GetCurSel(hWndTabDialog);
				for (TabCount=0;TabCount<TABS;TabCount++)
					ShowWindow(g_hWndConfig[TabCount],SW_HIDE);
				SetWindowPos(g_hWndConfig[SelectedTab],HWND_TOP,10,30,0,0,SWP_NOSIZE|SWP_SHOWWINDOW);		
			}
		break;

		case WM_COMMAND:
			switch (LOWORD(wParam))
			{
			case IDOK:
				hDlgBar=NULL;
				hDlgTape=NULL;
				EmuState.ResetPending = VCC_RESET_PENDING_UPDATECONFIG;
				if ((CurrentConfig.RamSize != TempConfig.RamSize) | (CurrentConfig.CpuType != TempConfig.CpuType))
				{
					EmuState.ResetPending = VCC_RESET_PENDING_HARD;
				}
				if ((CurrentConfig.SndOutDev != TempConfig.SndOutDev) | (CurrentConfig.AudioRate != TempConfig.AudioRate))
				{
					SoundInit(EmuState.WindowHandle, SoundCards[TempConfig.SndOutDev].Guid, TempConfig.AudioRate);
				}
				CurrentConfig=TempConfig;

				vccKeyboardBuildRuntimeTable((keyboardlayout_e)CurrentConfig.KeyMap);

				Right=TempRight;
				Left=TempLeft;
				SetStickNumbers(Left.DiDevice,Right.DiDevice);

				for (temp = 0; temp < TABS; temp++)
				{
					DestroyWindow(g_hWndConfig[temp]);
				}
#ifdef CONFIG_DIALOG_MODAL
				EndDialog(hDlg, LOWORD(wParam));
#else
				DestroyWindow(hDlg);
#endif
				EmuState.ConfigDialog=NULL;
				break;

			case IDAPPLY:
				EmuState.ResetPending = VCC_RESET_PENDING_UPDATECONFIG;
				if ((CurrentConfig.RamSize != TempConfig.RamSize) | (CurrentConfig.CpuType != TempConfig.CpuType))
				{
					EmuState.ResetPending = VCC_RESET_PENDING_HARD;
				}
				if ((CurrentConfig.SndOutDev != TempConfig.SndOutDev) | (CurrentConfig.AudioRate != TempConfig.AudioRate))
				{
					SoundInit(EmuState.WindowHandle, SoundCards[TempConfig.SndOutDev].Guid, TempConfig.AudioRate);
				}

				CurrentConfig=TempConfig;

				vccKeyboardBuildRuntimeTable((keyboardlayout_e)CurrentConfig.KeyMap);

				Right=TempRight;
				Left=TempLeft;
				SetStickNumbers(Left.DiDevice,Right.DiDevice);
			break;

			case IDCANCEL:
				for (temp = 0; temp < TABS; temp++)
				{
					DestroyWindow(g_hWndConfig[temp]);
				}
#ifdef CONFIG_DIALOG_MODAL
				EndDialog(hDlg, LOWORD(wParam));
#else
				DestroyWindow(hDlg);
#endif
				EmuState.ConfigDialog=NULL;
				break;
			}

		break; //break WM_COMMAND
	} //End Switch
    return FALSE;
}
コード例 #14
0
ファイル: game.cpp プロジェクト: Clever-Boy/SDLMarioBros
void Game::GameLoop()
{
	// Initialize the player
	this->m_player = new Player(this->m_graphics, 1, SCREEN_HEIGHT - TILE_HEIGHT*3);
	
	// Loads the sounds and the HUD
	SoundInit();
	UIInit();

	// Start the level timer
	this->m_leveltimer.Start(400000);
		
	// Init the camera
	this->camera = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT };
	camera.x = (m_player->GetX() + m_player->GetWidth() / 2) - SCREEN_WIDTH / 2;
	camera.y = (m_player->GetY() + m_player->GetHeight() / 2) - SCREEN_HEIGHT / 2;
	
	// Loads the level
	bool levelLoadSuccess = false;
	Texture* tilesetTexture = new Texture(this->m_graphics, "tilesets/global.png");
	Texture* enemyTexture = new Texture(this->m_graphics, "sprites/goomba.png");
	if (tilesetTexture == NULL)
		printf("ERROR : Cannot load tileset texture");
	else
		levelLoadSuccess = this->LoadLevel(tilesetTexture,enemyTexture);

	// If the map is load correctly, we launch the game loop
	if (levelLoadSuccess) {		
		this->m_gamestate = GameState::PLAY;
		
		while (this->m_gamestate != GameState::EXIT)
		{
			this->m_input.beginNewFrame();
			SDL_Event e;
			while (SDL_PollEvent(&e) != 0)
			{
				if (e.type == SDL_KEYDOWN)
				{
					if (e.key.repeat == 0)
					{
						this->m_input.KeyDownEvent(e);
					}
				}

				else if (e.type == SDL_KEYUP)
				{
					this->m_input.KeyUpEvent(e);
				}
				else if (e.type == SDL_QUIT)
				{
					this->m_gamestate = GameState::EXIT;
				}
			}			
			this->HandleInput();
			Update();
			Draw();	

			if (this->m_gamestate == GameState::RESTART)
			{
				Reset();
			}
			
		}		
	}
	else
		printf("ERROR : Loading of the tilemap failed");
}
コード例 #15
0
ファイル: dalsze_zmiany.c プロジェクト: Manrul/Mikroprocesory
int
main(void)
{
    unsigned long ulPHYMR0;
    tBoolean bButtonWasPressed = false;
    tMotorState sMotorState=STATE_STOPPED;
    tWaveHeader sWaveHeader;
    unsigned long ulWaveIndex = 1;
    int losL,losH;
    
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ETH);
    ulPHYMR0 = ROM_EthernetPHYRead(ETH_BASE, PHY_MR0);
    ROM_EthernetPHYWrite(ETH_BASE, PHY_MR0, ulPHYMR0 | PHY_MR0_PWRDN);

	         	 // Display96x16x1Init(true);
	        	//  Display96x16x1StringDraw("MOTOR", 29, 0);
	         	 //  Display96x16x1StringDraw("DEMO", 31, 1);

    LEDsInit();
    LED_On(LED_1);
    PushButtonsInit();
    BumpSensorsInit();
    MotorsInit();
    ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100);
    ROM_SysTickEnable();
    ROM_SysTickIntEnable();
    SoundInit();
    // WaveOpen((unsigned long *) sWaveClips[ulWaveIndex].pucWav, &sWaveHeader);
    //mozliwe ze trzeba przed kazdym odtworzeniem ;/
   // while(WaveOpen((unsigned long *)
     //                            sWaveClips[ulWaveIndex].pucWav,
       //                          &sWaveHeader) != WAVE_OK);//do zablokowania w razie bledu
    for(;;)
    {

       
            tBoolean bButtonIsPressed;
            tBoolean bBumperIsPressed[2];

            bButtonIsPressed = !PushButtonGetDebounced((tButton)1);
            bBumperIsPressed[0] = !BumpSensorGetDebounced((tBumper)0);
            bBumperIsPressed[1] = !BumpSensorGetDebounced((tBumper)1);

            switch(sMotorState)
            {
                case STATE_STOPPED:
                {
                    if(bButtonIsPressed && !bButtonWasPressed)
                    {
                    	sterowanie(0,50,50);
                        sMotorState = STATE_RUNNING;
                    }
                    break;
                }

                 case STATE_RUNNING:
                {
                	 
                    if(bButtonIsPressed && !bButtonWasPressed)
                    {
                        MotorStop((tSide)0);
                        MotorStop((tSide)1);
                        sMotorState = STATE_STOPPED;
                    }

                    else if(bBumperIsPressed[0])
                    {
                         MotorStop((tSide)0);
                         MotorStop((tSide)1);
                //       WavePlayStart(&sWaveHeader); mozliwe ze tu
                	losL =10+ g_ulTickCount % 20;//i dać los zamiast 15,mamy losowe skrecanie(10-30)
                     	losH =40+ g_ulTickCount % 30;//i dać los zamiast 60,mamy losowe skrecanie(40-70)
                         sterowanie(1,losL,losH);
                	 sMotorState = STATE_TYL;
                    }

                    else if(bBumperIsPressed[1]){
                          MotorStop((tSide)0);
                          MotorStop((tSide)1);
                      	  losL =10+ g_ulTickCount % 20;//i dać los zamiast 15,mamy losowe skrecanie(10-30)
                     	  losH =40+ g_ulTickCount % 30;//i dać los zamiast 60,mamy losowe skrecanie(40-70)
                          sterowanie(1,losH,losL);
                //       WavePlayStart(&sWaveHeader); mozliwe ze tu
                          sMotorState = STATE_TYL;
                          }
                    break;
                }

               case STATE_TYL:
                {//cofanie tez moze byc losowe np losH+losL(50-100)+160=(210-260)
                	 while(cofanie<250);
                        MotorStop((tSide)0);
                        MotorStop((tSide)1);
                        sterowanie(0,50,50);
                        sMotorState = STATE_RUNNING;

                    break;
                }
                
               default:
                {
                    MotorStop((tSide)1);
                    MotorStop((tSide)0);
                    sMotorState = STATE_STOPPED;
                  break;
                }
            } 

           bButtonWasPressed = bButtonIsPressed;

         
    } 
}
コード例 #16
0
//*****************************************************************************
//
// A simple demonstration of the features of the Stellaris Graphics Library.
//
//*****************************************************************************
int
main(void)
{
    tContext sContext;
    tRectangle sRect;

    //
    // If running on Rev A2 silicon, turn the LDO voltage up to 2.75V.  This is
    // a workaround to allow the PLL to operate reliably.
    //
    if(REVISION_IS_A2)
    {
        SysCtlLDOSet(SYSCTL_LDO_2_75V);
    }

    //
    // Set the clocking to run from the PLL.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    //
    // Initialize the display driver.
    //
    Kitronix320x240x16_SSD2119Init();

    //
    // Turn on the backlight.
    //
    Kitronix320x240x16_SSD2119BacklightOn(255);

    //
    // Set graphics library text rendering defaults.
    //
    GrLibInit(&GRLIB_INIT_STRUCT);

    //
    // Set the string table and the default language.
    //
    GrStringTableSet(STRING_TABLE);

    //
    // Set the default language.
    //
    ChangeLanguage(GrLangEnUS);

    //
    // Initialize the graphics context.
    //
    GrContextInit(&sContext, &g_sKitronix320x240x16_SSD2119);

    //
    // Fill the top 26 rows of the screen with blue to create the banner.
    //
    sRect.sXMin = 0;
    sRect.sYMin = 0;
    sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1;
    sRect.sYMax = 25;
    GrContextForegroundSet(&sContext, ClrDarkBlue);
    GrRectFill(&sContext, &sRect);

    //
    // Put a white box around the banner.
    //
    GrContextForegroundSet(&sContext, ClrWhite);
    GrRectDraw(&sContext, &sRect);

    //
    // Load the static strings from the string table.  These strings are
    // independent of the language in use but we store them in the string
    // table nonetheless since (a) we may be using codepage remapping in
    // which case it would be difficult to hardcode them into the app source
    // anyway (ASCII or ISO8859-1 text would not render properly with the
    // remapped custom font) and (b) even if we're not using codepage remapping,
    // we may have generated a custom font from the string table output and
    // we want to make sure that all glyphs required by the application are
    // present in that font.  If we hardcode some text in the application
    // source and don't put it in the string table, we run the risk of having
    // characters missing in the font.
    //
    GrStringGet(STR_ENGLISH, g_pcEnglish, MAX_LANGUAGE_NAME_LEN);
    GrStringGet(STR_DEUTSCH, g_pcDeutsch, MAX_LANGUAGE_NAME_LEN);
    GrStringGet(STR_ESPANOL, g_pcEspanol, MAX_LANGUAGE_NAME_LEN);
    GrStringGet(STR_ITALIANO, g_pcItaliano, MAX_LANGUAGE_NAME_LEN);
    GrStringGet(STR_CHINESE, g_pcChinese, MAX_LANGUAGE_NAME_LEN);
    GrStringGet(STR_KOREAN, g_pcKorean, MAX_LANGUAGE_NAME_LEN);
    GrStringGet(STR_JAPANESE, g_pcJapanese, MAX_LANGUAGE_NAME_LEN);
    GrStringGet(STR_PLUS, g_pcPlus, 2);
    GrStringGet(STR_MINUS, g_pcMinus, 2);

    //
    // Put the application name in the middle of the banner.
    //
    GrStringGet(STR_APPNAME, g_pcBuffer, SCOMP_MAX_STRLEN);
    GrContextFontSet(&sContext, FONT_20PT);
    GrStringDrawCentered(&sContext, g_pcBuffer, -1,
                         GrContextDpyWidthGet(&sContext) / 2, 10, 0);

    //
    // Initialize the sound driver.
    //
    SoundInit();

    //
    // Initialize the touch screen driver and have it route its messages to the
    // widget tree.
    //
    TouchScreenInit();
    TouchScreenCallbackSet(WidgetPointerMessage);

    //
    // Add the title block and the previous and next buttons to the widget
    // tree.
    //
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sPrevious);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sTitle);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sNext);

    //
    // Add the first panel to the widget tree.
    //
    g_ulPanel = 0;
    WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels);

    //
    // Set the string for the title.
    //
    CanvasTextSet(&g_sTitle, g_pcTitle);

    //
    // Initialize the pointer to the button text.
    //
    PushButtonTextSet(&g_sFirmwareUpdateBtn, g_pcUpdateButton);

    //
    // Issue the initial paint request to the widgets.
    //
    WidgetPaint(WIDGET_ROOT);

    //
    // Loop forever unless we receive a signal that a firmware update has been
    // requested.
    //
    while(!g_bFirmwareUpdate)
    {
        //
        // Process any messages in the widget message queue.
        //
        WidgetMessageQueueProcess();
    }

    //
    // If we drop out, a firmware update request has been made.  We call
    // WidgetMessageQueueProcess once more to ensure that any final messages
    // are processed then jump into the bootloader.
    //
    WidgetMessageQueueProcess();

    //
    // Wait a while for the last keyboard click sound to finish.  This is about
    // 500mS since the delay loop is 3 cycles long.
    //
    SysCtlDelay(SysCtlClockGet() / 6);

    //
    // Pass control to the bootloader.
    //
    JumpToBootLoader();

    //
    // The boot loader should take control, so this should never be reached.
    // Just in case, loop forever.
    //
    while(1)
    {
    }
}
コード例 #17
0
ファイル: grlib_demo.c プロジェクト: bli19/unesp_mdt
//*****************************************************************************
//
// A simple demonstration of the features of the TivaWare Graphics Library.
//
//*****************************************************************************
int
main(void)
{
    tContext sContext;
    uint32_t ui32SysClock;

    //
    // Run from the PLL at 120 MHz.
    //
    ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                       SYSCTL_OSC_MAIN |
                                       SYSCTL_USE_PLL |
                                       SYSCTL_CFG_VCO_480), 120000000);

    //
    // Configure the device pins.
    //
    PinoutSet();

    //
    // Initialize the display driver.
    //
    Kentec320x240x16_SSD2119Init(ui32SysClock);

    //
    // Initialize the graphics context.
    //
    GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);

    //
    // Draw the application frame.
    //
    FrameDraw(&sContext, "grlib-demo");

    //
    // Configure and enable uDMA
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
    SysCtlDelay(10);
    ROM_uDMAControlBaseSet(&psDMAControlTable[0]);
    ROM_uDMAEnable();

    //
    // Initialize the sound driver.
    //
    SoundInit(ui32SysClock);
    SoundVolumeSet(128);
    SoundStart(g_pi16AudioBuffer, AUDIO_SIZE, 64000, SoundCallback);

    //
    // Initialize the touch screen driver and have it route its messages to the
    // widget tree.
    //
    TouchScreenInit(ui32SysClock);
    TouchScreenCallbackSet(WidgetPointerMessage);

    //
    // Add the title block and the previous and next buttons to the widget
    // tree.
    //
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sPrevious);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sTitle);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sNext);

    //
    // Add the first panel to the widget tree.
    //
    g_ui32Panel = 0;
    WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels);
    CanvasTextSet(&g_sTitle, g_pcPanelNames[0]);

    //
    // Issue the initial paint request to the widgets.
    //
    WidgetPaint(WIDGET_ROOT);

    //
    // Loop forever handling widget messages.
    //
    while(1)
    {
        //
        // Process any messages in the widget message queue.
        //
        WidgetMessageQueueProcess();

        //
        // See if the first half of the sound buffer needs to be filled.
        //
        if(HWREGBITW(&g_ui32Flags, FLAG_PING) == 1)
        {
            //
            // generate new audio into the first half of the sound buffer.
            //
            GenerateAudio(g_pi16AudioBuffer, AUDIO_SIZE / 2);

            //
            // Clear the flag for the first half of the sound buffer.
            //
            HWREGBITW(&g_ui32Flags, FLAG_PING) = 0;
        }

        //
        // See if the second half of the sound buffer needs to be filled.
        //
        if(HWREGBITW(&g_ui32Flags, FLAG_PONG) == 1)
        {
            //
            // generate new audio into the second half of the sound buffer.
            //
            GenerateAudio(g_pi16AudioBuffer + (AUDIO_SIZE / 2),
                                       AUDIO_SIZE / 2);

            //
            // Clear the flag for the second half of the sound buffer.
            //
            HWREGBITW(&g_ui32Flags, FLAG_PONG) = 0;
        }
    }
}
コード例 #18
0
int main()
{
  SoundInit();
  printf("start of pt_test\n");

  printf("PlayTone(TONE_A4, MS_500)\n");
  PlayTone(TONE_A4, MS_500);
  Wait(SEC_1);

  printf("PlaySound(SOUND_FAST_UP)\n");
  PlaySound(SOUND_FAST_UP);
  Wait(SEC_1);

  printf("PlayTones(sweepUp)\n");
  PlayTones(sweepUp);
  Wait(SEC_1);

  printf("PlayFile('/media/card/piano.rmd')\n");
  PlayFile("/media/card/piano.rmd");
  Wait(SEC_2);

  printf("PlayFile('/media/card/1.rsf')\n");
  PlayFile("/media/card/1.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/2.rsf') clapping\n");
  PlayFile("/media/card/2.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/3.rsf') eating\n");
  PlayFile("/media/card/3.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/4.rsf') laugh\n");
  PlayFile("/media/card/4.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/5.rsf') growl\n");
  PlayFile("/media/card/5.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/6.rsf') whine\n");
  PlayFile("/media/card/6.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/7.rsf') elephant\n");
  PlayFile("/media/card/7.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/8.rsf') ratchet\n");
  PlayFile("/media/card/8.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/9.rsf')\n");
  PlayFile("/media/card/9.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/10.rsf')\n");
  PlayFile("/media/card/10.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/11.rsf')\n");
  PlayFile("/media/card/11.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/12.rsf') tada\n");
  PlayFile("/media/card/12.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/13.rsf')\n");
  PlayFile("/media/card/13.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/14.rsf') snore\n");
  PlayFile("/media/card/14.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/15.rsf')\n");
  PlayFile("/media/card/15.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/16.rsf')\n");
  PlayFile("/media/card/16.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/17.rsf')\n");
  PlayFile("/media/card/17.rsf");
  Wait(SEC_2);

  printf("PlayFile('/media/card/test3.wav') (evil laugh)\n");
  PlayFile("/media/card/test3.wav");
  Wait(SEC_2);

  printf("PlayFile('/media/card/test1.wav') (> 64k)\n");
  PlayFile("/media/card/test1.wav");
  Wait(SEC_2);

  printf("end of pt_test\n");
}
コード例 #19
0
ファイル: grlib_demo.c プロジェクト: ev3osek/ev3osek
int main(void)
{
    int xCoOd = 0, yCoOd = 0;
    char pressure = 0, touched = 0;
    unsigned int i = 0;
    unsigned char *dest;
    unsigned char *src;

    SetupIntc();

    SetUpLCD();
  
    /* configuring the base ceiling */
    RasterDMAFBConfig(SOC_LCDC_0_REGS, 
                      (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
                      (unsigned int)(g_pucBuffer+PALETTE_OFFSET) + sizeof(g_pucBuffer) - 2 -
					  PALETTE_OFFSET, FRAME_BUFFER_0);

    RasterDMAFBConfig(SOC_LCDC_0_REGS, 
                      (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
                      (unsigned int)(g_pucBuffer+PALETTE_OFFSET) + sizeof(g_pucBuffer) - 2 - 
					  PALETTE_OFFSET, FRAME_BUFFER_1);

    src = (unsigned char *) palette_32b;
    dest = (unsigned char *) (g_pucBuffer+PALETTE_OFFSET);

    // Copy palette info into buffer
    for( i = PALETTE_OFFSET; i < (PALETTE_SIZE+PALETTE_OFFSET); i++)
	{
		*dest++ = *src++;
	}

	// copy splash screen
	/*src = (unsigned char *)&splash[40];
	for(; i < LCD_SIZE; i++)
	{
		*dest++ = *src++;
	}*/
		
	GrOffScreen16BPPInit(&g_sSHARP480x272x16Display, g_pucBuffer, LCD_WIDTH, LCD_HEIGHT);
	
	// Initialize a drawing context.
	GrContextInit(&sContext, &g_sSHARP480x272x16Display);

    /* enable End of frame interrupt */
    RasterEndOfFrameIntEnable(SOC_LCDC_0_REGS);

    /* enable raster */
    RasterEnable(SOC_LCDC_0_REGS);

    /* Enable display panel backlight and power */
    ConfigRasterDisplayEnable();

    DisplayGR();
	
	SoundInit();

    // TS init
    PeripheralsSetup();
    InitTouchScreen();
	
    // Loop forever handling widget messages.    
    while(1)
	{
		while(!touched)
		{
			ReadAxis(2, &pressure, &touched);
		}
		
        /* Resolving the coordinates of the touched location.*/
        ResolveCoordinates(&xCoOd, &yCoOd);
		
		do
		{
			WidgetPointerMessage(WIDGET_MSG_PTR_DOWN, xCoOd, yCoOd);
			
			// Process any messages in the widget message queue.
			WidgetMessageQueueProcess();

            ResolveCoordinates(&xCoOd, &yCoOd);
			ReadAxis(2, &pressure, &touched);
        }while(touched);
		
		WidgetPointerMessage(WIDGET_MSG_PTR_UP, xCoOd, yCoOd);
		WidgetMessageQueueProcess();
	}
	
}
コード例 #20
0
ファイル: main.cpp プロジェクト: ivucica/theoutcast
int main(int argc, char** argv) {


#ifdef DEBUGCONSOLE
if(AllocConsole())
{
    freopen("CONOUT$", "wt", stdout);

    SetConsoleTitle("The Outcast : Debug Console");

    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);

}
#endif




	DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "THE OUTCAST 0.4\n");
	DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "===============\n");


    DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "Reading cmd line arguments\n");

    for (int i=1;i<argc;i++) {
        if (!strcmp(argv[i], "sprplayground")) {
        	sprplayground = true;
        }
        #ifndef WIN32
        // linux only arguments:
        if (!strcmp(argv[i], "softwarerenderer")) {
            setenv("LIBGL_ALWAYS_INDIRECT", "1", 1);
        }
        #endif
    }

	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up net\n");
	NetInit();
	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up database\n");
	DBInit();
	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up sound system\n");
	SoundInit(NULL);

	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up windowing system\n");

    win_Init(&argc, argv);
    options.Load();

    win_CreateDisplay();



	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up GL\n");
	GLInit();

	if (!sprplayground) {
	    DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Loading skin\n");
	    skin = new Skin;
        skin->Load(options.skin.c_str());
	}


	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Loading mousepointer\n");
	win_SetMousePointer("DEFAULT");

	// game must be inited LAST.
	DEBUGPRINT(DEBUGPRINT_LEVEL_USEFUL, DEBUGPRINT_NORMAL, "Setting up game\n");
	GameInit();



    win_MainLoop();

	return 0;
}
コード例 #21
0
void C_ASW_AOEGrenade_Projectile::OnRestore()
{
	BaseClass::OnRestore();
	SoundInit();	
}
コード例 #22
0
ファイル: synth.c プロジェクト: PhamVanNhi/ECE5770
//*****************************************************************************
//
// This application performs simple audio synthesis and playback based on the
// keys pressed on the touch screen virtual piano keyboard.
//
//*****************************************************************************
int
main(void)
{
    uint32_t ui32SysClock, ui32OldKey, ui32NewKey;
    tContext sContext;

    //
    // Run from the PLL at 120 MHz.
    //
    ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                       SYSCTL_OSC_MAIN |
                                       SYSCTL_USE_PLL |
                                       SYSCTL_CFG_VCO_480), 120000000);

    //
    // Configure the device pins.
    //
    PinoutSet();

    //
    // Initialize the display driver.
    //
    Kentec320x240x16_SSD2119Init(ui32SysClock);

    //
    // Initialize the graphics context.
    //
    GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);

    //
    // Draw the application frame.
    //
    FrameDraw(&sContext, "synth");

    //
    // Draw the keys on the virtual piano keyboard.
    //
    DrawWhiteKeys(&sContext);
    DrawBlackKeys(&sContext);

    //
    // Initialize the touch screen driver.
    //
    TouchScreenInit(ui32SysClock);
    TouchScreenCallbackSet(TouchCallback);

    //
    // Initialize the sound driver.
    //
    SoundInit(ui32SysClock);
    SoundVolumeSet(128);
    SoundStart(g_pi16AudioBuffer, AUDIO_SIZE, 64000, SoundCallback);

    //
    // Default the old and new key to not pressed so that the first key press
    // will be properly drawn on the keyboard.
    //
    ui32OldKey = NUM_WHITE_KEYS + NUM_BLACK_KEYS;
    ui32NewKey = NUM_WHITE_KEYS + NUM_BLACK_KEYS;

    //
    // Loop forever.
    //
    while(1)
    {
        //
        // See if the first half of the sound buffer needs to be filled.
        //
        if(HWREGBITW(&g_ui32Flags, FLAG_PING) == 1)
        {
            //
            // Synthesize new audio into the first half of the sound buffer.
            //
            ui32NewKey = GenerateAudio(g_pi16AudioBuffer, AUDIO_SIZE / 2);

            //
            // Clear the flag for the first half of the sound buffer.
            //
            HWREGBITW(&g_ui32Flags, FLAG_PING) = 0;
        }

        //
        // See if the second half of the sound buffer needs to be filled.
        //
        if(HWREGBITW(&g_ui32Flags, FLAG_PONG) == 1)
        {
            //
            // Synthesize new audio into the second half of the sound buffer.
            //
            ui32NewKey = GenerateAudio(g_pi16AudioBuffer + (AUDIO_SIZE / 2),
                                       AUDIO_SIZE / 2);

            //
            // Clear the flag for the second half of the sound buffer.
            //
            HWREGBITW(&g_ui32Flags, FLAG_PONG) = 0;
        }

        //
        // See if a different key has been pressed.
        //
        if(ui32OldKey != ui32NewKey)
        {
            //
            // See if the old key was a white key.
            //
            if(ui32OldKey < NUM_WHITE_KEYS)
            {
                //
                // Redraw the face of the white key so that it no longer shows
                // as being pressed.
                //
                FillWhiteKey(&sContext, ui32OldKey, ClrWhiteKey);
            }

            //
            // See if the old key was a black key.
            //
            else if(ui32OldKey < (NUM_WHITE_KEYS + NUM_BLACK_KEYS))
            {
                //
                // Redraw the face of the black key so that it no longer shows
                // as being pressed.
                //
                FillBlackKey(&sContext, ui32OldKey - NUM_WHITE_KEYS,
                             ClrBlackKey);
            }

            //
            // See if the new key is a white key.
            //
            if(ui32NewKey < NUM_WHITE_KEYS)
            {
                //
                // Redraw the face of the white key so that it is shown as
                // being pressed.
                //
                FillWhiteKey(&sContext, ui32NewKey, ClrPressed);
            }

            //
            // See if the new key is a black key.
            //
            else if(ui32NewKey < (NUM_WHITE_KEYS + NUM_BLACK_KEYS))
            {
                //
                // Redraw the face of the black key so that it is shown as
                // being pressed.
                //
                FillBlackKey(&sContext, ui32NewKey - NUM_WHITE_KEYS,
                             ClrPressed);
            }

            //
            // Save the new key as the old key.
            //
            ui32OldKey = ui32NewKey;
        }
    }
}
コード例 #23
0
//*****************************************************************************
//
// A simple demonstration of the features of the Stellaris Graphics Library.
//
//*****************************************************************************
int
main(void)
{
    tContext sContext;
    tRectangle sRect;

    //
    // Set the clocking to run from the PLL.
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);

    //
    // Set the device pinout appropriately for this board.
    //
    PinoutSet();

    //
    // Initialize the display driver.
    //
    Kitronix320x240x16_SSD2119Init();

    //
    // Initialize the graphics context.
    //
    GrContextInit(&sContext, &g_sKitronix320x240x16_SSD2119);

    //
    // Fill the top 24 rows of the screen with blue to create the banner.
    //
    sRect.sXMin = 0;
    sRect.sYMin = 0;
    sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1;
    sRect.sYMax = 23;
    GrContextForegroundSet(&sContext, ClrDarkBlue);
    GrRectFill(&sContext, &sRect);

    //
    // Put a white box around the banner.
    //
    GrContextForegroundSet(&sContext, ClrWhite);
    GrRectDraw(&sContext, &sRect);

    //
    // Put the application name in the middle of the banner.
    //
    GrContextFontSet(&sContext, g_pFontCm20);
    GrStringDrawCentered(&sContext, "grlib demo", -1,
                         GrContextDpyWidthGet(&sContext) / 2, 8, 0);

    //
    // Configure and enable uDMA
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
    SysCtlDelay(10);
    ROM_uDMAControlBaseSet(&sDMAControlTable[0]);
    ROM_uDMAEnable();

    //
    // Initialize the sound driver.
    //
    SoundInit(0);

    //
    // Initialize the touch screen driver and have it route its messages to the
    // widget tree.
    //
    TouchScreenInit();
    TouchScreenCallbackSet(WidgetPointerMessage);

    //
    // Add the title block and the previous and next buttons to the widget
    // tree.
    //
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sPrevious);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sTitle);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sNext);

    //
    // Add the first panel to the widget tree.
    //
    g_ulPanel = 0;
    WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels);
    CanvasTextSet(&g_sTitle, g_pcPanelNames[0]);

    //
    // Issue the initial paint request to the widgets.
    //
    WidgetPaint(WIDGET_ROOT);

    //
    // Loop forever handling widget messages.
    //
    while(1)
    {
        //
        // Process any messages in the widget message queue.
        //
        WidgetMessageQueueProcess();
    }
}
コード例 #24
0
void C_ASW_Flare_Projectile::OnRestore()
{
	BaseClass::OnRestore();
	SoundInit();	
}
コード例 #25
0
//-----------------------------------------------------------------------------
// Restore
//-----------------------------------------------------------------------------
void C_NPC_Manhack::OnRestore()
{
	BaseClass::OnRestore();
	SoundInit();
}
コード例 #26
0
//*****************************************************************************
//
// The program main function.  It performs initialization, then handles wav
// file playback.
//
//*****************************************************************************
int
main(void)
{
    int nStatus;

    //
    // Set the system clock to run at 80MHz from the PLL.
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);

    //
    // Give bget some memory to work with.
    //
    bpool(g_pulHeap, sizeof(g_pulHeap));

    //
    // Set the device pin out appropriately for this board.
    //
    PinoutSet();

    //
    // Configure the relevant pins such that UART0 owns them.
    //
    ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // Open the UART for I/O
    //
    UARTStdioInit(0);

    UARTprintf("i2s_speex_enc\n");

    //
    // Configure and enable uDMA
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
    SysCtlDelay(10);
    ROM_uDMAControlBaseSet(&sDMAControlTable[0]);
    ROM_uDMAEnable();

    //
    // Enable Interrupts
    //
    ROM_IntMasterEnable();

    //
    // Configure the I2S peripheral.
    //
    SoundInit(1);

    //
    // Set the format of the play back in the sound driver.
    //
    SoundSetFormat(AUDIO_RATE, AUDIO_BITS, AUDIO_CHANNELS);

    //
    // Print out some header information to the serial console.
    //
    UARTprintf("\ni2s_speex_enc Stellaris Example\n");
    UARTprintf("Streaming at %d %d bit ",SoundSampleRateGet(), AUDIO_BITS);

    if(AUDIO_CHANNELS == 2)
    {
        UARTprintf("Stereo\n");
    }
    else
    {
        UARTprintf("Mono\n");
    }

    //
    // Set the initial volume.
    //
    SoundVolumeSet(INITIAL_VOLUME_PERCENT);

    //
    // Initialize the Speex decoder.
    //
    SpeexDecodeInit();

    //
    // Set the default quality to 2.
    //
    g_iQuality = 2;

    //
    // Initialize the Speex encoder to Complexity of 1 and Quality 2.
    //
    SpeexEncodeInit(AUDIO_RATE, 1, g_iQuality);

    //
    // Initialize the audio buffers.
    //
    InitBuffers();

    //
    // Initialize the applications global state flags.
    //
    g_ulFlags = 0;

    //
    // Kick off a request for a buffer play back and advance the encoder
    // pointer.
    //
    SoundBufferRead(g_pucRecBuffer, RECORD_BUFFER_INC,
                    RecordBufferCallback);
    g_pucEncode += RECORD_BUFFER_INC;

    //
    // Kick off a second request for a buffer play back and advance the encode
    // pointer.
    //
    SoundBufferRead(&g_pucRecBuffer[RECORD_BUFFER_INC], RECORD_BUFFER_INC,
                    RecordBufferCallback);
    g_pucEncode += RECORD_BUFFER_INC;

    //
    // The rest of the handling occurs at interrupt time so the main loop will
    // simply stall here.
    //
    while(1)
    {
        //
        // Print a prompt to the console.  Show the CWD.
        //
        UARTprintf("\n> ");

        //
        // Get a line of text from the user.
        //
        UARTgets(g_cCmdBuf, sizeof(g_cCmdBuf));

        //
        // Pass the line from the user to the command processor.
        // It will be parsed and valid commands executed.
        //
        nStatus = CmdLineProcess(g_cCmdBuf);

        //
        // Handle the case of bad command.
        //
        if(nStatus == CMDLINE_BAD_CMD)
        {
            UARTprintf("Bad command!\n");
        }

        //
        // Handle the case of too many arguments.
        //
        else if(nStatus == CMDLINE_TOO_MANY_ARGS)
        {
            UARTprintf("Too many arguments for command processor!\n");
        }

        //
        // Otherwise the command was executed.  Print the error
        // code if one was returned.
        //
        else if(nStatus != 0)
        {
            UARTprintf("Command returned error code \n");
        }
    }
}
コード例 #27
0
ファイル: Main.cpp プロジェクト: quantumrain/LD24
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    // Window

    WNDCLASSEX wc = { sizeof(wc) };

    wc.lpszClassName = L"MainWnd";
    wc.lpfnWndProc = MainWndProc;
    wc.hIcon = LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(IDI_LD24));
    wc.hCursor = LoadCursor(0, MAKEINTRESOURCE(IDC_ARROW));

    RegisterClassEx(&wc);

    DWORD	style	= WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU;
    DWORD	styleEx = WS_EX_WINDOWEDGE;
    RECT	rcWin	= { 0, 0, kWinWidth * 4, kWinHeight * 4 };

    AdjustWindowRectEx(&rcWin, style, FALSE, styleEx);
    OffsetRect(&rcWin, 100, 100);

    gMainWnd = CreateWindowEx(styleEx, wc.lpszClassName, L"LD24 - Super Conga Kat", style, rcWin.left, rcWin.top, rcWin.right - rcWin.left, rcWin.bottom - rcWin.top, 0, 0, 0, 0);

    ShowWindow(gMainWnd, SW_SHOWNORMAL);

    // Graphics

    if ((gD3d = Direct3DCreate9(D3D_SDK_VERSION)) == 0)
    {
        Panic("D3DCreate failed - do you have D3D9 installed?");
    }

    D3DPRESENT_PARAMETERS pp = { };

    pp.Windowed			= TRUE;
    pp.SwapEffect		= D3DSWAPEFFECT_DISCARD;
    pp.BackBufferWidth	= kWinWidth;
    pp.BackBufferHeight	= kWinHeight;
    pp.BackBufferFormat	= D3DFMT_A8R8G8B8;
    pp.hDeviceWindow	= gMainWnd;
    pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;

    if (FAILED(gD3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, gMainWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, &gDevice)))
    {
        Panic("D3D CreateDevice failed - do you have D3D9 installed?");
    }

    D3DVIEWPORT9 vp;
    vp.Width = kWinWidth;
    vp.Height = kWinHeight;
    vp.MinZ = 0.0f;
    vp.MaxZ = 1.0f;
    vp.X = 0;
    vp.Y = 0;

    gDevice->SetViewport(&vp);

    gpu::Init();

    // Audio

    SoundInit();

    // Keys

    int locKeyW = MapVirtualKey(0x11, MAPVK_VSC_TO_VK);
    int locKeyS = MapVirtualKey(0x1F, MAPVK_VSC_TO_VK);
    int locKeyA = MapVirtualKey(0x1E, MAPVK_VSC_TO_VK);
    int locKeyD = MapVirtualKey(0x20, MAPVK_VSC_TO_VK);
    int locKeyZ = MapVirtualKey(0x2C, MAPVK_VSC_TO_VK);

    // Main

    void RenderInit();
    RenderInit();

    void GameInit();
    GameInit();

    for(;;)
    {
        MSG msg;
        if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
        {
            if (msg.message == WM_QUIT)
                break;

            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        else
        {
            if (gDevice)
            {
                gDevice->BeginScene();

                void RenderPreUpdate();
                RenderPreUpdate();

                gKeyUp		= gHasFocus && (((GetAsyncKeyState(VK_UP) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyW) & 0x8000) != 0));
                gKeyDown	= gHasFocus && (((GetAsyncKeyState(VK_DOWN) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyS) & 0x8000) != 0));
                gKeyLeft	= gHasFocus && (((GetAsyncKeyState(VK_LEFT) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyA) & 0x8000) != 0));
                gKeyRight	= gHasFocus && (((GetAsyncKeyState(VK_RIGHT) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyD) & 0x8000) != 0));
                gKeyFire	= gHasFocus && (((GetAsyncKeyState(VK_SPACE) & 0x8000) != 0) || ((GetAsyncKeyState(VK_RETURN) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyZ) & 0x8000) != 0));

                void GameUpdate();
                GameUpdate();

                void RenderGame();
                RenderGame();

                gDevice->EndScene();
                gDevice->Present(0, 0, 0, 0);
            }

            Sleep(gHasFocus ? 0 : 250);
        }
    }

    gDevice->SetVertexDeclaration(0);
    gDevice->SetVertexShader(0);
    gDevice->SetPixelShader(0);
    gDevice->SetTexture(0, 0);

    SoundShutdown();

    void RenderShutdown();
    RenderShutdown();

    gDevice->Release();
    gD3d->Release();

    DestroyWindow(gMainWnd);

    return 0;
}
コード例 #28
0
void C_ASW_Buzzer::OnRestore()
{
	BaseClass::OnRestore();
	SoundInit();	
}
コード例 #29
0
ファイル: grlib_demo.c プロジェクト: VENGEL/StellarisWare
//*****************************************************************************
//
// A simple demonstration of the features of the Stellaris Graphics Library.
//
//*****************************************************************************
int
main(void)
{
    tContext sContext;
    tRectangle sRect;

    //
    // If running on Rev A2 silicon, turn the LDO voltage up to 2.75V.  This is
    // a workaround to allow the PLL to operate reliably.
    //
    if(REVISION_IS_A2)
    {
        SysCtlLDOSet(SYSCTL_LDO_2_75V);
    }

    //
    // Set the clocking to run from the PLL.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    //
    // Initialize the display driver.
    //
    Kitronix320x240x16_SSD2119Init();

    //
    // Turn on the backlight.
    //
    Kitronix320x240x16_SSD2119BacklightOn(255);

    //
    // Initialize the graphics context.
    //
    GrContextInit(&sContext, &g_sKitronix320x240x16_SSD2119);

    //
    // Fill the top 24 rows of the screen with blue to create the banner.
    //
    sRect.sXMin = 0;
    sRect.sYMin = 0;
    sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1;
    sRect.sYMax = 23;
    GrContextForegroundSet(&sContext, ClrDarkBlue);
    GrRectFill(&sContext, &sRect);

    //
    // Put a white box around the banner.
    //
    GrContextForegroundSet(&sContext, ClrWhite);
    GrRectDraw(&sContext, &sRect);

    //
    // Put the application name in the middle of the banner.
    //
    GrContextFontSet(&sContext, g_pFontCm20);
    GrStringDrawCentered(&sContext, "grlib demo", -1,
                         GrContextDpyWidthGet(&sContext) / 2, 11, 0);

    //
    // Initialize the sound driver.
    //
    SoundInit();

    //
    // Initialize the touch screen driver and have it route its messages to the
    // widget tree.
    //
    TouchScreenInit();
    TouchScreenCallbackSet(WidgetPointerMessage);

    //
    // Add the title block and the previous and next buttons to the widget
    // tree.
    //
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sPrevious);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sTitle);
    WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sNext);

    //
    // Add the first panel to the widget tree.
    //
    g_ulPanel = 0;
    WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels);
    CanvasTextSet(&g_sTitle, g_pcPanelNames[0]);

    //
    // Issue the initial paint request to the widgets.
    //
    WidgetPaint(WIDGET_ROOT);

    //
    // Loop forever unless we receive a signal that a firmware update has been
    // requested.
    //
    while(!g_bFirmwareUpdate)
    {
        //
        // Process any messages in the widget message queue.
        //
        WidgetMessageQueueProcess();
    }

    //
    // If we drop out, a firmware update request has been made.  We call
    // WidgetMessageQueueProcess once more to ensure that any final messages
    // are processed then jump into the bootloader.
    //
    WidgetMessageQueueProcess();

    //
    // Wait a while for the last keyboard click sound to finish.  This is about
    // 500mS since the delay loop is 3 cycles long.
    //
    SysCtlDelay(SysCtlClockGet() / 6);

    //
    // Pass control to the bootloader.
    //
    JumpToBootLoader();

    //
    // The boot loader should take control, so this should never be reached.
    // Just in case, loop forever.
    //
    while(1)
    {
    }
}