· WAVE-files are now supported
· Added caster_pause and caster_resume, to pause samples
· A new function, caster_error_occurred, can be used to check if any error has occurred since the previous call
· The current version of caster can be now retrieved by using caster_version().
· Added functionality for panning
· Fixed various bugs, and improved the error handling system
Caster is a lightweight OpenAL-based extension for playing Ogg and WAVE files in Game Maker. The extension works on both Windows and Mac.
The windows version requires ogg.dll, vorbis.dll, vorbisfile.dll, OpenAL32.dll, wrap_oal.dll and msvcr100.dll.
The Mac version only requires that OpenAL.framework is installed (included in the system library after version 10.4 “Tiger”).
There are two kinds of objects in caster: samples and source instances.
Samples represent the ogg files. They contain the raw data that is obtained when loading a file.
Instances represent the actual sounds while they are playing. When a sample starts playing, a new instance of that sample is created as a source. That instance can then be manipulated independently of other instances of the same sample.
caster_load(path) Creates a new sample from the specified path and returns its index.
caster_free(ind) Frees the sample with the given index. Any instance of that sample is automatically stopped.
caster_play(ind,volume,pitch) Creates a new instance of sample ind, using the given volume and pitch, and plays it once. Returns the index of the new instance.
caster_loop(ind,volume,pitch) Creates a new instance of sample ind and plays it, looping continuously. Returns the index of the new instance.
caster_stop(ind) If ind is an instance, then that instance is stopped. If ind is a sample index, then all instances of that sample are stopped.
caster_pause(ind) If ind is an instance, then that instance is paused. If ind is a sample index, then all instances of that sample are paused.
caster_resume(ind) If ind is an instance, then if that instance is paused, it resumes from where it was paused; if the instance has not been paused, nothing happens. If ind is a sample index, then all paused instances of that sample are resumed.
caster_is_playing(ind) If ind is an instance, returns true if that instance is playing or has been paused. If ind is a sample index, it returns 1 if there exists any playing instance of that sample.
caster_version() Returns the current version of the extension. If you find a bug with Caster, you can use this to make sure you have the latest version.
Each source instance contains information about its volume, pitch and panning. Volume should be a value between 0 and 1, where 1 is default and 0 is complete silence. Pitch should be a real number greater than 0 where 1 is the default value.
Panning should be a value between -1 and 1, where -1 is completely left-shifted, and 1 is completely right-shifted. When new sources are created, their panning value is automatically set to 0. Note that panning is only supported for mono files. To pan stereo samples, you have to split it into two mono samples and pan each of them individually.
The following functions can be used to manipulate the volume/pitch for playing source instances:
In these functions, ind can also be a sample index. In that case, the get functions return the value of the first instance of that sample, and the set functions set the value for all instances of that sample.
If an error occurs in some function, that function will always return a negative number. caster_error_occurred() can be used to see if an error has occurred. This returns true if an error has occurred since the last call. The nature of the error can then be retrieved with caster_error_message(). If no error has occurred, this function returns an empty string.
This extension was made by Marius Utheim. Special thanks to Uriel Griffin for some technical support, and Tom Grochowiak for testing.
If you have any suggestions, comments or bug reports, I can be reached on email@example.com.