void op_animate(void) { int door_x, door_y; // Sony Vegas calls this a "Barn Door" transition. const char gbZUN[] = {gb_Z_, gb_U_, gb_N_, 0}; text_wipe(); snd_load("huuma.efc", SND_LOAD_SE); pi_load_put_free_to("op2.pi", 1); pi_load_put_free_to("op.pi", 0); pi_slot_load(0, "opa.pi"); pi_slot_load(1, "opb.pi"); pi_slot_load(2, "opc.pi"); palette_white(); for(door_x = 0; door_x < 40; door_x++) { for(door_y = 0; door_y < 25; door_y++) { text_putca(39 - door_x, door_y, ' ', TX_WHITE); text_putca(door_x + 40, door_y, ' ', TX_WHITE); } palette_settone(200 - (door_x * 2)); frame_delay(1); } for(door_x = 40; door_x < 50; door_x++) { palette_settone(200 - (door_x * 2)); frame_delay(1); } palette_100(); if(mikoconfig->demo_num == 0) { door_x = 0; if(snd_midi_possible) { door_x = snd_midi_active; snd_midi_active = 1; snd_load("op.m", SND_LOAD_SONG); } snd_midi_active = 0; snd_load("op.m", SND_LOAD_SONG); snd_midi_active = door_x; } frame_delay(18); title_flash(); palette_white(); graph_accesspage(1); graph_gaiji_putc(548, 384, gs_COPYRIGHT, 0); graph_gaiji_puts(564, 384, 16, gbZUN, 0); graph_gaiji_putc(544, 380, gs_COPYRIGHT, 6); graph_gaiji_puts(560, 380, 16, gbZUN, 6); graph_copy_page(0); if(mikoconfig->demo_num == 0) { snd_kaja_func(KAJA_SONG_PLAY, 0); } mikoconfig->demo_num = 0; palette_entry_rgb_show("op.rgb"); palette_white_in(6); }
/** * Load the interface sounds into memory */ void gamesnd_load_interface_sounds() { if ( !Sound_enabled ) return; Assert( Snds_iface.size() < INT_MAX ); for (SCP_vector<game_snd>::iterator si = Snds_iface.begin(); si != Snds_iface.end(); ++si) { if ( si->filename[0] != 0 && strnicmp(si->filename, NOX("none.wav"), 4) ) { si->id = snd_load(&(*si)); } } }
// ------------------------------------------------------------------------------------------------- // gamesnd_load_interface_sounds() // // Load the interface sounds into memory // void gamesnd_load_interface_sounds() { int i; game_snd *gs; for ( i = 0; i < MAX_INTERFACE_SOUNDS; i++ ) { gs = &Snds_iface[i]; if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) { gs->id = snd_load(gs); } } }
// ------------------------------------------------------------------------------------------------- // gamesnd_load_gameplay_sounds() // // Load the ingame sounds into memory // void gamesnd_load_gameplay_sounds() { int i; game_snd *gs; for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) { gs = &Snds[i]; if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) { gs->id = snd_load(gs); } } }
// ------------------------------------------------------------------------------------------------- // gamesnd_load_gameplay_sounds() // // Load the ingame sounds into memory // void gamesnd_load_gameplay_sounds() { int i; game_snd *gs; for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) { gs = &Snds[i]; if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) { if ( !gs->preload ) { // don't try to load anything that's already preloaded gs->id = snd_load(gs); } } } }
/** * Load the ingame sounds into memory */ void gamesnd_load_gameplay_sounds() { if ( !Sound_enabled ) return; Assert( Snds.size() <= INT_MAX ); for (SCP_vector<game_snd>::iterator gs = Snds.begin(); gs != Snds.end(); ++gs) { if ( gs->filename[0] != 0 && strnicmp(gs->filename, NOX("none.wav"), 4) ) { if ( !gs->preload ) { // don't try to load anything that's already preloaded game_busy( NOX("** preloading gameplay sounds **") ); // Animate loading cursor... does nothing if loading screen not active. gs->id = snd_load(&(*gs)); } } } }
// load in sounds that we expect will get played // // The method currently used is to load all those sounds that have the hardware flag // set. This works well since we don't want to try and load hardware sounds in on the // fly (too slow). void gamesnd_preload_common_sounds() { int i; game_snd *gs; for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) { gs = &Snds[i]; if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) { if ( gs->preload ) { gs->id = snd_load(gs); } } game_busy(); // Animate loading cursor... does nothing if loading screen not active. } }
// ------------------------------------------------------------------------------------------------- // gamesnd_load_interface_sounds() // // Load the interface sounds into memory // void gamesnd_load_interface_sounds() { int i; game_snd* gs; if (!Sound_enabled) return; for (i = 0; i < Num_iface_sounds; i++) { gs = &Snds_iface[i]; if (gs->filename[0] != 0 && strnicmp(gs->filename, NOX("none.wav"), 4)) { gs->id = snd_load(gs); } } }
// load in sounds that we expect will get played // // The method currently used is to load all those sounds that have the hardware flag // set. This works well since we don't want to try and load hardware sounds in on the // fly (too slow). void gamesnd_preload_common_sounds() { int i; game_snd* gs; if (!Sound_enabled) return; for (i = 0; i < Num_game_sounds; i++) { gs = &Snds[i]; if (gs->filename[0] != 0 && strnicmp(gs->filename, NOX("none.wav"), 4)) { if (gs->preload) { game_busy(NOX("** preloading common game sounds **")); // Animate loading cursor... does nothing if loading screen not active. gs->id = snd_load(gs); } } } }
// ------------------------------------------------------------------------------------------------- // gamesnd_load_gameplay_sounds() // // Load the ingame sounds into memory // void gamesnd_load_gameplay_sounds() { int i; game_snd* gs; if (!Sound_enabled) return; for (i = 0; i < Num_game_sounds; i++) { gs = &Snds[i]; if (gs->filename[0] != 0 && strnicmp(gs->filename, NOX("none.wav"), 4)) { if (!gs->preload) { // don't try to load anything that's already preloaded game_busy(NOX("** preloading gameplay sounds **")); // Animate loading cursor... does nothing if loading screen not active. gs->id = snd_load(gs); } } } }
/*------------------------------------------------------------------------------* | <<< ゲーム初期化 >>> *------------------------------------------------------------------------------*/ void game_init(void) { //--- テクスチャー読み込み ---------------------------------------- FOLDER_SET("画像"); d3_tex_load(TEX_MOJI, "文字.png"); //--- X ファイル読み込み ---------------------------------------------- FOLDER_SET("3Dモデル"); skin_load( X_ENEMY, "enemy.x"); d3_xfile_load(X_LEFT, "punch.mqo"); d3_xfile_load(X_RIGHT, "punch.mqo"); //--- テクスチャー読み込み --------------------------------------------- FOLDER_SET("画像"); d3_tex_load(TEX_BACK, "リング.jpg"); d3_tex_load(TEX_KO_BAR, "ko.png"); d3_tex_load(TEX_TITLE, "タイトル.jpg"); d3_tex_load(TEX_INFO, "説明.jpg"); d3_tex_load(TEX_WIN, "勝利.jpg"); d3_tex_load(TEX_LOSE, "敗北.jpg"); //--- 効果音読み込み --------------------------------------------------- FOLDER_SET("サウンド"); snd_load(SND_PUNCH, "パンチ.wav", false); snd_load(SND_GUARD, "ガード.wav", false); snd_load(SND_PLY_DAMAGE,"プレイヤーダメージ.wav", false); snd_load(SND_ENE_DAMAGE,"エネミーダメージ.wav", false); snd_load(SND_WIN_LOSE, "試合終了.wav", false); snd_load(SND_OK, "ゴング.wav", false); //--- カメラ位置 ------------------------------------------------------- d3.vecCamera = VEC3(0, 15, -10); d3.vecEye = VEC3(0, 15, 0); d3.light.Direction.x = 0; d3.light.Direction.y = 0; d3.light.Direction.z = -d3.vecCamera.z; }
int main(void) { unsigned char ret; if(snd_pmd_resident()) { snd_mmd_resident(); if(game_init_op()) { zun_error(ERROR_OUT_OF_MEMORY); return 1; } extra_unlocked = score_cleared_load(); if(cfg_load() == 1) { return 1; } } else { return 1; } gaiji_backup(); gaiji_entry_bfnt("MIKOFT.bft"); if(mikoconfig->demo_num == 0) { demo_num = 1; snd_kaja_func(KAJA_SONG_STOP, 0); } else { demo_num = mikoconfig->demo_num + 1; if(demo_num > 3) { demo_num = 1; } score_duration = 350; score_menu(); graph_showpage(0); graph_accesspage(0); } input = 0; snd_active = snd_bgm_mode; if(!mikoconfig->demo_num && snd_midi_possible) { char midi_active = snd_midi_active; snd_midi_active = 1; snd_load("gminit.m", SND_LOAD_SONG); snd_kaja_func(KAJA_SONG_PLAY, 0); snd_midi_active = midi_active; } op_animate(); pi_slot_load(2, "ts3.pi"); pi_slot_load(1, "ts2.pi"); input = 0; idle_frames = 0; while(!quit) { input_sense(); if(in_option == 0) { main_update_and_render(); } else if(in_option == 1) { option_update_and_render(); } mikoconfig->frame++; idle_frames++; frame_delay(1); } ret = mikoconfig->op_main_retval; mikoconfig_sgm = 0; cfg_save(); text_clear(); graph_clear(); game_exit_to_dos(); gaiji_restore(); return ret; }
/* load the images with the right scaleing */ void game_start () { int p, i; menu_displaytext ("Loading..", "Please Wait"); bman.players_nr_s = 0; bman.playnum += 1; for (p = 0; p < MAX_PLAYERS; p++) { if (PS_IS_used (players[p].state)) { bman.players_nr_s++; if (players[p].gfx_nr == -1) { players[p].gfx = NULL; players[p].state &= (0xff - (PSF_alife + PSF_playing)); } else { players[p].state |= PSF_alife + PSF_playing; players[p].gfx = &gfx.players[players[p].gfx_nr]; } } else players[p].state = 0; players[p].bombs_n = bman.start_bombs; players[p].range = bman.start_range; players[p].speed = bman.start_speed; players[p].collect_shoes = 0; players[p].special.type = SP_nothing; players[p].special.use = 0; players[p].special.clear = 0; players[p].m = 0; players[p].old.x = 0; players[p].old.y = 0; bman.updatestatusbar = 1; players[p].frame = 0.0f; players[p].d = 0; players[p].pos.x = 0.0; players[p].pos.y = 0.0; players[p].tunnelto = 0.0f; players[p].ready = 0; // add reset nbrKilled value players[p].nbrKilled = 0; /* all types of illnes turn them off */ for (i = 0; i < PI_max; i++) players[p].ill[i].to = 0.0f; // reset bombs for (i = 0; i < MAX_BOMBS; i++) { players[p].bombs[i].state = BS_off; players[p].bombs[i].ex_nr = -1; players[p].bombs[i].fdata = 0; players[p].bombs[i].dest.x = 0; players[p].bombs[i].dest.y = 0; players[p].bombs[i].mode = BM_normal; players[p].bombs[i].id.p = p; players[p].bombs[i].id.pIgnition = p; players[p].bombs[i].id.b = i; players[p].pos.x = 0; players[p].pos.x = 0; } } flitems_reset (); init_map_tileset (); tileset_load (map.tileset, -1, -1); gfx_load_players (gfx.block.x, gfx.block.y); snd_load (map.tileset); snd_music_start (); map.state = MS_normal; bman.timeout = bman.init_timeout; s_calctimesync (); // to clean up the timesyc s_calctimesync (); // data run this twice if (GT_MP_PTPM) net_send_servermode (); };
void handleKey(SDL_KeyboardEvent key) { switch(key.keysym.sym) { case SDLK_s: // sinus smpls = gen_sin_buffer(); break; case SDLK_q: // square smpls = gen_square_buffer(); break; case SDLK_t: // triangle smpls = gen_triangle_buffer(); break; case SDLK_w: // sawtooth wave smpls = gen_sawtooth_buffer(); break; case SDLK_x: // sinsquare wave waveform = 3; break; case SDLK_p: // puls with modulation smpls = gen_pwm_buffer(0.2); break; case SDLK_l: // load sinus smpls = snd_load("/media/c5bcf67f-e9eb-4e12-be75-d8b6e09e27ba/olivier/hti/ginf/cpu-emu/cpu-emu/sin.table"); break; case SDLK_1: // note 1 anspielen case SDLK_2: // note 2 anspielen case SDLK_3: // note 3 anspielen case SDLK_4: // note 4 anspielen if(key.state == SDL_PRESSED) { instrument[0].gate = 1; // start adsr attack phase instrument[0].adsr_counter = 0; // start adsr attack phase printf("KEy 1 pressed %c\n",key.keysym.sym); } if(key.state == SDL_RELEASED){ instrument[0].gate = 0; // enter release phase instrument[0].sustain_start = instrument[0].adsr_counter; printf("KEy 1 released\n"); } break; /* case SDLK_c: // copy if( copyintomem ==0){ copyintomem = 1; } else { copyintomem =0 ; } break; case SDLK_a: // adsr if(key.type == SDL_PRESSED) { adsr = 1; printf("KEy a pressed\n"); } //printf("KEy 1 pressed %i %c %i\n",key.type,key.keysym.sym,SDL_PRESSED); if(key.type == SDL_RELEASED){ adsr = 0; printf("KEy a released\n"); } break; */ default: /* do nothing */ break; } }
// plays the voice file associated with a training message. Automatically streams the file // from disk if it's over 100k, otherwise plays it as a normal file in memory. Returns -1 // if it didn't play, otherwise index of voice int message_play_training_voice(int index) { int len; CFILE *fp; if (index < 0) { if (Training_voice >= 0) { if (Training_voice_type) { audiostream_close_file(Training_voice_handle, 0); } else { snd_stop(Training_voice_handle); } } Training_voice = -1; return -1; } if (Message_waves[index].num < 0) { fp = cfopen(Message_waves[index].name, "rb"); if (!fp) return -1; len = cfilelength(fp); cfclose(fp); if (len > 100000) { if ((Training_voice < 0) || !Training_voice_type || (Training_voice != index)) { if (Training_voice >= 0) { if (Training_voice_type) { if (Training_voice == index) audiostream_stop(Training_voice_handle, 1, 0); else audiostream_close_file(Training_voice_handle, 0); } else { snd_stop(Training_voice_handle); } } if (stricmp(Message_waves[index].name, NOX("none.wav"))) { Training_voice_handle = audiostream_open(Message_waves[index].name, ASF_VOICE); if (Training_voice_handle < 0) { nprintf(("Warning", "Unable to load voice file %s\n", Message_waves[index].name)); // Warning(LOCATION, "Unable to load voice file %s\n", Message_waves[index].name); } } } // Training_voice should be valid and loaded now Training_voice_type = 1; if (Training_voice_handle >= 0) audiostream_play(Training_voice_handle, Master_voice_volume, 0); Training_voice = index; return Training_voice; } else { game_snd tmp_gs; memset(&tmp_gs, 0, sizeof(game_snd)); strcpy(tmp_gs.filename, Message_waves[index].name); Message_waves[index].num = snd_load(&tmp_gs, 0); if (Message_waves[index].num < 0) { nprintf(("Warning", "Cannot load message wave: %s. Will not play\n", Message_waves[index].name)); return -1; } } } if (Training_voice >= 0) { if (Training_voice_type) { audiostream_close_file(Training_voice_handle, 0); } else { snd_stop(Training_voice_handle); } } Training_voice = index; if (Message_waves[index].num >= 0) Training_voice_handle = snd_play_raw(Message_waves[index].num, 0.0f); else Training_voice_handle = -1; Training_voice_type = 0; return Training_voice; }
void pascal musicroom(void) { static unsigned char track_playing = 0; music_page = 1; palette_black(); graph_showpage(0); graph_accesspage(0); graph_clear(); graph_accesspage(1); pi_load_put_free(0, "op3.pi"); music_sel = track_playing; draw_tracks(music_sel); graph_copy_page(0); graph_accesspage(1); graph_showpage(0); screen_back_B_snap(); cmt_back_snap(); graph_accesspage(1); draw_cmt(track_playing); graph_accesspage(0); draw_cmt(track_playing); palette_100(); do { input_sense(); if(input) { music_flip(); continue; } controls: input_sense(); if(input & INPUT_UP) { draw_track(music_sel, 3); if(music_sel > 0) { music_sel--; } else { music_sel = SEL_QUIT; } if(music_sel == TRACK_COUNT) { music_sel--; } draw_track(music_sel, 15); } if(input & INPUT_DOWN) { draw_track(music_sel, 3); if(music_sel < SEL_QUIT) { music_sel++; } else { music_sel = 0; } if(music_sel == TRACK_COUNT) { music_sel++; } draw_track(music_sel, 15); } if(input & INPUT_SHOT || input & INPUT_OK) { if(music_sel != SEL_QUIT) { char midi_active = snd_midi_active; snd_midi_active = snd_midi_possible; snd_load(MUSIC_FILES[music_sel], SND_LOAD_SONG); snd_midi_active = 0; snd_load(MUSIC_FILES[music_sel], SND_LOAD_SONG); snd_midi_active = midi_active; snd_kaja_func(KAJA_SONG_PLAY, 0); track_playing = music_sel; draw_cmt(music_sel); music_flip(); draw_cmt(music_sel); } else { break; } } if(input & INPUT_CANCEL) { break; } if(!input) { music_flip(); goto controls; } } while(1); while(1) { input_sense(); if(input) { music_flip(); } else { break; } }; screen_back_B_free(); cmt_back_free(); graph_showpage(0); graph_accesspage(0); graph_clear(); graph_accesspage(1); pi_load_put_free(0, "op2.pi"); palette_entry_rgb_show("op.rgb"); graph_copy_page(0); graph_accesspage(0); }
int main(int argc, char* argv[]){ foutp=fopen("data.out", "w"); close(foutp); //smpls = gen_triangle_buffer(); // smpls = gen_sawtooth_buffer(); smpls = snd_load("/media/c5bcf67f-e9eb-4e12-be75-d8b6e09e27ba/olivier/hti/ginf/cpu-emu/cpu-emu/sin.table"); /* //sound_buffer = malloc(sizeof(SNDFMT)*512); */ /* // mem[0] = malloc(sizeof(SNDFMT)*mem0size); */ /* // mem[1] = malloc(sizeof(SNDFMT)*mem1size); */ /* // init without mixer init_sdl (); */ /* // start SDL with audio support */ if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_AUDIO) < 0) exit (-1); atexit (SDL_Quit); screen = SDL_SetVideoMode (640, 480, 16, SDL_HWSURFACE); if (screen == NULL) exit (-1); // open SMPFREQ, signed 8bit, system byte order, // stereo audio, using 1024 byte chunks if(Mix_OpenAudio(SMPFREQ, AUDIO_S8, 1, WAVEFORM_LENGTH)==-1) { printf("Mix_OpenAudio: %s\n", Mix_GetError()); exit(2); } Mix_Chunk *sound = NULL; sound = Mix_QuickLoad_RAW(smpls,WAVEFORM_LENGTH); if(sound == NULL) { fprintf(stderr, "Unable to load WAV file: %s\n", Mix_GetError()); } int channel; channel = Mix_PlayChannel(-1, sound, -1); if(channel == -1) { fprintf(stderr, "Unable to play WAV file: %s\n", Mix_GetError()); } //while(Mix_Playing(channel) != 0); int len = WAVEFORM_LENGTH; smpls = gen_sin_buffer(); save("sin.out",smpls,len); smpls = gen_triangle_buffer(); save("triangle.out",smpls,len); smpls = gen_sawtooth_buffer(); save("sawtooth.out",smpls,len); smpls = gen_square_buffer(); save("square.out",smpls,len); smpls = gen_pwm_buffer(0.2); save("pwm.out",smpls,len); // violine int attack = 500; int decay = 300; int sustain = 10; int sustainlength0 = (attack / 1000.0) * SMPFREQ; int sustain_max = 15; // 4 Bit 0-15 float sustain0 = (float) sustain * ((float)1.0)/(float)sustain_max; float sustain_level = sustain0; int release = 750; int release0 = (release / 1000.0) * SMPFREQ; int attack0 = (attack / 1000.0) * SMPFREQ; int decay0 = (decay / 1000.0) * SMPFREQ; int t1 = attack0; int t2 = t1 + decay0; int t3 = t2 + sustainlength0; int t4 = t3 + release0; instrument[0].a_attack = ((float)1.0/(float)attack0); instrument[0].a_decay = ((float) ( 1.0 - sustain0)) / (float) ( t1-t2) ; instrument[0].b_decay = (float)1.0 - ((float)instrument[0].a_decay*(float)attack0); instrument[0].a_release = sustain_level / (float) (t3-t4) ; instrument[0].b_release = sustain_level - (float)instrument[0].a_release * (float)t3; instrument[0].adsr_counter = 0; instrument[0].gate=0; adsr_length = gen_adsr_buffer(&adsr_buffer); saveadsr("data.out",adsr_buffer,adsr_length); savebuffer = malloc(sizeof(float)*adsr_length); // register adsrEffect as a mix processor if(!Mix_RegisterEffect(channel, adsrEffect, NULL, &(instrument[0]) )) { printf("Mix_RegisterEffect: %s\n", Mix_GetError()); } /* Mix_VolumeChunk(sound, volume); */ /* printf("volume: %d\n", volume); */ /* Hz=440; */ /* // main_synthesiser(1, NULL); */ /* printf("start play\n"); */ /* // play (); */ /* // SDL_MixAudio(stream, waveptr, len, SDL_MIX_MAXVOLUME); */ int i=0; SDL_Event event; int done=0; int hzinc=0,amplitudeinc; /* float* adsrptr; int len; saveadsr("data.out",adsrptr,len); if(smp_index < WAVEFORM_LENGTH){ for(i = 0; i < len; i++){ adsrptr[i] = adsrptr[i] * smpls[(int)smp_index]; // smp_index +=freq; smp_index++; if(smp_index >= WAVEFORM_LENGTH) smp_index = 0; } } Mix_CloseAudio(); SDL_Quit(); return 0; */ while(!done) { while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_KEYDOWN: switch(event.key.keysym.sym){ case SDLK_LEFT: volume-=10; Mix_VolumeChunk(sound, volume); // Mix_VolumeChunk(sound, (volume>MIX_MAX_VOLUME-10) ? (volume = MIX_MAX_VOLUME):(volume-=10) ); printf("SDLK_LEFT volume: %i\n",volume); amplitudeinc = -1; break; case SDLK_RIGHT: volume+=10; Mix_VolumeChunk(sound, volume ); // Mix_VolumeChunk(sound, (volume<10) ? (volume = 0): (volume+=10) ); printf("SDLK_RIGHT volume: %i\n",volume); amplitudeinc = +1;; break; case SDLK_UP: hzinc = 1; printf("up active\n"); break; case SDLK_DOWN: hzinc = -1; printf("down active\n"); break; default: handleKey(event.key); break; } break; case SDL_KEYUP: switch(event.key.keysym.sym){ case SDLK_LEFT: amplitudeinc = 0; break; case SDLK_RIGHT: amplitudeinc = 0; break; case SDLK_UP: tonstufe++; hzinc = 0; printf("up in-active\n"); break; case SDLK_DOWN: tonstufe--; hzinc = 0; printf("down in-active\n"); break; default: handleKey(event.key); break; } break; case SDL_QUIT: done = 1; printf("SDL_QUIT\n"); break; case SDL_MOUSEBUTTONUP: switch(event.button.button){ case SDL_BUTTON_WHEELUP: Hz += 1; break; case SDL_BUTTON_WHEELDOWN: Hz -= 1; break; } break; default: /* do nothing */ break; } } freq += hzinc; //Hz= 2*Hz; Hz = Hz + hzinc; amplitude = amplitude + amplitudeinc; // printf("Hz: %f\n",Hz); //% Hz = frequency(music[i++%10]); int y; // SDL_Flip(screen); SDL_Delay (50); } // save("sndout6.snd"); saveadsr("adsr.out",savebuffer,adsr_length); Mix_FreeChunk(sound); Mix_CloseAudio(); SDL_Quit(); return 0; }