Update of /cvsroot/alpp/openalpp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26590/src Modified Files: Makefile.am Makefile.in audiobase.cpp audioconvert.cpp audioenvironment.cpp error.cpp filestream.cpp filestreamupdater.cpp groupsource.cpp listener.cpp nofilestream.cpp noinputdevice.cpp nostreaming.cpp sample.cpp sounddata.cpp source.cpp sourcebase.cpp stream.cpp streamupdater.cpp Log Message: Changed from initial capital letter for methods. i.e. SetPosition() is now setPosition() to be more C++ compliant. Removed dependency of CommonC++ for threading. CHanged to OpenThreads which is GPL licensed. Removed tests for streaming over the net... (Due to Commonc++ removal) Index: Makefile.am =================================================================== RCS file: /cvsroot/alpp/openalpp/src/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.am 21 Feb 2003 14:47:15 -0000 1.5 --- Makefile.am 2 Mar 2004 07:50:27 -0000 1.6 *************** *** 15,21 **** if WITH_CCGNU streamfiles = \ - netstream.cpp \ streamupdater.cpp \ - netupdater.cpp \ stream.cpp if WITH_OGGVORBIS --- 15,19 ---- Index: Makefile.in =================================================================== RCS file: /cvsroot/alpp/openalpp/src/Makefile.in,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile.in 16 Apr 2003 11:15:03 -0000 1.8 --- Makefile.in 2 Mar 2004 07:50:27 -0000 1.9 *************** *** 1,5 **** ! # Makefile.in generated automatically by automake 1.4-p6 from Makefile.am ! # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, --- 1,7 ---- ! # Makefile.in generated by automake 1.7.2 from Makefile.am. ! # @configure_input@ ! # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 [...990 lines suppressed...] ! ps: ps-am ! ps-am: ! uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. Index: audiobase.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/audiobase.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** audiobase.cpp 16 Apr 2003 11:15:04 -0000 1.12 --- audiobase.cpp 2 Mar 2004 07:50:27 -0000 1.13 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 26,30 **** #include "openalpp/audiobase.h" #include "stdio.h" ! namespace openalpp { AudioBase::AudioBase(int frequency,int refresh,int synchronous) --- 25,29 ---- #include "openalpp/audiobase.h" #include "stdio.h" ! using namespace openalpp; AudioBase::AudioBase(int frequency,int refresh,int synchronous) *************** *** 112,114 **** #endif - } --- 111,112 ---- Index: audioconvert.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/audioconvert.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** audioconvert.cpp 28 Feb 2003 08:36:23 -0000 1.4 --- audioconvert.cpp 2 Mar 2004 07:50:27 -0000 1.5 *************** *** 10,14 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 10,13 ---- *************** *** 40,44 **** */ ! namespace openalpp { void *acLoadWAV(void *data, ALuint *size, void **udata, --- 39,43 ---- */ ! using namespace openalpp; void *acLoadWAV(void *data, ALuint *size, void **udata, *************** *** 94,98 **** } ! void *AudioConvert::Apply(void *data,ALenum format, unsigned int frequency,unsigned int &size) { if(format==format_ && frequency==frequency_) { --- 93,97 ---- } ! void *AudioConvert::apply(void *data,ALenum format, unsigned int frequency,unsigned int &size) { if(format==format_ && frequency==frequency_) { *************** *** 1429,1431 **** } - } --- 1428,1429 ---- Index: audioenvironment.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/audioenvironment.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** audioenvironment.cpp 21 Feb 2003 14:47:15 -0000 1.6 --- audioenvironment.cpp 2 Mar 2004 07:50:27 -0000 1.7 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 25,29 **** #include "openalpp/audioenvironment.h" ! namespace openalpp { AudioEnvironment::AudioEnvironment() throw (InitError): AudioBase() { --- 24,28 ---- #include "openalpp/audioenvironment.h" ! using namespace openalpp; AudioEnvironment::AudioEnvironment() throw (InitError): AudioBase() { *************** *** 39,43 **** } ! void AudioEnvironment::SetSoundSpeed(float speed) throw(ValueError,FatalError){ alDopplerVelocity(speed); ALenum error; --- 38,42 ---- } ! void AudioEnvironment::setSoundVelocity(float speed) throw(ValueError,FatalError){ alDopplerVelocity(speed); ALenum error; *************** *** 53,65 **** } ! float AudioEnvironment::GetSoundSpeed() throw (FatalError) { ALfloat speed; alGetFloatv(AL_DOPPLER_VELOCITY,&speed); if(alGetError()!=AL_FALSE) // This isn't strictly necessary... ! throw FatalError("Unknown error in AudioEnviroment::GetSoundSpeed()"); return speed; } ! void AudioEnvironment::SetDopplerFactor(float factor) throw (ValueError,FatalError) { alDopplerFactor(factor); --- 52,64 ---- } ! float AudioEnvironment::getSoundVelocity() throw (FatalError) { ALfloat speed; alGetFloatv(AL_DOPPLER_VELOCITY,&speed); if(alGetError()!=AL_FALSE) // This isn't strictly necessary... ! throw FatalError("Unknown error in AudioEnviroment::GetSoundVelocity()"); return speed; } ! void AudioEnvironment::setDopplerFactor(float factor) throw (ValueError,FatalError) { alDopplerFactor(factor); *************** *** 76,80 **** } ! float AudioEnvironment::GetDopplerFactor() throw (FatalError) { ALfloat(factor); alGetFloatv(AL_DOPPLER_FACTOR,&factor); --- 75,79 ---- } ! float AudioEnvironment::getDopplerFactor() throw (FatalError) { ALfloat(factor); alGetFloatv(AL_DOPPLER_FACTOR,&factor); *************** *** 84,88 **** } ! void AudioEnvironment::SetGain(float gain) { alListenerf(AL_GAIN,gain); ALenum error=alGetError(); --- 83,87 ---- } ! void AudioEnvironment::setGain(float gain) { alListenerf(AL_GAIN,gain); ALenum error=alGetError(); *************** *** 97,101 **** } ! float AudioEnvironment::GetGain() throw (FatalError) { ALfloat gain; alGetListenerf(AL_GAIN,&gain); --- 96,100 ---- } ! float AudioEnvironment::getGain() throw (FatalError) { ALfloat gain; alGetListenerf(AL_GAIN,&gain); *************** *** 105,109 **** } ! void AudioEnvironment::SetDistanceModel(DistanceModel model) throw (FatalError){ switch(model) { --- 104,108 ---- } ! void AudioEnvironment::setDistanceModel(DistanceModel model) throw (FatalError){ switch(model) { *************** *** 124,128 **** } ! DistanceModel AudioEnvironment::GetDistanceModel() throw (FatalError) { int almodel; alGetIntegerv(AL_DISTANCE_MODEL,&almodel); --- 123,127 ---- } ! DistanceModel AudioEnvironment::getDistanceModel() throw (FatalError) { int almodel; alGetIntegerv(AL_DISTANCE_MODEL,&almodel); *************** *** 144,148 **** void (*AudioBase::alReverbDelay)(ALuint sid, ALfloat param); ! void AudioEnvironment::InitiateReverb() throw (InitError) { if (reverbinitiated_) return; --- 143,147 ---- void (*AudioBase::alReverbDelay)(ALuint sid, ALfloat param); ! void AudioEnvironment::initiateReverb() throw (InitError) { if (reverbinitiated_) return; *************** *** 158,161 **** } - - } --- 157,158 ---- Index: error.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/error.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** error.cpp 4 Dec 2002 07:13:13 -0000 1.4 --- error.cpp 2 Mar 2004 07:50:27 -0000 1.5 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 25,38 **** #include "openalpp/error.h" ! namespace openalpp { //##ModelId=3BDD35A001D5 ! std::ostream &Error::Put(std::ostream &stream) const { return (stream << what()); } ! std::ostream &operator<<(std::ostream &stream,const Error &error) { ! return error.Put(stream); } - } --- 24,36 ---- #include "openalpp/error.h" ! using namespace openalpp; //##ModelId=3BDD35A001D5 ! std::ostream &openalpp::Error::put(std::ostream &stream) const { return (stream << what()); } ! std::ostream &openalpp::operator<<(std::ostream &stream,const Error &error) { ! return error.put(stream); } Index: filestream.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/filestream.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** filestream.cpp 23 May 2003 14:47:10 -0000 1.5 --- filestream.cpp 2 Mar 2004 07:50:27 -0000 1.6 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 32,36 **** #endif ! namespace openalpp { FileStream::FileStream(const char *filename,const int buffersize) --- 31,35 ---- #endif ! using namespace openalpp; FileStream::FileStream(const char *filename,const int buffersize) *************** *** 58,65 **** else format=AL_FORMAT_STEREO16; updater_=new FileStreamUpdater(oggfile, ! buffername_,buffer2_->GetName(), format,ogginfo->rate, ! buffersize*SampleSize(format)); } else { fclose(filehandle); --- 57,65 ---- else format=AL_FORMAT_STEREO16; + updater_=new FileStreamUpdater(oggfile, ! buffername_,buffer2_->getName(), format,ogginfo->rate, ! buffersize*sampleSize(format)); } else { fclose(filehandle); *************** *** 82,88 **** } ! void FileStream::SetLooping(bool loop) { ! ((FileStreamUpdater *)updater_)->SetLooping(loop); } - } --- 82,87 ---- } ! void FileStream::setLooping(bool loop) { ! ((FileStreamUpdater *)updater_)->setLooping(loop); } Index: filestreamupdater.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/filestreamupdater.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filestreamupdater.cpp 23 May 2003 14:49:07 -0000 1.3 --- filestreamupdater.cpp 2 Mar 2004 07:50:27 -0000 1.4 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 25,31 **** #include "openalpp/filestreamupdater.h" ! namespace openalpp { ! FileStreamUpdater::FileStreamUpdater(const OggVorbis_File &oggfile, const ALuint buffer1,ALuint buffer2, ALenum format,unsigned int frequency, --- 24,31 ---- #include "openalpp/filestreamupdater.h" ! using namespace openalpp; ! FileStreamUpdater::FileStreamUpdater( ! const OggVorbis_File &oggfile, const ALuint buffer1,ALuint buffer2, ALenum format,unsigned int frequency, *************** *** 45,51 **** ALshort *buffer=new ALshort[buffersize_/sizeof(ALshort)]; ! runmutex_.enterMutex(); while(!stoprunning_) { ! runmutex_.leaveMutex(); unsigned int count=0; --- 45,51 ---- ALshort *buffer=new ALshort[buffersize_/sizeof(ALshort)]; ! runmutex_.lock(); while(!stoprunning_) { ! runmutex_.unlock(); unsigned int count=0; *************** *** 54,66 **** unsigned int amt; do { ! amt=ov_read(oggfile_,&((char *)buffer)[count], buffersize_-count, 0,2,1,&stream); ! if(looping_ && amt==0) { ! if(!ov_seekable(oggfile_)) ! break; ! if(!ov_time_seek(oggfile_,0.0)) ! break; ! } } while(looping_ && amt==0); // We must break if: --- 54,66 ---- unsigned int amt; do { ! amt=ov_read(oggfile_,&((char *)buffer)[count], buffersize_-count, 0,2,1,&stream); ! if(looping_ && amt==0) { ! if(!ov_seekable(oggfile_)) ! break; ! if(!ov_time_seek(oggfile_,0.0)) ! break; ! } } while(looping_ && amt==0); // We must break if: *************** *** 69,89 **** // * We hit EOF and the file was looping, but we couldn't loop... if(amt<=0) ! break; count+=amt; } if(count) ! Update(buffer,count); ! runmutex_.enterMutex(); } ! runmutex_.leaveMutex(); delete []buffer; } ! void FileStreamUpdater::SetLooping(bool loop) { looping_=loop; } - - } --- 69,87 ---- // * We hit EOF and the file was looping, but we couldn't loop... if(amt<=0) ! break; count+=amt; } if(count) ! update(buffer,count); ! runmutex_.lock(); } ! runmutex_.unlock(); delete []buffer; } ! void FileStreamUpdater::setLooping(bool loop) { looping_=loop; } Index: groupsource.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/groupsource.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** groupsource.cpp 3 Dec 2003 08:39:09 -0000 1.7 --- groupsource.cpp 2 Mar 2004 07:50:27 -0000 1.8 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 25,30 **** #include "openalpp/groupsource.h" ! namespace openalpp { ! GroupSource::GroupSource(float x,float y,float z) throw (NameError) : SourceBase(x,y,z),mixed_(false) { --- 24,29 ---- #include "openalpp/groupsource.h" ! using namespace openalpp; ! GroupSource::GroupSource(float x,float y,float z) throw (NameError) : SourceBase(x,y,z),mixed_(false) { *************** *** 35,46 **** } ! void GroupSource::Play() throw (InitError,FileError) { try { if(!mixed_) ! MixSources(); } catch(InitError error) { throw InitError("Sources must be included before trying to play"); } ! SourceBase::Play(); } --- 34,45 ---- } ! void GroupSource::play() throw (InitError,FileError) { try { if(!mixed_) ! mixSources(); } catch(InitError error) { throw InitError("Sources must be included before trying to play"); } ! SourceBase::play(); } *************** *** 106,110 **** } ! ALfloat GroupSource::FilterDistance(ALuint source,Speaker speaker) { ALfloat gain,maxdist,refdist,rolloff,position[3],direction[3],orientation[6]; ALfloat iangle,oangle,ogain,dist,right[3]; --- 105,109 ---- } ! ALfloat GroupSource::filterDistance(ALuint source,Speaker speaker) { ALfloat gain,maxdist,refdist,rolloff,position[3],direction[3],orientation[6]; ALfloat iangle,oangle,ogain,dist,right[3]; *************** *** 244,248 **** } ! ALshort *GroupSource::FilterReverb(Source *source,ALshort *buffer, ALsizei &size,unsigned int frequency) { if(!reverbinitiated_) --- 243,247 ---- } ! ALshort *GroupSource::filterReverb(Source *source,ALshort *buffer, ALsizei &size,unsigned int frequency) { if(!reverbinitiated_) *************** *** 250,255 **** // out=in[i]+scale*in[i-delay] ALfloat delay,scale; ! delay=source->GetReverbDelay(); ! scale=source->GetReverbScale(); if(delay==0.0 || scale==0.0) return buffer; --- 249,254 ---- // out=in[i]+scale*in[i-delay] ALfloat delay,scale; ! delay=source->getReverbDelay(); ! scale=source->getReverbScale(); if(delay==0.0 || scale==0.0) return buffer; *************** *** 281,290 **** * Apply filters to source. */ ! ALshort *GroupSource::ApplyFilters(Source *source,ALshort *buffer, ALsizei &size,unsigned int frequency){ // Apply filters: doppler,pitch,{da,reverb,coning,minmax},listenergain // - * * * * * - ! ALuint sourcename=source->GetAlSource(); ALfloat pitch,lgain,rgain; --- 280,289 ---- * Apply filters to source. */ ! ALshort *GroupSource::applyFilters(Source *source,ALshort *buffer, ALsizei &size,unsigned int frequency){ // Apply filters: doppler,pitch,{da,reverb,coning,minmax},listenergain // - * * * * * - ! ALuint sourcename=source->getAlSource(); ALfloat pitch,lgain,rgain; *************** *** 327,333 **** } ! lgain=FilterDistance(sourcename,Left); ! rgain=FilterDistance(sourcename,Right); ! buffer=FilterReverb(source,buffer,size,frequency); ALfloat min,max; // minmax filter #ifndef WIN32 --- 326,332 ---- } ! lgain=filterDistance(sourcename,Left); ! rgain=filterDistance(sourcename,Right); ! buffer=filterReverb(source,buffer,size,frequency); ALfloat min,max; // minmax filter #ifndef WIN32 *************** *** 357,361 **** } ! void GroupSource::MixSources(unsigned int frequency) throw (InitError,FileError,FatalError,MemoryError,ValueError) { ALshort *loaddata=NULL,*data=NULL,*bdata=NULL; --- 356,360 ---- } ! void GroupSource::mixSources(unsigned int frequency) throw (InitError,FileError,FatalError,MemoryError,ValueError) { ALshort *loaddata=NULL,*data=NULL,*bdata=NULL; *************** *** 368,375 **** throw InitError("Sources must be included before trying to mix"); ! std::cerr << ((Sample &)sources_[0]->GetSound()).GetFileName().c_str() << "\n"; success= ! alutLoadWAV(((Sample &)sources_[0]->GetSound()).GetFileName().c_str(), (ALvoid **)&loaddata,&format,&loadsize,&bits,&freq); if(success==AL_FALSE || !loaddata) --- 367,374 ---- throw InitError("Sources must be included before trying to mix"); ! std::cerr << ((Sample &)sources_[0]->getSound()).getFileName() << "\n"; success= ! alutLoadWAV(((Sample &)sources_[0]->getSound()).getFileName().c_str(), (ALvoid **)&loaddata,&format,&loadsize,&bits,&freq); if(success==AL_FALSE || !loaddata) *************** *** 377,381 **** bsize=loadsize; ! bdata=(ALshort *)converter.Apply(loaddata,format, (unsigned int)freq,(unsigned int)bsize); --- 376,380 ---- bsize=loadsize; ! bdata=(ALshort *)converter.apply(loaddata,format, (unsigned int)freq,(unsigned int)bsize); *************** *** 385,393 **** free(loaddata); ! bdata=ApplyFilters(sources_[0],bdata,bsize,frequency); for(unsigned int s=1;s<sources_.size();s++) { success= ! alutLoadWAV(((Sample &)sources_[s]->GetSound()).GetFileName().c_str(), (ALvoid **)&loaddata,&format,&loadsize,&bits,&freq); if(success==AL_FALSE || !loaddata) --- 384,392 ---- free(loaddata); ! bdata=applyFilters(sources_[0],bdata,bsize,frequency); for(unsigned int s=1;s<sources_.size();s++) { success= ! alutLoadWAV(((Sample &)sources_[s]->getSound()).getFileName().c_str(), (ALvoid **)&loaddata,&format,&loadsize,&bits,&freq); if(success==AL_FALSE || !loaddata) *************** *** 395,399 **** size=loadsize; ! data=(ALshort *)converter.Apply(loaddata,format, (unsigned int)freq,(unsigned int)size); if(!data) --- 394,398 ---- size=loadsize; ! data=(ALshort *)converter.apply(loaddata,format, (unsigned int)freq,(unsigned int)size); if(!data) *************** *** 402,406 **** free(loaddata); ! data=ApplyFilters(sources_[s],data,size,frequency); if(size>bsize) { --- 401,405 ---- free(loaddata); ! data=applyFilters(sources_[s],data,size,frequency); if(size>bsize) { *************** *** 438,456 **** } ! ALuint GroupSource::IncludeSource(Source *source) throw (ValueError) { ! if(source->IsStreaming()) throw ValueError("Can't include streaming sources in group."); sources_.push_back(source); ! return source->GetAlSource(); } ! void GroupSource::ExcludeSource(const Source &source) throw (NameError) { ! ALuint sourcename=source.GetAlSource(); ! ExcludeSource(sourcename); } ! void GroupSource::ExcludeSource(ALuint sourcename) throw (NameError) { for(unsigned int i=0;i<sources_.size();i++) { ! if(sourcename==sources_[i]->GetAlSource()) { sources_[i]=sources_[sources_.size()-1]; sources_.pop_back(); --- 437,455 ---- } ! ALuint GroupSource::includeSource(Source *source) throw (ValueError) { ! if(source->isStreaming()) throw ValueError("Can't include streaming sources in group."); sources_.push_back(source); ! return source->getAlSource(); } ! void GroupSource::excludeSource(const Source &source) throw (NameError) { ! ALuint sourcename=source.getAlSource(); ! excludeSource(sourcename); } ! void GroupSource::excludeSource(ALuint sourcename) throw (NameError) { for(unsigned int i=0;i<sources_.size();i++) { ! if(sourcename==sources_[i]->getAlSource()) { sources_[i]=sources_[sources_.size()-1]; sources_.pop_back(); *************** *** 483,485 **** } ! } --- 482,484 ---- } ! Index: listener.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/listener.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** listener.cpp 18 Oct 2002 07:50:13 -0000 1.3 --- listener.cpp 2 Mar 2004 07:50:27 -0000 1.4 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 25,29 **** #include "openalpp/listener.h" ! namespace openalpp { Listener *Listener::selectedlistener_=NULL; --- 24,28 ---- #include "openalpp/listener.h" ! using namespace openalpp; Listener *Listener::selectedlistener_=NULL; *************** *** 32,55 **** * Internal function for initialisation. */ ! void Listener::Init(float x,float y,float z, float vx,float vy,float vz, float directionx, float directiony, float directionz, float upx, float upy, float upz) { ! SetPosition(x,y,z); ! SetVelocity(vx,vy,vz); ! SetOrientation(directionx,directiony,directionz, upx,upy,upz); if(!selectedlistener_) ! Select(); } Listener::Listener() : PositionedObject() { ! Init(0,0,0, 0,0,0, 0,0,-1, 0,1,0); } Listener::Listener(const Listener &listener) : PositionedObject() { ! listener.GetPosition(position_[0],position_[1],position_[2]); ! listener.GetVelocity(velocity_[0],velocity_[1],velocity_[2]); ! listener.GetOrientation(orientation_[0],orientation_[1],orientation_[2], orientation_[3],orientation_[4],orientation_[5]); } --- 31,54 ---- * Internal function for initialisation. */ ! void Listener::init(float x,float y,float z, float vx,float vy,float vz, float directionx, float directiony, float directionz, float upx, float upy, float upz) { ! setPosition(x,y,z); ! setVelocity(vx,vy,vz); ! setOrientation(directionx,directiony,directionz, upx,upy,upz); if(!selectedlistener_) ! select(); } Listener::Listener() : PositionedObject() { ! init(0,0,0, 0,0,0, 0,0,-1, 0,1,0); } Listener::Listener(const Listener &listener) : PositionedObject() { ! listener.getPosition(position_[0],position_[1],position_[2]); ! listener.getVelocity(velocity_[0],velocity_[1],velocity_[2]); ! listener.getOrientation(orientation_[0],orientation_[1],orientation_[2], orientation_[3],orientation_[4],orientation_[5]); } *************** *** 58,66 **** float directionx, float directiony, float directionz, float upx, float upy, float upz) : PositionedObject() { ! Init(x,y,z, 0,0,0, directionx,directiony,directionz, upx,upy,upz); } Listener::Listener(float x, float y, float z) : PositionedObject() { ! Init(x,y,z, 0,0,0, 0,0,-1, 0,1,0); } --- 57,67 ---- float directionx, float directiony, float directionz, float upx, float upy, float upz) : PositionedObject() { ! ! init(x,y,z, 0,0,0, directionx,directiony,directionz, upx,upy,upz); ! } Listener::Listener(float x, float y, float z) : PositionedObject() { ! init(x,y,z, 0,0,0, 0,0,-1, 0,1,0); } *************** *** 70,74 **** } ! void Listener::Select() { alListenerfv(AL_POSITION,position_); alListenerfv(AL_VELOCITY,velocity_); --- 71,75 ---- } ! void Listener::select() { alListenerfv(AL_POSITION,position_); alListenerfv(AL_VELOCITY,velocity_); *************** *** 77,85 **** } ! bool Listener::IsSelected() { return (selectedlistener_==this); } ! void Listener::SetOrientation(float directionx,float directiony, float directionz, float upx, float upy, float upz) { --- 78,86 ---- } ! bool Listener::isSelected() { return (selectedlistener_==this); } ! void Listener::setOrientation(float directionx,float directiony, float directionz, float upx, float upy, float upz) { *************** *** 90,98 **** orientation_[4]=upy; orientation_[5]=upz; ! if(IsSelected()) alListenerfv(AL_ORIENTATION,orientation_); } ! void Listener::GetOrientation(float &directionx,float &directiony, float &directionz, float &upx, float &upy, float &upz) const { --- 91,99 ---- orientation_[4]=upy; orientation_[5]=upz; ! if(isSelected()) alListenerfv(AL_ORIENTATION,orientation_); } ! void Listener::getOrientation(float &directionx,float &directiony, float &directionz, float &upx, float &upy, float &upz) const { *************** *** 107,113 **** Listener &Listener::operator=(const Listener &listener) { if(this!=&listener) { ! listener.GetPosition(position_[0],position_[1],position_[2]); ! listener.GetVelocity(velocity_[0],velocity_[1],velocity_[2]); ! listener.GetOrientation(orientation_[0],orientation_[1],orientation_[2], orientation_[3],orientation_[4],orientation_[5]); } --- 108,114 ---- Listener &Listener::operator=(const Listener &listener) { if(this!=&listener) { ! listener.getPosition(position_[0],position_[1],position_[2]); ! listener.getVelocity(velocity_[0],velocity_[1],velocity_[2]); ! listener.getOrientation(orientation_[0],orientation_[1],orientation_[2], orientation_[3],orientation_[4],orientation_[5]); } *************** *** 115,127 **** } ! void Listener::SetPosition(float x, float y, float z) { position_[0]=x; position_[1]=y; position_[2]=z; ! if(IsSelected()) alListenerfv(AL_POSITION,position_); } ! void Listener::GetPosition(float &x, float &y, float &z) const { x=position_[0]; y=position_[1]; --- 116,128 ---- } ! void Listener::setPosition(float x, float y, float z) { position_[0]=x; position_[1]=y; position_[2]=z; ! if(isSelected()) alListenerfv(AL_POSITION,position_); } ! void Listener::getPosition(float &x, float &y, float &z) const { x=position_[0]; y=position_[1]; *************** *** 129,141 **** } ! void Listener::SetVelocity(float vx, float vy, float vz) { velocity_[0]=vx; velocity_[1]=vy; velocity_[2]=vz; ! if(IsSelected()) alListenerfv(AL_VELOCITY,velocity_); } ! void Listener::GetVelocity(float &vx, float &vy, float &vz) const { vx=velocity_[0]; vy=velocity_[1]; --- 130,142 ---- } ! void Listener::setVelocity(float vx, float vy, float vz) { velocity_[0]=vx; velocity_[1]=vy; velocity_[2]=vz; ! if(isSelected()) alListenerfv(AL_VELOCITY,velocity_); } ! void Listener::getVelocity(float &vx, float &vy, float &vz) const { vx=velocity_[0]; vy=velocity_[1]; *************** *** 143,145 **** } - } --- 144,145 ---- Index: nofilestream.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/nofilestream.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nofilestream.cpp 23 May 2003 22:13:20 -0000 1.4 --- nofilestream.cpp 2 Mar 2004 07:50:27 -0000 1.5 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 43,47 **** } ! void FileStream::SetLooping(bool loop) { } --- 42,46 ---- } ! void FileStream::setLooping(bool) { } Index: noinputdevice.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/noinputdevice.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** noinputdevice.cpp 28 Feb 2003 08:36:23 -0000 1.3 --- noinputdevice.cpp 2 Mar 2004 07:50:27 -0000 1.4 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 30,44 **** int InputDevice::nobjects_=0; ! void InputDevice::Init() { throw InitError("No input device support compiled in."); } InputDevice::InputDevice() { ! Init(); } InputDevice::InputDevice(int /*device*/, unsigned int /*samplerate*/, unsigned int /*buffersize*/, SampleFormat /*format*/) { ! Init(); } --- 29,43 ---- int InputDevice::nobjects_=0; ! void InputDevice::init() { throw InitError("No input device support compiled in."); } InputDevice::InputDevice() { ! init(); } InputDevice::InputDevice(int /*device*/, unsigned int /*samplerate*/, unsigned int /*buffersize*/, SampleFormat /*format*/) { ! init(); } Index: nostreaming.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/nostreaming.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nostreaming.cpp 16 Apr 2003 11:15:06 -0000 1.2 --- nostreaming.cpp 2 Mar 2004 07:50:27 -0000 1.3 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 35,39 **** } ! Stream &Stream::operator=(const Stream &stream) { return *this; } --- 34,38 ---- } ! Stream &Stream::operator=(const Stream &) { return *this; } *************** *** 42,52 **** } ! void Stream::Record(ALuint sourcename) { } ! void Stream::Stop(ALuint sourcename) { } ! NetStream::NetStream(ost::UDPSocket *socket,ost::TCPStream *controlsocket) : Stream() { } --- 41,51 ---- } ! void Stream::record(ALuint) { } ! void Stream::stop(ALuint) { } ! /*NetStream::NetStream(ost::UDPSocket *socket,ost::TCPStream *controlsocket) : Stream() { } *************** *** 55,59 **** unsigned int frequency,unsigned int packetsize) : Stream() { ! } --- 54,58 ---- unsigned int frequency,unsigned int packetsize) : Stream() { ! }*/ *************** *** 64,68 **** } ! NetStream &NetStream::operator=(const NetStream &stream) { return *this; } --- 63,67 ---- } ! NetStream &NetStream::operator=(const NetStream&) { return *this; } Index: sample.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/sample.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sample.cpp 7 Mar 2003 20:28:06 -0000 1.6 --- sample.cpp 2 Mar 2004 07:50:27 -0000 1.7 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 26,32 **** #include <sstream> ! namespace openalpp { ! Sample::Sample(const char *filename) throw (FileError) : SoundData(),filename_(filename) { ALsizei size,bits,freq; --- 25,31 ---- #include <sstream> ! using namespace openalpp; ! Sample::Sample(const std::string& filename) throw (FileError) : SoundData(),filename_(filename) { ALsizei size,bits,freq; *************** *** 35,39 **** ALboolean success; ! success=alutLoadWAV(filename,&data,&format,&size,&bits,&freq); if(success==AL_TRUE && data ) { alBufferData(buffername_,format,data,size,freq); --- 34,38 ---- ALboolean success; ! success=alutLoadWAV(filename.c_str(),&data,&format,&size,&bits,&freq); if(success==AL_TRUE && data ) { alBufferData(buffername_,format,data,size,freq); *************** *** 52,56 **** } ! std::string Sample::GetFileName() const { return filename_; } --- 51,55 ---- } ! std::string Sample::getFileName() const { return filename_; } *************** *** 65,69 **** // A couple of utility functions. Might move them to their own file later... ! unsigned int SampleSize(SampleFormat format) { switch(format) { case(Mono8): --- 64,68 ---- // A couple of utility functions. Might move them to their own file later... ! unsigned int openalpp::sampleSize(SampleFormat format) { switch(format) { case(Mono8): *************** *** 82,86 **** } ! unsigned int SampleSize(ALenum format) { switch(format) { case(AL_FORMAT_MONO8): --- 81,85 ---- } ! unsigned int openalpp::sampleSize(ALenum format) { switch(format) { case(AL_FORMAT_MONO8): *************** *** 99,101 **** } - } --- 98,99 ---- Index: sounddata.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/sounddata.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sounddata.cpp 18 Oct 2002 07:50:14 -0000 1.3 --- sounddata.cpp 2 Mar 2004 07:50:27 -0000 1.4 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 25,29 **** #include "openalpp/sounddata.h" ! namespace openalpp { SoundData::SoundBuffer::SoundBuffer() throw (NameError) { --- 24,28 ---- #include "openalpp/sounddata.h" ! using namespace openalpp; SoundData::SoundBuffer::SoundBuffer() throw (NameError) { *************** *** 38,47 **** } ! SoundData::SoundBuffer *SoundData::SoundBuffer::Reference() { refcount_++; return this; } ! void SoundData::SoundBuffer::DeReference() throw (FatalError) { refcount_--; if(!refcount_) --- 37,46 ---- } ! SoundData::SoundBuffer *SoundData::SoundBuffer::reference() { refcount_++; return this; } ! void SoundData::SoundBuffer::deReference() throw (FatalError) { refcount_--; if(!refcount_) *************** *** 55,72 **** SoundData::SoundData() throw (NameError,InitError) : AudioBase() { buffer_=new SoundBuffer(); ! buffername_=buffer_->GetName(); } SoundData::SoundData(const SoundData &sounddata) : AudioBase(/*(const AudioBase &)sounddata*/) { ! buffer_=sounddata.buffer_->Reference(); ! buffername_=buffer_->GetName(); } SoundData::~SoundData() { ! buffer_->DeReference(); } ! ALuint SoundData::GetAlBuffer() const { return buffername_; } --- 54,71 ---- SoundData::SoundData() throw (NameError,InitError) : AudioBase() { buffer_=new SoundBuffer(); ! buffername_=buffer_->getName(); } SoundData::SoundData(const SoundData &sounddata) : AudioBase(/*(const AudioBase &)sounddata*/) { ! buffer_=sounddata.buffer_->reference(); ! buffername_=buffer_->getName(); } SoundData::~SoundData() { ! buffer_->deReference(); } ! ALuint SoundData::getAlBuffer() const { return buffername_; } *************** *** 74,83 **** SoundData &SoundData::operator=(const SoundData &sounddata) { if(this!=&sounddata) { ! buffer_->DeReference(); ! buffer_=sounddata.buffer_->Reference(); ! buffername_=buffer_->GetName(); } return *this; } - } --- 73,81 ---- SoundData &SoundData::operator=(const SoundData &sounddata) { if(this!=&sounddata) { ! buffer_->deReference(); ! buffer_=sounddata.buffer_->reference(); ! buffername_=buffer_->getName(); } return *this; } Index: source.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/source.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** source.cpp 19 Feb 2003 18:35:13 -0000 1.8 --- source.cpp 2 Mar 2004 07:50:27 -0000 1.9 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 25,29 **** #include "openalpp/source.h" ! namespace openalpp { Source::Source(float x, float y, float z) : SourceBase(x,y,z) { --- 24,28 ---- #include "openalpp/source.h" ! using namespace openalpp; Source::Source(float x, float y, float z) : SourceBase(x,y,z) { *************** *** 36,40 **** streaming_=false; sounddata_=new Sample(filename); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->GetAlBuffer()); } --- 35,39 ---- streaming_=false; sounddata_=new Sample(filename); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->getAlBuffer()); } *************** *** 43,50 **** streaming_=false; sounddata_=new Sample(buffer); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->GetAlBuffer()); } ! Source::Source(const Stream &stream,float x,float y,float z) : SourceBase(x,y,z) { streaming_=true; --- 42,50 ---- streaming_=false; sounddata_=new Sample(buffer); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->getAlBuffer()); } ! ! Source::Source(const Stream &stream,float x,float y,float z) : SourceBase(x,y,z) { streaming_=true; *************** *** 56,67 **** streaming_=source.streaming_; if(streaming_) ! sounddata_=new Stream((const Stream &)source.GetSound()); else ! sounddata_=new Sample((const Sample &)source.GetSound()); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->GetAlBuffer()); } Source::~Source() { ! Stop(); if (sounddata_) delete sounddata_; --- 56,67 ---- streaming_=source.streaming_; if(streaming_) ! sounddata_=new Stream((const Stream &)source.getSound()); else ! sounddata_=new Sample((const Sample &)source.getSound()); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->getAlBuffer()); } Source::~Source() { ! stop(); if (sounddata_) delete sounddata_; *************** *** 72,92 **** // TODO: Add flag for wether the sound should be loaded. This is useful for // dummy sources that will be used only for groupsources. ! void Source::SetSound(const char *filename) { streaming_=false; if (sounddata_) delete sounddata_; sounddata_=new Sample(filename); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->GetAlBuffer()); } ! void Source::SetSound(const Sample &buffer) { streaming_=false; if (sounddata_) delete sounddata_; sounddata_=new Sample(buffer); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->GetAlBuffer()); } ! void Source::SetSound(const Stream &stream) { streaming_=true; if (sounddata_) --- 72,92 ---- // TODO: Add flag for wether the sound should be loaded. This is useful for // dummy sources that will be used only for groupsources. ! void Source::setSound(const std::string& filename) { streaming_=false; if (sounddata_) delete sounddata_; sounddata_=new Sample(filename); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->getAlBuffer()); } ! void Source::setSound(const Sample &buffer) { streaming_=false; if (sounddata_) delete sounddata_; sounddata_=new Sample(buffer); ! alSourcei(sourcename_,AL_BUFFER,sounddata_->getAlBuffer()); } ! void Source::setSound(const Stream &stream) { streaming_=true; if (sounddata_) *************** *** 95,139 **** } ! const SoundData &Source::GetSound() const { return *sounddata_; } ! void Source::Play(const char *filename) { ! SetSound(filename); ! SourceBase::Play(); } ! void Source::Play(const Sample &buffer) { ! SetSound(buffer); ! SourceBase::Play(); } ! void Source::Play(const Stream &stream) { alSourcei(sourcename_,AL_LOOPING,AL_FALSE); //Streaming sources can't loop... ! SetSound(stream); ! ((Stream *)sounddata_)->Record(sourcename_); ! SourceBase::Play(); } ! void Source::Play() { if(streaming_) { alSourcei(sourcename_,AL_LOOPING,AL_FALSE); //Streaming sources can't loop... ! ((Stream *)sounddata_)->Record(sourcename_); } ! SourceBase::Play(); } ! void Source::Stop() { if(streaming_) ! ((Stream *)sounddata_)->Stop(sourcename_); ! SourceBase::Stop(); } ! void Source::Pause() { ! SourceBase::Pause(); } ! bool Source::IsStreaming() { return streaming_; } --- 95,139 ---- } ! const SoundData &Source::getSound() const { return *sounddata_; } ! void Source::play(const std::string& filename) { ! setSound(filename.c_str()); ! SourceBase::play(); } ! void Source::play(const Sample &buffer) { ! setSound(buffer); ! SourceBase::play(); } ! void Source::play(const Stream &stream) { alSourcei(sourcename_,AL_LOOPING,AL_FALSE); //Streaming sources can't loop... ! setSound(stream); ! ((Stream *)sounddata_)->record(sourcename_); ! SourceBase::play(); } ! void Source::play() { if(streaming_) { alSourcei(sourcename_,AL_LOOPING,AL_FALSE); //Streaming sources can't loop... ! ((Stream *)sounddata_)->record(sourcename_); } ! SourceBase::play(); } ! void Source::stop() { if(streaming_) ! ((Stream *)sounddata_)->stop(sourcename_); ! SourceBase::stop(); } ! void Source::pause() { ! SourceBase::pause(); } ! bool Source::isStreaming() { return streaming_; } *************** *** 153,155 **** } - } --- 153,154 ---- Index: sourcebase.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/sourcebase.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sourcebase.cpp 23 May 2003 14:20:33 -0000 1.7 --- sourcebase.cpp 2 Mar 2004 07:50:27 -0000 1.8 *************** *** 6,10 **** * OpenAL (http://www.openal.org), * PortAudio (http://www.portaudio.com/), and - * CommonC++ (http://cplusplus.sourceforge.net/) * * This library is free software; you can redistribute it and/or --- 6,9 ---- *************** *** 30,44 **** */ ! namespace openalpp { ! void SourceBase::Init() throw (MemoryError,NameError) { alGenSources(1,&sourcename_); if(alGetError()!=AL_FALSE) throw NameError("Couldn't generate source name"); nlinkedsources_=1; alloclinkedsources_=2; ! linkedsources_=(ALuint *)malloc(sizeof(ALuint)*alloclinkedsources_); if(!linkedsources_) ! throw MemoryError("malloc failed"); linkedsources_[0]=sourcename_; reverbscale_=0.25; --- 29,46 ---- */ ! using namespace openalpp; ! void SourceBase::init() throw (MemoryError,NameError) { alGenSources(1,&sourcename_); if(alGetError()!=AL_FALSE) throw NameError("Couldn't generate source name"); + nlinkedsources_=1; alloclinkedsources_=2; ! //linkedsources_=(ALuint *)malloc(sizeof(ALuint)*alloclinkedsources_); ! linkedsources_ = new ALuint[alloclinkedsources_]; ! if(!linkedsources_) ! throw MemoryError("new failed"); linkedsources_[0]=sourcename_; reverbscale_=0.25; *************** *** 48,52 **** SourceBase::SourceBase() throw (MemoryError,NameError) : PositionedObject() { ! Init(); } --- 50,54 ---- SourceBase::SourceBase() throw (MemoryError,NameError) : PositionedObject() { ! init(); } *************** *** 54,128 **** throw (MemoryError,NameError) : PositionedObject() { ! Init(); ! SetPosition(x,y,z); } SourceBase::~SourceBase() { ! Stop(); alDeleteSources(1,&sourcename_); ! free(linkedsources_); } SourceBase::SourceBase(const SourceBase &sourcebase) : PositionedObject(sourcebase) { ! float a,b,c; ! sourcebase.GetPosition(a,b,c); ! SetPosition(a,b,c); ! sourcebase.GetVelocity(a,b,c); ! SetVelocity(a,b,c); ! SetPitch(sourcebase.GetPitch()); ! sourcebase.GetDirection(a,b,c); ! SetDirection(a,b,c); ! sourcebase.GetSoundCone(a,b,c); ! SetSoundCone(a,b,c); ! sourcebase.GetMinMaxGain(a,b); ! SetMinMaxGain(a,b); ! SetReferenceDistance(sourcebase.GetReferenceDistance()); ! SetRolloffFactor(sourcebase.GetRolloffFactor()); ! SetMaxDistance(sourcebase.GetMaxDistance()); ! SetLooping(sourcebase.IsLooping()); ! SetGain(sourcebase.GetGain()); } SourceBase &SourceBase::operator=(const SourceBase &sourcebase) { ! if(this!=&sourcebase) { ! float a,b,c; ! sourcebase.GetPosition(a,b,c); ! SetPosition(a,b,c); ! sourcebase.GetVelocity(a,b,c); ! SetVelocity(a,b,c); ! SetPitch(sourcebase.GetPitch()); ! sourcebase.GetDirection(a,b,c); ! SetDirection(a,b,c); ! sourcebase.GetSoundCone(a,b,c); ! SetSoundCone(a,b,c); ! sourcebase.GetMinMaxGain(a,b); ! SetMinMaxGain(a,b); ! SetReferenceDistance(sourcebase.GetReferenceDistance()); ! SetRolloffFactor(sourcebase.GetRolloffFactor()); ! SetMaxDistance(sourcebase.GetMaxDistance()); ! SetLooping(sourcebase.IsLooping()); ! SetGain(sourcebase.GetGain()); ! } return *this; } ! void SourceBase::Play() { alSourcePlayv(nlinkedsources_,linkedsources_); } ! void SourceBase::Pause() { alSourcePausev(nlinkedsources_,linkedsources_); } ! void SourceBase::Stop() { alSourceStopv(nlinkedsources_,linkedsources_); } ! void SourceBase::Rewind() { alSourceRewindv(nlinkedsources_,linkedsources_); } ! SourceState SourceBase::GetState() const { ALint state; alGetSourceiv(sourcename_,AL_SOURCE_STATE,&state); --- 56,140 ---- throw (MemoryError,NameError) : PositionedObject() { ! init(); ! setPosition(x,y,z); } SourceBase::~SourceBase() { ! stop(); alDeleteSources(1,&sourcename_); ! //free(linkedsources_); ! delete [] linkedsources_; } SourceBase::SourceBase(const SourceBase &sourcebase) : PositionedObject(sourcebase) { ! ! if(this==&sourcebase) ! return; ! ! *this = sourcebase; ! ! ! /* float a,b,c; ! sourcebase.getPosition(a,b,c); ! setPosition(a,b,c); ! sourcebase.getVelocity(a,b,c); ! setVelocity(a,b,c); ! setPitch(sourcebase.getPitch()); ! sourcebase.getDirection(a,b,c); ! setDirection(a,b,c); ! sourcebase.getSoundCone(a,b,c); ! setSoundCone(a,b,c); ! sourcebase.getMinMaxGain(a,b); ! setMinMaxGain(a,b); ! setReferenceDistance(sourcebase.getReferenceDistance()); ! setRolloffFactor(sourcebase.getRolloffFactor()); ! setMaxDistance(sourcebase.getMaxDistance()); ! setLooping(sourcebase.isLooping()); ! setGain(sourcebase.getGain());*/ } SourceBase &SourceBase::operator=(const SourceBase &sourcebase) { ! if(this==&sourcebase) ! return *this; ! ! float a,b,c; ! sourcebase.getPosition(a,b,c); ! setPosition(a,b,c); ! sourcebase.getVelocity(a,b,c); ! setVelocity(a,b,c); ! setPitch(sourcebase.getPitch()); ! sourcebase.getDirection(a,b,c); ! setDirection(a,b,c); ! sourcebase.getSoundCone(a,b,c); ! setSoundCone(a,b,c); ! sourcebase.getMinMaxGain(a,b); ! setMinMaxGain(a,b); ! setReferenceDistance(sourcebase.getReferenceDistance()); ! setRolloffFactor(sourcebase.getRolloffFactor()); ! setMaxDistance(sourcebase.getMaxDistance()); ! setLooping(sourcebase.isLooping()); ! setGain(sourcebase.getGain()); ! return *this; } ! void SourceBase::play() { alSourcePlayv(nlinkedsources_,linkedsources_); } ! void SourceBase::pause() { alSourcePausev(nlinkedsources_,linkedsources_); } ! void SourceBase::stop() { alSourceStopv(nlinkedsources_,linkedsources_); } ! void SourceBase::rewind() { alSourceRewindv(nlinkedsources_,linkedsources_); } ! SourceState SourceBase::getState() const { ALint state; alGetSourceiv(sourcename_,AL_SOURCE_STATE,&state); *************** *** 141,145 **** } ! void SourceBase::SetLooping(bool loop) { if(loop && !streaming_) alSourcei(sourcename_,AL_LOOPING,AL_TRUE); --- 153,157 ---- } ! void SourceBase::setLooping(bool loop) { if(loop && !streaming_) alSourcei(sourcename_,AL_LOOPING,AL_TRUE); *************** *** 148,152 **** } ! bool SourceBase::IsLooping() const { ALint looping; alGetSourceiv(sourcename_,AL_LOOPING,&looping); --- 160,164 ---- } ! bool SourceBase::isLooping() const { ALint looping; alGetSourceiv(sourcename_,AL_LOOPING,&looping); *************** *** 154,162 **** } ! void SourceBase::SetDirection(float directionx, float directiony, float directionz) { alSource3f(sourcename_,AL_DIRECTION,directionx,directiony,directionz); } ! void SourceBase::GetDirection(float &directionx, float &directiony, float &directionz) const { ALfloat direction[3]; alGetSourcefv(sourcename_,AL_DIRECTION,direction); --- 166,174 ---- } ! void SourceBase::setDirection(float directionx, float directiony, float directionz) { alSource3f(sourcename_,AL_DIRECTION,directionx,directiony,directionz); } ! void SourceBase::getDirection(float &directionx, float &directiony, float &directionz) const { ALfloat direction[3]; alGetSourcefv(sourcename_,AL_DIRECTION,direction); *************** *** 166,174 **** } ! void SourceBase::MakeOmniDirectional() { alSource3f(sourcename_,AL_DIRECTION,0.0,0.0,0.0); } ! void SourceBase::SetSoundCone(float innerangle, float outerangle, float outergain) { alSourcef(sourcename_,AL_CONE_INNER_ANGLE,innerangle); alSourcef(sourcename_,AL_CONE_OUTER_ANGLE,outerangle); --- 178,186 ---- } ! void SourceBase::makeOmniDirectional() { alSource3f(sourcename_,AL_DIRECTION,0.0,0.0,0.0); } ! void SourceBase::setSoundCone(float innerangle, float outerangle, float outergain) { alSourcef(sourcename_,AL_CONE_INNER_ANGLE,innerangle); alSourcef(sourcename_,AL_CONE_OUTER_ANGLE,outerangle); *************** *** 176,180 **** } ! void SourceBase::GetSoundCone(float &innerangle, float &outerangle, float &outergain) const { alGetSourcefv(sourcename_,AL_CONE_INNER_ANGLE,&innerangle); alGetSourcefv(sourcename_,AL_CONE_OUTER_ANGLE,&outerangle); --- 188,192 ---- } ! void SourceBase::getSoundCone(float &innerangle, float &outerangle, float &outergain) const { alGetSourcefv(sourcename_,AL_CONE_INNER_ANGLE,&innerangle); alGetSourcefv(sourcename_,AL_CONE_OUTER_ANGLE,&outerangle); *************** *** 182,186 **** } ! void SourceBase::SetGain(float gain) { alSourcef(sourcename_,AL_GAIN,gain); ALenum error=alGetError(); --- 194,198 ---- } ! void SourceBase::setGain(float gain) { alSourcef(sourcename_,AL_GAIN,gain); ALenum error=alGetError(); *************** *** 195,199 **** } ! float SourceBase::GetGain() const { ALfloat gain; alGetSourcefv(sourcename_,AL_GAIN,&gain); --- 207,211 ---- } ! float SourceBase::getGain() const { ALfloat gain; alGetSourcefv(sourcename_,AL_GAIN,&gain); *************** *** 201,205 **** } ! void SourceBase::SetMinMaxGain(float min, float max) { alSourcef(sourcename_,AL_MIN_GAIN,min); alSourcef(sourcename_,AL_MAX_GAIN,max); --- 213,217 ---- } ! void SourceBase::setMinMaxGain(float min, float max) { alSourcef(sourcename_,AL_MIN_GAIN,min); alSourcef(sourcename_,AL_MAX_GAIN,max); *************** *** 215,224 **** } ! void SourceBase::GetMinMaxGain(float & min, float &max) const { alGetSourcefv(sourcename_,AL_MIN_GAIN,&min); alGetSourcefv(sourcename_,AL_MAX_GAIN,&max); } ! void SourceBase::SetAmbient(bool ambient) { if(ambient) { alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_TRUE); --- 227,236 ---- } ! void SourceBase::getMinMaxGain(float & min, float &max) const { alGetSourcefv(sourcename_,AL_MIN_GAIN,&min); alGetSourcefv(sourcename_,AL_MAX_GAIN,&max); } ! void SourceBase::setAmbient(bool ambient) { if(ambient) { alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_TRUE); *************** *** 226,230 **** // TODO: if AL_ROLLOFF_FACTOR doesn't work; set // AL_MAX_GAIN=AL_MIN_GAIN=AL_GAIN for this source.. ! MakeOmniDirectional(); } else { alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_FALSE); --- 238,242 ---- // TODO: if AL_ROLLOFF_FACTOR doesn't work; set // AL_MAX_GAIN=AL_MIN_GAIN=AL_GAIN for this source.. ! makeOmniDirectional(); } else { alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_FALSE); *************** *** 235,239 **** } ! bool SourceBase::IsAmbient() const { ALint relative; alGetSourceiv(sourcename_,AL_SOURCE_RELATIVE,&relative); --- 247,251 ---- } ! bool SourceBase::isAmbient() const { ALint relative; alGetSourceiv(sourcename_,AL_SOURCE_RELATIVE,&relative); *************** *** 243,247 **** } ! void SourceBase::SetRelative(bool relative) { if(relative) alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_TRUE); --- 255,259 ---- } ! void SourceBase::setRelative(bool relative) { if(relative) alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_TRUE); *************** *** 250,254 **** } ! bool SourceBase::IsRelative() const { ALint relative; alGetSourceiv(sourcename_,AL_SOURCE_RELATIVE,&relative); --- 262,266 ---- } ! bool SourceBase::isRelative() const { ALint relative; alGetSourceiv(sourcename_,AL_SOURCE_RELATIVE,&relative); *************** *** 256,260 **** } ! void SourceBase::SetReferenceDistance(float distance) { alSourcef(sourcename_,AL_REFERENCE_DISTANCE,distance); if(alGetError()!=AL_FALSE) --- 268,272 ---- } ! void SourceBase::setReferenceDistance(float distance) { alSourcef(sourcename_,AL_REFERENCE_DISTANCE,distance); if(alGetError()!=AL_FALSE) *************** *** 262,266 **** } ! float SourceBase::GetReferenceDistance() const { ALfloat ref; alGetSourcefv(sourcename_,AL_REFERENCE_DISTANCE,&ref); --- 274,278 ---- } ! float SourceBase::getReferenceDistance() const { ALfloat ref; alGetSourcefv(sourcename_,AL_REFERENCE_DISTANCE,&ref); *************** *** 268,272 **** } ! void SourceBase::SetMaxDistance(float distance) { alSourcef(sourcename_,AL_MAX_DISTANCE,distance); if(alGetError()!=AL_FALSE) --- 280,284 ---- } ! void SourceBase::setMaxDistance(float distance) { alSourcef(sourcename_,AL_MAX_DISTANCE,distance); if(alGetError()!=AL_FALSE) *************** *** 274,278 **** } ! float SourceBase::GetMaxDistance() const { ALfloat maxdistance; alGetSourcefv(sourcename_,AL_MAX_DISTANCE,&maxdistance); --- 286,290 ---- } ! float SourceBase::getMaxDistance() const { ALfloat maxdistance; alGetSourcefv(sourcename_,AL_MAX_DISTANCE,&maxdistance); *************** *** 280,284 **** } ! void SourceBase::SetRolloffFactor(float factor) { alSourcef(sourcename_,AL_ROLLOFF_FACTOR,factor); if(alGetError()!=AL_FALSE) --- 292,296 ---- } ! void SourceBase::setRolloffFactor(float factor) { alSourcef(sourcename_,AL_ROLLOFF_FACTOR,factor); if(alGetError()!=AL_FALSE) *************** *** 286,290 **** } ! float SourceBase::GetRolloffFactor() const { ALfloat factor; alGetSourcefv(sourcename_,AL_ROLLOFF_FACTOR,&factor); --- 298,302 ---- } ! float SourceBase::getRolloffFactor() const { ALfloat factor; alGetSourcefv(sourcename_,AL_ROLLOFF_FACTOR,&factor); *************** *** 292,296 **** } ! void SourceBase::SetPitch(float pitch) { alSourcef(sourcename_,AL_PITCH,pitch); ALenum error=alGetError(); --- 304,308 ---- } ! void SourceBase::setPitch(float pitch) { alSourcef(sourcename_,AL_PITCH,pitch); ALenum error=alGetError(); *************** *** 305,309 **** } ! float SourceBase::GetPitch() const { ALfloat pitch; alGetSourcefv(sourcename_,AL_PITCH,&pitch); --- 317,321 ---- } ! float SourceBase::getPitch() const { ALfloat pitch; alGetSourcefv(sourcename_,AL_PITCH,&pitch); *************** *** 311,315 **** } ! void SourceBase::SetReverbScale(float scale) throw (InitError,ValueError) { if(reverbinitiated_) { alReverbScale(sourcename_,scale); --- 323,327 ---- } ! void SourceBase::setReverbScale(float scale) throw (InitError,ValueError) { if(reverbinitiated_) { alReverbScale(sourcename_,scale); *************** *** 321,325 **** } ! void SourceBase::SetReverbDelay(float delay) throw (InitError,ValueError) { if(reverbinitiated_) { alReverbDelay(sourcename_,delay); --- 333,337 ---- } ! void SourceBase::setReverbDelay(float delay) throw (InitError,ValueError) { if(reverbinitiated_) { alReverbDelay(sourcename_,delay); *************** *** 331,335 **** } ! float SourceBase::GetReverbScale() throw (InitError) { if(!reverbinitiated_) throw InitError("Reverb not init... [truncated message content] |