Mercurial > otakunoraifu
changeset 26:f45da03ca631
* Corrected --disable-vorbis in configure.ac
* Added sound configuration
* Added misc functions
author | thib |
---|---|
date | Sun, 01 Mar 2009 19:08:02 +0000 |
parents | 2110e0cf64ac |
children | 3a6aaeab7b4e |
files | configure.ac music2/music.cc music2/music.h scn2k/scn2k_grp.cc system/system_config.cc |
diffstat | 5 files changed, 46 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac +++ b/configure.ac @@ -80,7 +80,7 @@ AC_CHECK_LIB(jpeg, jpeg_start_decompress dnl ogg vobis AC_ARG_WITH(vorbis, AS_HELP_STRING([--disable-vorbis], [Build with vorbis and ogg (default yes)])) -if test X$with_vorbis = X"yes"; then +if test X$with_vorbis != X"no"; then AC_ARG_ENABLE(tremor, AS_HELP_STRING([--enable-tremor], [enable tremor (integer-only implementation of vorbisfile) (default no)])) AC_CHECK_LIB(ogg, ogg_stream_init)
--- a/music2/music.cc +++ b/music2/music.cc @@ -43,9 +43,6 @@ using namespace std; -#define MUSIC_VOLUME 0.2 -#define MUSIC_VOLUME 1 - int pcm_enable = 0; Mix_Chunk *play_chunk[MIX_PCM_SIZE]; @@ -60,11 +57,12 @@ MuSys::MuSys(AyuSysConfig& _config) : co // #define delete fprintf(stderr,"smus.cc: %d.",__LINE__), delete -void bgm_start(const char* path, int loop_pt); -void effec_start(int chn, const char* path, int loop, int fadein_time); +void bgm_start(const char* path, int loop_pt, int * volmod); +void effec_start(int chn, const char* path, int loop, int fadein_time, int * volmod); void bgm_fadeout(int time); void MuSys::PlayCDROM(char* name, int play_count) { + config.GetParam("#VOLMOD", 4, &volmod[0], &volmod[1], &volmod[2], &volmod[3]); char wave[128]; wave[127] = '\0'; wave[0] = '\0'; strcpy(cdrom_track, name); @@ -83,9 +81,9 @@ void MuSys::PlayCDROM(char* name, int pl // BGM 再生 if (!pcm_enable) return; if (play_count == 0) - bgm_start(wave, -1); + bgm_start(wave, -1, volmod); else - bgm_start(wave, config.track_name.TrackStart(name)); + bgm_start(wave, config.track_name.TrackStart(name), volmod); return; } @@ -99,16 +97,16 @@ void MuSys::StopCDROM(int time) void MuSys::PlaySE(const char* se, int loop_flag, int channel) { if (! pcm_enable) return; if (loop_flag) - effec_start(MIX_PCM_EFFEC, se, 10000, 0); + effec_start(MIX_PCM_EFFEC, se, 10000, 0, volmod); else - effec_start(MIX_PCM_EFFEC, se, 0, 0); + effec_start(MIX_PCM_EFFEC, se, 0, 0, volmod); return; } void MuSys::PlaySE(int number) { if (! pcm_enable) return; const char* se_name = config.track_name.SETrack(number); if (se_name == 0) return; - effec_start(MIX_PCM_EFFEC, se_name, 0, 0); + effec_start(MIX_PCM_EFFEC, se_name, 0, 0, volmod); return; } void MuSys::StopSE(int time) { @@ -175,6 +173,7 @@ void MuSys::FinalizeMusic(void) struct WavChunk { WAVFILE* wav; int loop_pt; + int *volmod; static void callback(void* userdata, Uint8* stream, int len); }; WavChunk wav_playing; @@ -202,7 +201,7 @@ void WavChunk::callback(void *userdata, } } - int cur_vol = MUSIC_VOLUME*SDL_MIX_MAXVOLUME; + int cur_vol = (*chunk->volmod)*SDL_MIX_MAXVOLUME/255; if (fadetime_total) { // 音楽を停止中 (fade out) @@ -233,7 +232,7 @@ void bgm_fadeout(int time) { static SDL_RWops* OpenSDLRW(const char* path); static WAVFILE* OpenWaveFile(const char* path); -void bgm_start(const char* path, int loop_pt) { +void bgm_start(const char* path, int loop_pt, int * volmod) { if (! pcm_enable) return; fprintf(stderr,"bgm start %s\n",path); WAVFILE* wav = OpenWaveFile(path); @@ -248,14 +247,14 @@ fprintf(stderr,"bgm start %s\n",path); } wav_playing.wav = wav; wav_playing.loop_pt = loop_pt; + wav_playing.volmod = &volmod[0]; fadetime_total = 0; fadecount = 0; Mix_HookMusic( &(WavChunk::callback), (void*)&wav_playing); - Mix_VolumeMusic(MUSIC_VOLUME*MIX_MAX_VOLUME); return; } -void effec_start(int chn, const char* path, int loop, int fadein_time) { +void effec_start(int chn, const char* path, int loop, int fadein_time, int * volmod) { if (! pcm_enable) return; SDL_RWops* op = OpenSDLRW(path); if (op == 0) { // ファイルが見付からない @@ -268,10 +267,10 @@ void effec_start(int chn, const char* pa } play_chunk[chn] = Mix_LoadWAV_RW(op, 1); if (fadein_time <= 0) { - Mix_Volume(chn, 128); + Mix_Volume(chn, volmod[3]*SDL_MIX_MAXVOLUME/255); Mix_PlayChannel(chn, play_chunk[chn],loop); } else { - Mix_Volume(chn, 128); + Mix_Volume(chn, volmod[3]*SDL_MIX_MAXVOLUME/255); Mix_FadeInChannel(chn, play_chunk[chn],loop,fadein_time); } return; @@ -304,7 +303,7 @@ void MuSys::PlayKoe(const char* path) { if (playing_koedata == 0) { return; } - Mix_Volume(chn, 128); + Mix_Volume(chn, volmod[1]*SDL_MIX_MAXVOLUME/255); play_chunk[chn] = Mix_LoadWAV_RW(SDL_RWFromMem(playing_koedata, len+0x2c), 1); Mix_PlayChannel(chn, play_chunk[chn],0); return;
--- a/music2/music.h +++ b/music2/music.h @@ -39,6 +39,7 @@ struct MuSys { char cdrom_track[128]; char effec_track[128]; int movie_id; int music_enable; + int volmod[4]; // BGM, KOE, PCM, Se MuSys(AyuSysConfig& _config); void PlayCDROM(char* name, int play_count);
--- a/scn2k/scn2k_grp.cc +++ b/scn2k/scn2k_grp.cc @@ -1741,13 +1741,19 @@ void GrpImpl::Exec(Cmd& cmd) { cmd.clear(); } } - if (cmd.cmd1 == 1 && cmd.cmd2 == 4) { // Percentage... maybe not working? - if (cmd.cmd3 == 0x5de) { + if (cmd.cmd1 == 1 && cmd.cmd2 == 4) { + if (cmd.cmd3 == 0x5dc) // Total number of CG + cmd.SetSysvar(cgm_size); + if (cmd.cmd3 == 0x5dd) // Number of CG viewed + cmd.SetSysvar(cgm_data.size()); + if (cmd.cmd3 == 0x5de) // Percentage of CG viewed cmd.SetSysvar(cgm_data.size() * 100 / cgm_size); - } + if (cmd.cmd3 == 0xd8 || cmd.cmd3 == 0xd3 || cmd.cmd3 == 0xd2 || cmd.cmd3 == 0xd7) { cmd.clear(); // いつも 0xd8 / 0xd7 と組で出てくる } + + // CG Status if (cmd.cmd3 == 0x5e0) { // 画像既視フラグを得る string s = cmd.Str(cmd.args[0]); if (cgm_info.find(s) == cgm_info.end()) { @@ -1758,6 +1764,16 @@ void GrpImpl::Exec(Cmd& cmd) { if (cgm_data.find(n) == cgm_data.end()) cmd.SetSysvar(0); else cmd.SetSysvar(1); } + + if (cmd.cmd3 == 0x6a4) { // CreateInput (index, x, y, width, height, fontsize, br, bg, bb, fr, fg, fb) + int index = cmd.args[0].value; + int x = cmd.args[1].value; + int y = cmd.args[2].value; + //TODO + } + if (cmd.cmd3 == 0x6ae) { // SetInput (index, text) + //TODO + } } #if 1 /* object 操作 */ @@ -2202,11 +2218,17 @@ 487 / 8047 : unsupported command; 0x23 - // if (!music.IsStopSE()) status = WAIT_SE; cmd.clear(); } - if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && (cmd.cmd3 == 0x8b6 || cmd.cmd3 == 0x91a) ) { + // 音楽モードで音量を上げるためのコマンド (SetBgmVolume) // とりあえず未実装 + if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x8b6 && cmd.cmd3 <= 0x8b9) { // Set{Bgm,Koe,PCM,Se}VolMod + music.volmod[cmd.cmd3-0x8b6] = cmd.args[0].value; + config.SetParam("#VOLMOD", 4, music.volmod[0], music.volmod[1], music.volmod[2], music.volmod[3]); cmd.clear(); } + if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x91a && cmd.cmd3 <= 0x91d) { // Get{Bgm,Koe,PCM,Se}VolMod + cmd.SetSysvar(music.volmod[cmd.cmd3-0x91a]); + } if (cmd.cmd1 == 1 && cmd.cmd2 == 0x16) { if (cmd.cmd3 == 0 && cmd.cmd4 == 0) {
--- a/system/system_config.cc +++ b/system/system_config.cc @@ -789,6 +789,8 @@ AyuSysConfig::AyuSysConfig(void) { SetOrigParam("#SCREENSIZE_MOD", 1, 0); /* 0 = 640x480; 1 = 800x600 */ SetOrigParam("#LASTSAVE", 1, 0); + + SetOrigParam("#VOLMOD", 4, 128, 128, 128, 128); } AyuSysConfig::~AyuSysConfig(void) { delete str_config;