[Gcblue-commits] gcb_wx/include/common simmath.h,1.25,1.26 tcOggStreamer.h,1.7,1.8
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:20:13
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465/include/common Modified Files: simmath.h tcOggStreamer.h Log Message: More OpenAL++ changes and ai improvements Index: tcOggStreamer.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOggStreamer.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcOggStreamer.h 5 Dec 2004 02:49:45 -0000 1.7 --- tcOggStreamer.h 24 Feb 2005 22:19:13 -0000 1.8 *************** *** 1,6 **** ! /* ! ** tcOggStreamer.h ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcOggStreamer.h ! */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 27,45 **** #define _OGGSTREAMER_H_ #include <string> #include <iostream> - #include <AL/al.h> - #include <vorbis/vorbisfile.h> - - - - //#define BUFFER_SIZE (4096 * 4) - /** ! * Based on ogg_stream class from DevMaster.net ogg OpenAL tutorial ! * http://www.devmaster.net/articles/openal-tutorials/lesson8.php by ! * Jesse Maurais */ class tcOggStreamer --- 27,38 ---- #define _OGGSTREAMER_H_ + #include <openalpp/alpp.h> #include <string> #include <iostream> /** ! * Ogg streaming using OpenAL++ Stream ! * Stream is threaded */ class tcOggStreamer *************** *** 50,99 **** NUM_BUFFERS = 8 }; ! public: ! void Display(); ! bool GetPause() const {return paused;} ! void Init(); ! bool IsPaused(); ! bool IsPlaying(); ! bool IsSongQueued() {return queuedSong.size() > 1;} ! bool IsStopped(); ! float GetVolume() {return volume;} ! void Open(std::string path); ! bool Play(); ! void Queue(std::string path); ! void Release(); ! void Seek(double seekTime); ! void SetPause(bool state) {paused = state;} ! void SetVolume(float vol); ! void Stop(); ! bool Update(); ! tcOggStreamer(); ! ~tcOggStreamer(); ! ! protected: ! void Check(); ! void Empty(); ! std::string ErrorString(int code); ! ! bool Stream(ALuint buffer); ! private: ! FILE* oggFile; ! OggVorbis_File oggStream; ! vorbis_info* vorbisInfo; ! vorbis_comment* vorbisComment; ! float volume; ///< linear gain for source, 0.5f = -6 dB ! ! // when bufferFreeIndex == bufferBusyIndex, no buffers are available ! int bufferIndex; ///< index of next buffer to use (when free) ! int nFreeBuffers; ///< number of free buffers ! ALuint buffers[8]; ! ALuint source; ! ALenum format; ! char streamBuffer[BUFFER_SIZE]; ! std::string queuedSong; ///< complete file path of song to queue ! bool paused; }; --- 43,72 ---- NUM_BUFFERS = 8 }; ! public: ! void Display(); ! bool GetPause() const {return paused;} ! bool IsPaused(); ! bool IsPlaying(); ! bool IsSongQueued() {return queuedSong.size() > 1;} ! bool IsStopped(); ! float GetVolume() const {return volume;} ! void Open(std::string path); ! bool Play(); ! void Queue(std::string path); ! void Seek(double seekTime); ! void SetPause(bool state) {paused = state;} ! void SetVolume(float vol); ! void Stop(); ! tcOggStreamer(); ! ~tcOggStreamer(); ! private: ! openalpp::ref_ptr<openalpp::FileStream> stream; ! openalpp::ref_ptr<openalpp::Source> source; ! float volume; ///< linear gain for source, 0.5f = -6 dB ! std::string queuedSong; ///< complete file path of song to queue ! bool paused; }; Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** simmath.h 14 Nov 2004 22:52:19 -0000 1.25 --- simmath.h 24 Feb 2005 22:19:13 -0000 1.26 *************** *** 143,148 **** }; ! struct tsGeoPoint { float mfLon_rad; float mfLat_rad; --- 143,149 ---- }; ! class GeoPoint { + public: float mfLon_rad; float mfLat_rad; *************** *** 183,188 **** void PredictPosition(float dt_s, double& lon_rad, double& lat_rad, float& alt_m); float HeadingToTrack(const tcTrack& track); ! float HeadingToGeoRad(const tsGeoPoint *apGeoPoint); ! float RangeToKm(const tsGeoPoint *apGeoPoint); float RangeToKm(tcKinematics& k); float RangeToKm(const tcTrack& track); --- 184,189 ---- void PredictPosition(float dt_s, double& lon_rad, double& lat_rad, float& alt_m); float HeadingToTrack(const tcTrack& track); ! float HeadingToGeoRad(const GeoPoint *apGeoPoint); ! float RangeToKm(const GeoPoint *apGeoPoint); float RangeToKm(tcKinematics& k); float RangeToKm(const tcTrack& track); *************** *** 195,199 **** float& rfClimbAngle_rad, float& rfTimeToIntercept, float& rfRange_rad); void Serialize(tcFile& file, bool abLoad); ! void SetRelativeGeo(tsGeoPoint& rpGeoPoint, float afBearing_rad, float afRange_km); tcStream& operator<<(tcStream& stream); tcStream& operator>>(tcStream& stream); --- 196,200 ---- float& rfClimbAngle_rad, float& rfTimeToIntercept, float& rfRange_rad); void Serialize(tcFile& file, bool abLoad); ! void SetRelativeGeo(GeoPoint& rpGeoPoint, float afBearing_rad, float afRange_km); tcStream& operator<<(tcStream& stream); tcStream& operator>>(tcStream& stream); *************** *** 207,214 **** int AngleWithinRange(float afAngle_rad, float afAngle1_rad, float afAngle2_rad); ! float BearingTo(tsGeoPoint g1, tsGeoPoint g2); ! float RangeToKm(tsGeoPoint g1, tsGeoPoint g2); ! int GeoWithinRegion(tsGeoPoint p, tcRect *pRegion); inline float randf(void) {return (float)(rand() % RAND_MAX)/(float)RAND_MAX;} --- 208,215 ---- int AngleWithinRange(float afAngle_rad, float afAngle1_rad, float afAngle2_rad); ! float BearingTo(GeoPoint g1, GeoPoint g2); ! float RangeToKm(GeoPoint g1, GeoPoint g2); ! int GeoWithinRegion(GeoPoint p, tcRect *pRegion); inline float randf(void) {return (float)(rand() % RAND_MAX)/(float)RAND_MAX;} |