Page MenuHomePhabricator (Chris)

sound.cpp
No OneTemporary

Authored By
Unknown
Size
987 B
Referenced Files
None
Subscribers
None

sound.cpp

#include <stdlib.h>
#include "r-tech1/sound/sound.h"
#ifdef USE_ALLEGRO5
#include "sound/allegro5/sound.cpp"
#endif
#include "r-tech1/configuration.h"
#include "r-tech1/file-system.h"
Sound::SoundInfo Sound::Info;
Sound::Sound( const Sound & copy ):
own( NULL ){
own = copy.own;
if ( own ){
*own += 1;
}
data = copy.data;
}
Sound::Sound(Storage::File & file):
own(NULL){
int length = file.getSize();
char * data = new char[length];
file.readLine(data, length);
try{
loadFromMemory(data, length);
delete[] data;
} catch (const LoadException & fail){
delete[] data;
throw;
}
}
Sound & Sound::operator=( const Sound & rhs ){
if ( own ){
destroy();
}
own = rhs.own;
if ( own ){
*own += 1;
}
data = rhs.data;
return *this;
}
double Sound::scale(double in){
return in * Configuration::getSoundVolume() / 100.0;
}
Sound::~Sound(){
destroy();
}

File Metadata

Mime Type
text/x-c
Expires
Sat, Nov 14, 11:01 PM (18 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
126680
Default Alt Text
sound.cpp (987 B)

Event Timeline