[Scummvm-cvs-logs] CVS: scummvm/simon midi.cpp,1.6,1.7 simon.cpp,1.10,1.11 simon.h,1.7,1.8 simonsys.cpp,1.3,1.4

Ludvig Strigeus strigeus at users.sourceforge.net
Sun Apr 14 11:14:05 CEST 2002


Update of /cvsroot/scummvm/scummvm/simon
In directory usw-pr-cvs1:/tmp/cvs-serv31838/simon

Modified Files:
	midi.cpp simon.cpp simon.h simonsys.cpp 
Log Message:
wrote new mixer class,
cleaned up sound header files,
integrated mixer into scummvm & simon


Index: midi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/midi.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** midi.cpp	13 Apr 2002 20:08:58 -0000	1.6
--- midi.cpp	14 Apr 2002 18:13:08 -0000	1.7
***************
*** 24,28 ****
  #include "scummsys.h"
  #include "system.h"
! #include "gmidi.h"
  #include "simon.h"
  
--- 24,29 ----
  #include "scummsys.h"
  #include "system.h"
! #include "mididrv.h"
! #include "mixer.h"
  #include "simon.h"
  

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** simon.cpp	14 Apr 2002 11:00:33 -0000	1.10
--- simon.cpp	14 Apr 2002 18:13:08 -0000	1.11
***************
*** 24,29 ****
--- 24,31 ----
  #include "scummsys.h"
  #include "system.h"
+ #include "mixer.h"
  #include "simon.h"
  
+ 
  #include <errno.h>
  #include <time.h>
***************
*** 5035,5040 ****
  //	warning("vc_29_stop_all_sounds unimplemented");
  	
! 	_voice_size = 0;
! 	_sound_size = 0;
  }
  
--- 5037,5041 ----
  //	warning("vc_29_stop_all_sounds unimplemented");
  	
! 	_mixer->stop_all();
  }
  
***************
*** 6519,6523 ****
  	if (_voice_file==NULL)
  		return false;
! 	return _voice_size == 0;
  #endif
  }
--- 6520,6524 ----
  	if (_voice_file==NULL)
  		return false;
! 	return _voice_sound == 0;
  #endif
  }
***************
*** 6575,6581 ****
  		rewind(in);
  		
! 		/* if a sound is playing, stop it */
! 		_sound_size = 0;
! 
  
  		if (_sfx_heap) free(_sfx_heap);
--- 6576,6581 ----
  		rewind(in);
  		
! 		/* stop all sounds */
! 		_mixer->stop_all();
  
  		if (_sfx_heap) free(_sfx_heap);
***************
*** 6596,6603 ****
  		vc_29_stop_all_sounds();
  
- 		/* if a sound is playing, stop it */
- 		_sound_size = 0;
- 
- 
  		if (_sfx_heap) free(_sfx_heap);
  
--- 6596,6599 ----
***************
*** 7387,7391 ****
  	loadIconFile();
  	
! 	_system->init_size(320,200,OSystem::SOUND_8BIT);
  	
  	startUp(1);
--- 7383,7387 ----
  	loadIconFile();
  	
! 	_system->init_size(320,200);
  	
  	startUp(1);
***************
*** 7412,7415 ****
--- 7408,7412 ----
  }
  
+ #if 0
  void SimonState::generateSound(byte *ptr, int len) {
  	uint cur;
***************
*** 7439,7446 ****
  	}
  }
  
! static void fill_sound(void *userdata, int16 *stream, int len) {
! 	((SimonState*)userdata)->generateSound((byte*)stream, len*2);
! }
  
  void SimonState::dx_copy_rgn_from_3_to_2(uint b, uint r, uint y, uint x) {
--- 7436,7444 ----
  	}
  }
+ #endif
  
! //static void fill_sound(void *userdata, int16 *stream, int len) {
! //	((SimonState*)userdata)->generateSound((byte*)stream, len*2);
! //}
  
  void SimonState::dx_copy_rgn_from_3_to_2(uint b, uint r, uint y, uint x) {
***************
*** 7580,7585 ****
  	_vk_t_toggle = true;
  
! 	_system->set_param(OSystem::PARAM_SHOW_DEFAULT_CURSOR, 1);
! 	_system->set_sound_proc(this, fill_sound);
  
  	while(1) {
--- 7578,7585 ----
  	_vk_t_toggle = true;
  
! 	_system->property(OSystem::PROP_SHOW_DEFAULT_CURSOR, 1);
! 	
! 	_mixer->bind_to_system(_system);
! 	_mixer->set_volume(256);
  
  	while(1) {
***************
*** 7916,7924 ****
  //	assert(voice < 14496/4);
  
- 	_voice_size = 0;
- 
  	if (_voice_offsets == NULL)
  		return;
  
  	fseek(_voice_file, _voice_offsets[voice], SEEK_SET);
  
--- 7916,7924 ----
  //	assert(voice < 14496/4);
  
  	if (_voice_offsets == NULL)
  		return;
  
+ 	_mixer->stop(_voice_sound);
+ 
  	fseek(_voice_file, _voice_offsets[voice], SEEK_SET);
  
***************
*** 7938,7942 ****
  		}
  
! 	_voice_size = data[1];
  }
  
--- 7938,7943 ----
  		}
  
