//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#include STL_STRING
#include <simgear/debug/logstream.hxx>
+#include <simgear/structure/SGReferenced.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
#include <plib/sg.h>
* manages everything we need to know for an individual sound sample
*/
-class SGSoundSample {
+class SGSoundSample : public SGReferenced {
private:
// configuration values
ALenum format;
ALsizei size;
- ALvoid* data;
ALsizei freq;
double pitch;
public:
+ /**
+ * Empty constructor, can be used to read data to the systems
+ * memory and not to the driver.
+ */
+ SGSoundSample();
+
/**
* Constructor
* @param path Path name to sound
* @param file File name of sound
- * @param cleanup Request clean up the intermediate data (this
should usually be true unless you want to manipulate the data
later.)
*/
- SGSoundSample( const char *path, const char *file, bool cleanup );
+ SGSoundSample( const char *path, const char *file );
/**
* Constructor.
* @param _data Pointer to a memory buffer containing the sample data
+ the application is responsible for freeing the buffer data.
* @param len Byte length of array
* @param _freq Frequency of the provided data (bytes per second)
- * @param cleanup Request clean up the intermediate data (this
should usually be true unless you want to manipulate the data
later.)
*/
- SGSoundSample( unsigned char *_data, int len, int _freq, bool cleanup );
+ SGSoundSample( unsigned char *_data, int len, int _freq );
~SGSoundSample();
return size;
}
- /**
- * Return a pointer to the raw data
- */
- inline char *get_data() {
- return (char *)data;
- }
-
/**
* Set position of sound source (uses same coordinate system as opengl)
*/
* no longer audible.
*/
void set_max_dist( ALfloat dist );
+
+ /**
+ * Load a sound file into a memory buffer only.
+ */
+ ALvoid* load_file(const char *path, const char *file);
};