Example #1
0
void REGNRecord::REGNEntry::IsSound(bool value)
    {
    if(value)
        RDAT.value.entryType = eSound;
    else if(IsSound())
        RDAT.value.entryType = eObject;
    }
Example #2
0
void Audio::ResetSound(const int& sound_id) {
	
	assert(IsSound(sound_id));
	
	Mix_HaltChannel(sound_channels[sound_id]);
	sound_channels[sound_id] = -1;
}
void AudioDescriptor::_SetSourceProperties()
{
    if(_source == NULL) {
        IF_PRINT_WARNING(AUDIO_DEBUG) << "function was invoked when class did not have access to an audio source" << std::endl;
        return;
    }

    // Set volume (gain)
    float volume_multiplier = 0.0f;
    if(IsSound())
        volume_multiplier = AudioManager->GetSoundVolume();
    else
        volume_multiplier = AudioManager->GetMusicVolume();

    alSourcef(_source->source, AL_GAIN, _volume * volume_multiplier);
    if(AudioManager->CheckALError()) {
        IF_PRINT_WARNING(AUDIO_DEBUG) << "changing volume on a source failed: " << AudioManager->CreateALErrorString() << std::endl;
    }

    // Set looping (source has looping disabled by default, so only need to check the true case)
    if(_stream != NULL) {
        _stream->SetLooping(_looping);
    } else if(_source != NULL) {
        if(_looping) {
            alSourcei(_source->source, AL_LOOPING, AL_TRUE);
            if(AudioManager->CheckALError()) {
                IF_PRINT_WARNING(AUDIO_DEBUG) << "setting a source to loop failed: " << AudioManager->CreateALErrorString() << std::endl;
            }
        }
    }

    //! \todo More properties need to be set here, such as source position, etc.
}
Example #4
0
Audio::~Audio() {
	
	for (int sound_id = 0; sound_id < MAX_SOUND; sound_id++) {
		if (IsSound(sound_id)) {
			ResetSound(sound_id);
		}
	}
	
	for (int music_id = 0; music_id < MAX_MUSIC; music_id++) {
		if (IsMusic(music_id)) {
			ResetMusic(music_id);
		}
	}
}
Example #5
0
void Audio::PlaySound(const int& sound_id) {
	
	assert(IsSound(sound_id));
	
	sound_channels[sound_id] = Mix_PlayChannel(-1, sound_chunks[sound_id], 0);
}
Example #6
0
void Audio::ResumeSound(const int& sound_id) {
	
	assert(IsSound(sound_id));
	
	Mix_Resume(sound_channels[sound_id]);
}
Example #7
0
void Audio::PauseSound(const int& sound_id) {
	
	assert(IsSound(sound_id));
	
	Mix_Pause(sound_channels[sound_id]);
}
Example #8
0
void Audio::StopSound(const int& sound_id) {
	
	assert(IsSound(sound_id));
	
	ResetSound(sound_id);
}