! 	_mixer->play_raw(&_voice_sound, _voice_file, data[1], wave_hdr.samples_per_sec, 
! 		SoundMixer::FLAG_FILE|SoundMixer::FLAG_UNSIGNED);
  }
  
***************
*** 7946,7951 ****
  		byte *p;
  		
! 		/* stop any currently playing sound */
! 		_sound_size = 0;
  
  		/* Check if _sfx_heap is NULL */
--- 7947,7951 ----
  		byte *p;
  		
! 		_mixer->stop(_playing_sound);
  
  		/* Check if _sfx_heap is NULL */
***************
*** 7969,7974 ****
  		}
  
! 		_sound_ptr = p + 8;
! 		_sound_size = ((uint32*)p)[1];
  	} else {
  		warning("playSound(%d)", sound);
--- 7969,7973 ----
  		}
  
! 		_mixer->play_raw(&_playing_sound, p+8,*(uint32*)(p+4),22050,SoundMixer::FLAG_UNSIGNED);
  	} else {
  		warning("playSound(%d)", sound);

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** simon.h	14 Apr 2002 11:00:33 -0000	1.7
--- simon.h	14 Apr 2002 18:13:08 -0000	1.8
***************
*** 1,11 ****
! /* Copyright ©2002, The ScummVM Team.
   *
-  * Current status:
-  * Save/Load dialog doesn't work. You can still save, but only to ONE slot.
-  * There is possibly one or two problems that makes it impossible to finish SIMON1WIN.
-  * Sound & Music only works with SIMON1WIN.
-  * SIMON1DOS works, but without sound & music.
-  * Simon 2 works a little.
-  * The code only compiles in win32. It's currently not alignment safe and not endian safe.
   */
  
--- 1,21 ----
! /* ScummVM - Scumm Interpreter
!  * Copyright (C) 2001/2002 The ScummVM project
!  *
!  * This program is free software; you can redistribute it and/or
!  * modify it under the terms of the GNU General Public License
!  * as published by the Free Software Foundation; either version 2
!  * of the License, or (at your option) any later version.
! 
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
! 
!  * You should have received a copy of the GNU General Public License
!  * along with this program; if not, write to the Free Software
!  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
!  *
!  * $Header$
   *
   */
  
***************
*** 505,512 ****
  	uint _invoke_timer_callback;
  
! 	uint32 _voice_size;
  	
! 	uint32 _sound_size;
! 	byte *_sound_ptr;
  
  	uint _vga_sprite_changed;
--- 515,522 ----
  	uint _invoke_timer_callback;
  
! //	uint32 _voice_size;
  	
! //	uint32 _sound_size;
! //	byte *_sound_ptr;
  
  	uint _vga_sprite_changed;
***************
*** 543,546 ****
--- 553,558 ----
  	bool _fcs_data_2[8];
  
+ 	SoundMixer _mixer[1];
+ 
  	ThreeValues _threevalues_1, _threevalues_2, _threevalues_3, _threevalues_4;
  
***************
*** 575,578 ****
--- 587,593 ----
  	int _vga_tick_counter;
  
+ 	PlayingSoundHandle _playing_sound;
+ 	PlayingSoundHandle _voice_sound;
+ 
  	int _timer_id;
  
***************
*** 995,999 ****
  	void playSound(uint sound);
  
! 	void generateSound(byte *ptr, int len);
  
  	void playMusic(uint music);
--- 1010,1015 ----
  	void playSound(uint sound);
  
! 
! //	void generateSound(byte *ptr, int len);
  
  	void playMusic(uint music);

Index: simonsys.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simonsys.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** simonsys.cpp	13 Apr 2002 20:08:58 -0000	1.3
--- simonsys.cpp	14 Apr 2002 18:13:08 -0000	1.4
***************
*** 24,27 ****
--- 24,28 ----
  #include "scummsys.h"
  #include "system.h"
+ #include "mixer.h"
  #include "simon.h"
  





More information about the Scummvm-git-logs mailing list