Example #1
0
void Platform::close()
{
	// Delete window
	delete	ms_pWindow;

	ms_pWindow	= NULL;

	// Delete timer
	delete	ms_pTimer;

	ms_pTimer	= NULL;

	// Delete display
	delete	System::ms_pDisplay;

	System::ms_pDisplay	= NULL;

	// Close sound system
	closeSound();
	
	// Delete input
	delete	System::ms_pInput;

	System::ms_pInput	= NULL;
}
Example #2
0
static void cleanup( int sig )
{

  (void) sig;
  closeSound();
  exit(0);
}
Example #3
0
ImuseDigiSndMgr::~ImuseDigiSndMgr() {
	for (int l = 0; l < MAX_IMUSE_SOUNDS; l++) {
		closeSound(&_sounds[l]);
	}

	delete _cacheBundleDir;
	BundleCodecs::releaseImcTables();
}
Example #4
0
// Quit and save preference.
void quitLast() {
  if ( !noSound ) closeSound();
  savePreference();
  closeBarragemanager();
  closeSDL();
  SDL_Quit();
  exit(1);
}
Example #5
0
void nextPlaylistField()
{
	if(curPlaylist.numEntries < 2)
		return;
	if(plsPos == curPlaylist.numEntries - 1)
		return;
	
	if(sndMode == TYPE_PLS)
	{
		queued = true;
		plsPos++;
		closeSound();
	}
}
Example #6
0
void previousPlaylistField()
{
	if(curPlaylist.numEntries < 2)
		return;
	if(!plsPos)
		return;
	
	if(sndMode == TYPE_PLS)
	{
		queued = true;
		plsPos--;
		closeSound();
	}
}
Example #7
0
int main(){
	initScreen();
	initSound();
	initLedButtons();
	lcdTest();
	while(1){
		fillBoard();
		printBoard();
		
		for (int i = 0; i < 100; i++){
			setLeds((char)i);
			setFrequency(120*(i%20));
			playerStep();
			printBoard();
			playSounds();
			if (readButtons() & 0x01 > 0) break;
		}
	}
	closeLedButtons();
	closeScreen();
	closeSound();

}
Example #8
0
int main(int argc, char **argv) { 

  int windX=10;
  int windY=30;
  int windWidth=320;
  int windHeight=200;
  int c;
  opterr = 0;

  openSound(configUseCD); 
  catchSignals();


  while ((c = getopt(argc, argv, "b:h:w:")) != -1){
    switch (c)
      {

      case '?':
	fprintf(stderr, "%s: unknown option \"%s\"\n", 
		argv[0], argv[optind-1]);
	usage(argv[0]);
	exit(1);	
      case 'b':
	bright = (double) atoi(optarg);
	bright = bright/10;
	break;
      case 'w':
	windWidth = atoi(optarg);
	break;
      case 'h':
	windHeight = atoi(optarg);
	break;
      }
  }

 
  if (bright > 1.0)
    bright = 1.0;
  else if (bright < 0.0)
    bright = 0.0;


  if (windWidth < 1)
    windWidth = 320;
  if (windHeight < 1)
    windHeight = 200;

  setBrightness(bright);

  screenInit(windX,windY,windWidth,windHeight);
  output = new unsigned char[outWidth*outHeight*2];

  coreInit();

  time_t timer = time(NULL);
  
  int frames = 0;
  do {
    screenShow();
    coreGo();
    frames++;
  } while(!processUserInput());

  timer = time(NULL) - timer;
  delete output;
  closeSound();

  if (timer > 10)
    fprintf(stderr,"Frames per second: %f\n", double(frames)/timer);
  
  return 0;
}
Example #9
0
void initSound()
{
	CoInitialize(NULL);
    
    CoCreateInstance(CLSID_DirectMusicLoader, NULL, 
                     CLSCTX_INPROC, IID_IDirectMusicLoader8,
                     (void**)&g_pLoader);

    CoCreateInstance(CLSID_DirectMusicPerformance, NULL,
                     CLSCTX_INPROC, IID_IDirectMusicPerformance8,
                     (void**)&g_pPerformance );

	g_pPerformance->InitAudio( 
        NULL,                  // IDirectMusic interface not needed.
        NULL,                  // IDirectSound interface not needed.
        NULL,                  // Window handle.
        DMUS_APATH_SHARED_STEREOPLUSREVERB,  // Default audiopath type.
        64,                    // Number of performance channels.
        DMUS_AUDIOF_ALL,       // Features on synthesizer.
        NULL                   // Audio parameters; use defaults.
    );

	
    WCHAR wstrSearchPath[MAX_PATH];
    MultiByteToWideChar( CP_ACP, 0, ".", -1, 
                         wstrSearchPath, MAX_PATH );
 
	// set the search directory for where to find our sound effects
	g_pLoader->SetSearchDirectory( 
        GUID_DirectMusicAllTypes,   // Types of files sought.
        wstrSearchPath,             // Where to look.
        FALSE                       // Don't clear object data.
    );

	// load the sound file for piece placement as segment
    WCHAR wstrFileName1[MAX_PATH] = L"place.wav";
 
	if (FAILED(g_pLoader->LoadObjectFromFile(
        CLSID_DirectMusicSegment,   // Class identifier.
        IID_IDirectMusicSegment8,   // ID of desired interface.
        wstrFileName1,              // Filename.
        (LPVOID*) &g_pSegmentPlace  // Pointer that receives interface.
    )))
    {
        MessageBox( NULL, "Sound effect missing: \"place.wav\"", 
                          "GoGL", MB_OK );
		closeSound();
		exit(0);
    } else g_bSound1 = true;

	// load the sound file for piece capture as segment
    WCHAR wstrFileName2[MAX_PATH] = L"cap.wav";
 
	if (FAILED(g_pLoader->LoadObjectFromFile(
        CLSID_DirectMusicSegment,   // Class identifier.
        IID_IDirectMusicSegment8,   // ID of desired interface.
        wstrFileName2,              // Filename.
        (LPVOID*) &g_pSegmentCapture  // Pointer that receives interface.
    )))
    {
        MessageBox( NULL, "Sound effect missing: \"cap.wav\"", 
                          "GoGL", MB_OK );
		closeSound();
		exit(0);
    } else g_bSound2 = true;

	// load the sound file for game end as segment
    WCHAR wstrFileName3[MAX_PATH] = L"endgame.wav";
 
    	if (FAILED(g_pLoader->LoadObjectFromFile(
        CLSID_DirectMusicSegment,   // Class identifier.
        IID_IDirectMusicSegment8,   // ID of desired interface.
        wstrFileName3,              // Filename.
        (LPVOID*) &g_pSegmentEndGame  // Pointer that receives interface.
    )))
    {
        MessageBox( NULL, "Sound effect missing: \"endgame.wav\"", 
                          "GoGL", MB_OK );
        closeSound();
		exit(0);
	} else g_bSound3 = true;
}
int main(void)
{
	system("mode con lines=25 cols=80");	//콘솔 창 크기 초기화

	UserInfo *userInfo = NULL;
	FILE *readFile = NULL;
	FILE *writeFile = NULL;
	int input = 1, menu = 1, choice;
	int *ptr = &menu;
	char *menu_num[MENU_NUM];

	puts("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t        =  시작하는 중  = \n\n\n\n\n\n\n\n\n\n\n");

	userInfo = setUserInfo(userInfo, readFile);	//구조체 배열에 파일 데이터 저장
	if (userInfo == (UserInfo*)-1) return 0;	//오류 났을 경우 바로 종료

	startSound();	//로딩 완료 효과음

	printMainSub(menu, menu_num);	//메인 메뉴 구성

	while(1) {
		printMain(menu, menu_num);	//메인 화면 출력
		
		input = getch();	//입력
		
		if (input == ARROW_BUFFER)	//방향키는 입력 시 아스키확장 값이 먼저 들어온 후 값이 들어옴
			input = getch();	//그래서 이 경우 버퍼를 한번 비우도록 하였음

		switch (input)
		{
		case UP_ARROW_KEY:	//상 방향키
			if (menu > 1) menu--;
			moveSound();
			break;
		case DOWN_ARROW_KEY:	//하 방향키
			if (menu < 6) menu++;
			moveSound();
			break;
		case ENTER_KEY:		//enter키
			inSound();
			switch (menu)
			{
			case 1:	//출력
				printList(userInfo);
				break;
			case 2:	//등록
				addUser(userInfo);
				break;
			case 3:	//삭제
				searchMain(userInfo, _DELETE, "삭제", "Delete");
				break;
			case 4:	//수정
				searchMain(userInfo, MODIFY, "수정", "Modify");
				break;
			case 5:	//검색
				searchMain(userInfo, SEARCH, "검색", "Search");
				break;
			case 6:	//저장
				saveInfo(userInfo, writeFile);
				break;

			} //switch(menu) out
			break;
		case ESC_KEY:		//esc키
			inSound();
			choice = closeProgram();

			if (choice == SAVE)
				choice = saveInfo(userInfo, writeFile);

			if (choice == SAVE || choice == EXIT){
				printClose();

				free(userInfo);

				closeSound();
				printClose_sub();
				return 0;
			}
			else break;
		default:
			warningMessage(input - '0', 6, ptr);
			break;
		} //switch(input) out
	}

	free(userInfo);
	return 0;
}
Example #11
0
int 
main(int argc, char **argv) 
{
  int windX=10;
  int windY=30;
  int windWidth=uiWidth;
  int windHeight=uiHeight;
  int c;
  int xx, xy;
  opterr = 0;

  /*
  KAboutData aboutData( "kscdmagic", I18N_NOOP("kscdmagic"),
			KSCDMAGICVERSION, I18N_NOOP("sound visualisation"), 
			KAboutData::License_GPL,
			"(c) 2000, Dirk Försterling");
  aboutData.addAuthor("Paul Harrison",0, "*****@*****.**");
  aboutData.addAuthor("Dirk Försterling",0, "*****@*****.**");

  KCmdLineArgs::init( argc, argv, &aboutData );

  KApplication magicApp;
  */


  openSound(SourceCD, 44100, "/dev/dsp", NULL);

  catchSignals();

  while ((c = getopt(argc, argv, "b:h:w:")) != -1){
    switch (c)
      {
      case '?':
	fprintf(stderr, "%s: unknown option \"%s\"\n", 
		argv[0], argv[optind-1]);
	usage(argv[0]);
	exit(1);	
      case 'b':
	bright = (double) atoi(optarg);
	bright = bright/10;
	break;
      case 'w':
	windWidth = atoi(optarg);
	break;
      case 'h':
	windHeight = atoi(optarg);
	break;
      }
  }
  
  if (bright > 1.0)
    bright = 1.0;
  else if (bright < 0.0)
    bright = 0.0;
  
  if (windWidth < 1)
    windWidth = uiWidth;
  if (windHeight < 1)
    windHeight = uiHeight;

  screenInit(windX,windY,windWidth,windHeight);

  allocOutput(outWidth,outHeight);

  coreInit();
  

  setStarSize(starSize);
  setBrightness(bright);

  time_t timer = time(NULL);
  
  int frames = 0;

  for(;;) {
    fade();
    if (-1 == coreGo())
      break;

    polygonEngine.clear();

    for( xy = 0; xy < 48; xy++)
      {
	for( xx = 0; xx < 48; xx++)
	  {
	    if ( logo[xy][xx] != 0)
	      {
		polygonEngine.add(32769, xx+10, xy+3);
	      }
	  }
      }
    polygonEngine.apply(outputBmp.data);
    screenShow(); 



    frames++;
    if(processUserInput() == -1)
      break;
  } 

  
  timer = time(NULL) - timer;
  delete ucoutput;
  closeSound();
  
  if (timer > 10)
    fprintf(stderr,"Frames per second: %f\n", double(frames)/timer);
  
  return 0;
} // main() /* linux */