Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include "audiolib.h"
#include "hashtable.h"
#include "vsfilesystem.h"
#include <string>
#include "al_globals.h"
#include <stdio.h>
#include <stdlib.h>
#include "cmd/unit_generic.h"
#include "gfx/cockpit_generic.h"
#include <vector>
#include "vs_globals.h"
#include <algorithm>
Go to the source code of this file.
Macros | |
#define | AL_SEC_OFFSET 0x1024 |
Functions | |
bool | AUDLoadSoundFile (const char *s, struct AUDSoundProperties *info, bool use_fileptr) |
int | AUDBufferSound (const struct AUDSoundProperties *info, bool music) |
int | AUDCreateSoundWAV (const std::string &s, const bool music, const bool LOOP) |
int | AUDCreateSoundWAV (const std::string &s, const bool LOOP) |
creates a buffer if one doesn't already exists, and then creates a source More... | |
int | AUDCreateMusicWAV (const std::string &s, const bool LOOP) |
creates a buffer if one doesn't already exists, and then creates a source More... | |
int | AUDCreateSoundMP3 (const std::string &s, const bool music, const bool LOOP) |
int | AUDCreateSoundMP3 (const std::string &s, const bool LOOP) |
creates a buffer for an mp3 sound if one doesn't already exist, then creates a source More... | |
int | AUDCreateMusicMP3 (const std::string &s, const bool LOOP) |
creates a buffer for an mp3 sound if one doesn't already exist, then creates a source More... | |
int | AUDCreateSound (const std::string &s, const bool LOOP) |
guesses the type of sound by extension More... | |
int | AUDCreateMusic (const std::string &s, const bool LOOP) |
guesses the type of sound by extension More... | |
int | AUDCreateSound (int sound, const bool LOOP) |
copies other sound loaded through AUDCreateSound More... | |
void | AUDDeleteSound (int sound, bool music) |
deletes a given sound More... | |
void | AUDAdjustSound (const int sound, const QVector &pos, const Vector &vel) |
Changes the velocity and/or position of a given sound. More... | |
void | AUDStreamingSound (const int sound) |
Setup the sound as a streaming source (this means right now only that it doesn't do 3D positional stuff) More... | |
bool | starSystemOK () |
int | AUDHighestSoundPlaying () |
void | AUDStopAllSounds (int except_this_one) |
bool | AUDIsPlaying (const int sound) |
Is a loaded sound still playing. More... | |
void | AUDStopPlaying (const int sound) |
Stops a loaded sound. More... | |
static bool | AUDReclaimSource (const int sound, bool high_priority=false) |
void | AUDStartPlaying (const int sound) |
Plays a loaded sound. More... | |
void | AUDPlay (const int sound, const QVector &pos, const Vector &vel, const float gain) |
Queries if the sound should be culled. If not, plays. More... | |
float | AUDGetCurrentPosition (const int sound) |
Gets the current playback position in seconds (precision is system&driver-dependant) More... | |
void | AUDPausePlaying (const int sound) |
Pauses a loaded sound. More... | |
Variables | |
unsigned int | nil_wavebuf = 0 |
std::vector< int > | soundstodelete |
#define AL_SEC_OFFSET 0x1024 |
Definition at line 895 of file al_sound.cpp.
Referenced by AUDGetCurrentPosition(), Audio::OpenALRenderableSource::getPlayingTimeImpl(), Audio::OpenALRenderableStreamingSource::getPlayingTimeImpl(), and Audio::OpenALRenderableSource::seekImpl().
Changes the velocity and/or position of a given sound.
Definition at line 683 of file al_sound.cpp.
Referenced by AUDPlay(), AUDStartPlaying(), Beam::Draw(), GameUnit< UnitType >::Draw(), Mount::PhysicsAlignedFire(), soundContainer::playsound(), UniverseUtil::playSound(), GameUnit< UnitType >::ResolveForces(), Beam::UpdatePhysics(), and Unit::UpdatePhysics().
guesses the type of sound by extension
Definition at line 615 of file al_sound.cpp.
References AUDCreateMusicMP3(), and AUDCreateMusicWAV().
creates a buffer for an mp3 sound if one doesn't already exist, then creates a source
Definition at line 599 of file al_sound.cpp.
References AUDCreateSoundMP3().
Referenced by AUDCreateMusic().
creates a buffer if one doesn't already exists, and then creates a source
Definition at line 545 of file al_sound.cpp.
References AUDCreateSoundWAV().
Referenced by AUDCreateMusic().
guesses the type of sound by extension
Definition at line 604 of file al_sound.cpp.
Referenced by AddMounts(), AddSounds(), Beam::Beam(), GameStarSystem::DoJumpingLeaveSightAndSound(), Mount::PhysicsAlignedFire(), Mount::ReplaceSound(), GameUnit< UnitType >::Thrust(), and GameUnit< UnitType >::TransferUnitToSystem().
Definition at line 550 of file al_sound.cpp.
References VSFileSystem::VSFile::Close(), error, f, g_game, VSFileSystem::GetHashName(), VSFileSystem::GetSharedSoundHashName(), game_data_t::music_enabled, VSFileSystem::Ok, VSFileSystem::VSFile::OpenReadOnly(), VSFileSystem::VSFile::Read(), VSFileSystem::Shared, VSFileSystem::VSFile::Size(), game_data_t::sound_enabled, and VSFileSystem::SoundFile.
Referenced by AUDCreateMusicMP3(), AUDCreateSound(), AUDCreateSoundMP3(), and BeamXML::beginElement().
creates a buffer for an mp3 sound if one doesn't already exist, then creates a source
Definition at line 594 of file al_sound.cpp.
Definition at line 495 of file al_sound.cpp.
References AUDLoadSoundFile(), g_game, VSFileSystem::GetHashName(), VSFileSystem::GetSharedSoundHashName(), game_data_t::music_enabled, nil_wavebuf, and game_data_t::sound_enabled.
Referenced by abletodock(), AddSounds(), GameUnit< UnitType >::ArmorDamageSound(), AUDCreateMusicWAV(), AUDCreateSound(), AUDCreateSoundWAV(), BeamXML::beginElement(), BaseInterface::Room::Talk::Click(), Beam::Collide(), createSound(), GameUnit< UnitType >::DealDamageToShield(), GameUnit< UnitType >::HullDamageSound(), soundContainer::loadsound(), UniverseUtil::playSound(), UniverseUtil::playSoundCockpit(), GameCockpit::SetSoundFile(), and Unit::UpdatePhysics().
creates a buffer if one doesn't already exists, and then creates a source
Definition at line 540 of file al_sound.cpp.
deletes a given sound
Definition at line 639 of file al_sound.cpp.
Referenced by AUDDestroy(), AUDRefreshSounds(), Unit::ClearMounts(), BaseInterface::Room::Talk::Click(), Unit::Kill(), Music::Listen(), Mount::PhysicsAlignedFire(), UniverseUtil::playSound(), UniverseUtil::playSoundCockpit(), Beam::~Beam(), and soundContainer::~soundContainer().
Gets the current playback position in seconds (precision is system&driver-dependant)
Definition at line 898 of file al_sound.cpp.
References AL_SEC_OFFSET, and float.
int AUDHighestSoundPlaying | ( | ) |
Definition at line 738 of file al_sound.cpp.
References AUDIsPlaying().
Referenced by BaseInterface::BaseInterface().
Is a loaded sound still playing.
Definition at line 760 of file al_sound.cpp.
Referenced by GameUnit< UnitType >::ArmorDamageSound(), AUDCreateSound(), AUDDeleteSound(), AUDHighestSoundPlaying(), AUDPlay(), AUDRefreshSounds(), AUDStopAllSounds(), GameUnit< UnitType >::DealDamageToShield(), FireKeyboard::Execute(), GameUnit< UnitType >::HullDamageSound(), Music::Listen(), Mount::PhysicsAlignedFire(), Mount::PhysicsAlignedUnfire(), FireKeyboard::ProcessCommMessage(), FSM::Node::StopSound(), GameUnit< UnitType >::Thrust(), Beam::UpdatePhysics(), Unit::UpdatePhysics(), and UpdateTimeCompressionSounds().
Definition at line 409 of file al_sound.cpp.
References VSFileSystem::VSFile::Close(), error, f, fclose, fopen, VSFileSystem::GetHashName(), VSFileSystem::GetSharedSoundHashName(), VSFileSystem::Ok, VSFileSystem::VSFile::OpenReadOnly(), VSFileSystem::VSFile::Read(), VSFileSystem::Shared, VSFileSystem::VSFile::Size(), VSFileSystem::SoundFile, VSFileSystem::UnknownFile, and VSFileSystem::vs_dprintf().
Referenced by AUDCreateSoundWAV(), and Muzak::readerThread().
void AUDPausePlaying | ( | const int | sound) |
Pauses a loaded sound.
Definition at line 909 of file al_sound.cpp.
Queries if the sound should be culled. If not, plays.
Definition at line 862 of file al_sound.cpp.
Referenced by abletodock(), GameUnit< UnitType >::ArmorDamageSound(), Beam::Collide(), GameUnit< UnitType >::DealDamageToShield(), GameStarSystem::DoJumpingLeaveSightAndSound(), FireKeyboard::Execute(), GameUnit< UnitType >::Explode(), GameUnit< UnitType >::HullDamageSound(), Mount::PhysicsAlignedFire(), soundContainer::playsound(), FireKeyboard::ProcessCommMessage(), GameCockpit::ScrollVDU(), GameUnit< UnitType >::Thrust(), GameUnit< UnitType >::TransferUnitToSystem(), and GameCockpit::VDUSwitch().
Definition at line 796 of file al_sound.cpp.
References AUDDistanceSquared().
Referenced by AUDPlay(), and AUDStartPlaying().
void AUDStartPlaying | ( | const int | sound) |
Plays a loaded sound.
Definition at line 841 of file al_sound.cpp.
Referenced by BaseInterface::Room::Talk::Click(), Beam::Init(), Music::Listen(), UniverseUtil::playSound(), UniverseUtil::playSoundCockpit(), and Unit::UpdatePhysics().
void AUDStopAllSounds | ( | int | except_this_one) |
Definition at line 750 of file al_sound.cpp.
References AUDIsPlaying(), and AUDStopPlaying().
Referenced by BaseComputer::actionDone(), base_main_loop(), UniverseUtil::StopAllSounds(), and GameUnit< UnitType >::TransferUnitToSystem().
void AUDStopPlaying | ( | const int | sound) |
Stops a loaded sound.
Definition at line 779 of file al_sound.cpp.
Referenced by GameUnit< UnitType >::ArmorDamageSound(), AUDCreateSound(), AUDDeleteSound(), AUDDestroy(), AUDPlay(), AUDStopAllSounds(), GameUnit< UnitType >::DealDamageToShield(), DestroyMount(), GameUnit< UnitType >::HullDamageSound(), Unit::Kill(), Mount::PhysicsAlignedFire(), Mount::PhysicsAlignedUnfire(), FSM::Node::StopSound(), GameUnit< UnitType >::Thrust(), Beam::UpdatePhysics(), Unit::UpdatePhysics(), UpdateTimeCompressionSounds(), and soundContainer::~soundContainer().
void AUDStreamingSound | ( | const int | sound) |
Setup the sound as a streaming source (this means right now only that it doesn't do 3D positional stuff)
Definition at line 714 of file al_sound.cpp.
References Audio::alSource3f().
Referenced by Music::Listen().
bool starSystemOK | ( | ) |
Definition at line 727 of file al_sound.cpp.
References _Universe, Universe::AccessCockpit(), Universe::activeStarSystem(), Cockpit::GetParent(), and Unit::getStarSystem().
Referenced by AUDPlay(), and AUDStartPlaying().
unsigned int nil_wavebuf = 0 |
Definition at line 493 of file al_sound.cpp.
Referenced by AUDCreateSoundWAV().
std::vector< int > soundstodelete |
Definition at line 172 of file al_listen.cpp.
Referenced by AUDDeleteSound(), and AUDRefreshSounds().