Exemplo n.º 1
0
void digi_close(void) {
	if(digi_initialised){
		digi_reset_digi_sounds();
		IDirectSound_Release(lpds);
	}
	digi_initialised = 0;
}
Exemplo n.º 2
0
void digi_set_max_channels(int n)
{
	OSErr err;
	song_resource *song;
	
	digi_max_channels	= n;

	if ( digi_max_channels < 1 ) 
		digi_max_channels = 1;
	if ( digi_max_channels > MAX_SOUND_CHANNELS ) 
		digi_max_channels = MAX_SOUND_CHANNELS;

	if ( !digi_initialized ) return;

	if (digi_midi_song_playing)
		digi_stop_current_song();

	if (midi_volume <= 0)
		ChangeSystemVoices(0, digi_max_channels/2, digi_max_channels);
	else
		ChangeSystemVoices(MAX_MUSIC_CHANNELS, 4 + (digi_max_channels/2), digi_max_channels);
	
	if (digi_last_midi_song != 0)
		digi_play_midi_song(digi_last_midi_song, digi_last_midi_song_loop);

	digi_reset_digi_sounds();
}
Exemplo n.º 3
0
 //added on 980905 by adb to make sound channel setting work
void digi_set_max_channels(int n) { 
	digi_max_channels	= n;

	if ( digi_max_channels < 1 ) 
		digi_max_channels = 1;
	if ( digi_max_channels > (MAX_SOUND_SLOTS-MAX_SOUND_OBJECTS) ) 
		digi_max_channels = (MAX_SOUND_SLOTS-MAX_SOUND_OBJECTS);

	if ( !digi_initialised ) return;

	digi_reset_digi_sounds();
}
Exemplo n.º 4
0
void digi_init_sounds()
{
	int i;

	if (!digi_initialised) return;

	digi_reset_digi_sounds();

	for (i=0; i<MAX_SOUND_OBJECTS; i++ )	{
		if (digi_sounds_initialized) {
			if ( SoundObjects[i].flags & SOF_PLAYING )	{
				DS_release_slot(SoundObjects[i].handle,1);
			}
		}
		SoundObjects[i].flags = 0;	// Mark as dead, so some other sound can use this sound
	}
	digi_sounds_initialized = 1;
}
Exemplo n.º 5
0
void digi_init_sounds()
{
	int i;

	if (!digi_initialised) return;

	digi_reset_digi_sounds();

	for (i=0; i<MAX_SOUND_OBJECTS; i++ )	{
		if (digi_sounds_initialized) {
			if ( SoundObjects[i].flags & SOF_PLAYING )	{
				LOCK();
			        SoundSlots[SoundObjects[i].handle].playing=0;
				UNLOCK();
			}
		}
		SoundObjects[i].flags = 0;	// Mark as dead, so some other sound can use this sound
	}
	digi_sounds_initialized = 1;
}
Exemplo n.º 6
0
int digi_init()
{
	OSErr err;
//	CFILE *fp;
	int i;

	if (!use_sounds)
		return -1;
		
	num_sounds = (sizeof(sound_list) / sizeof(short)) - 1;
	
	i = MaxVoiceLoad();
	err = InitSoundMusicSystem(MAX_MUSIC_CHANNELS, 4 + (digi_max_channels/2), digi_max_channels, digi_sound_quality);
//	err = InitSoundMusicSystem(MAX_MUSIC_CHANNELS, 10, 16, digi_sound_quality);
	if (err != noErr)
		return -1;
	master_save = GetMasterVolume();
	if (master_save < 0)
		master_save = 0;
	else if ( master_save > 255 )
		master_save = 255;
		
#ifdef MAC_SHAREWARE
	PurgeSongs(1);
	LockSongs(0);
#else
	init_redbook();
#endif

 	digi_initialized = 1;
	
// set volumes and then out of here..

	digi_set_master_volume(Config_master_volume);
	digi_set_volume(digi_volume, midi_volume);
	digi_reset_digi_sounds();
	atexit(digi_close);

	return 0;
}