|
|
Audio addon
Audio typesALLEGRO_AUDIO_DEPTHSample depth and type, and signedness. Mixers only use 32-bit signed float (-1..+1). The unsigned value is a bit-flag applied to the depth value.
For convenience:
ALLEGRO_AUDIO_DRIVER_ENUMThe sound driver to use. It is highly recommended to use ALLEGRO_AUDIO_DRIVER_AUTODETECT whenever possible.
ALLEGRO_AUDIO_PAN_NONESpecial value for the ALLEGRO_AUDIOPROP_PAN property. Use this value to play samples at their original volume with panning disabled. ALLEGRO_CHANNEL_CONFSpeaker configuration (mono, stereo, 2.1, 3, etc).
ALLEGRO_MIXERA mixer is a type of stream which mixes together attached streams into a single buffer. ALLEGRO_MIXER_QUALITY
ALLEGRO_PLAYMODESample and stream looping mode.
ALLEGRO_SAMPLE_IDAn ALLEGRO_SAMPLE_ID represents a sample being played via al_play_sample. It can be used to later stop the sample with al_stop_sample. ALLEGRO_SAMPLEAn ALLEGRO_SAMPLE object stores the data necessary for playing pre-defined digital audio. It holds information pertaining to data length, frequency, channel configuration, etc. You can have an ALLEGRO_SAMPLE object playing multiple times simultaneously. The object holds a user-specified PCM data buffer, of the format the object is created with. ALLEGRO_SAMPLE_INSTANCEAn ALLEGRO_SAMPLE_INSTANCE object represents a playable instance of a predefined sound effect. It holds information pertaining to the looping mode, loop start/end points, playing position, etc. An instance uses the data from an ALLEGRO_SAMPLE object. Multiple instances may be created from the same ALLEGRO_SAMPLE. An ALLEGRO_SAMPLE must not be destroyed while there are instances which reference it. To be played, an ALLEGRO_SAMPLE_INSTANCE object must be attached to an ALLEGRO_VOICE object, or to an ALLEGRO_MIXER object which is itself attached to an ALLEGRO_VOICE object (or to another ALLEGRO_MIXER object which is attached to an ALLEGRO_VOICE object, etc). ALLEGRO_STREAMAn ALLEGRO_STREAM object is used to stream generated audio to the sound device, in real-time. As with ALLEGRO_SAMPLE_INSTANCE objects, they store information necessary for playback, so you may not play one multiple times simultaneously. They also need to be attached to an ALLEGRO_VOICE object, or to an ALLEGRO_MIXER object which, eventually, reaches an ALLEGRO_VOICE object. While playing, you must periodically supply new buffer data by first checking ALLEGRO_AUDIOPROP_USED_FRAGMENTS, then refilling the buffers via ALLEGRO_AUDIOPROP_BUFFER. If you're late with supplying new data, the object will be silenced until new data is provided. You must call al_drain_stream when you're finished supplying the stream. ALLEGRO_VOICEA voice structure that you'd attach a mixer or sample to. Ideally there would be one ALLEGRO_VOICE per system/hardware voice. Setting upal_install_audioParameters:
Returns true on success, false on failure. See also: al_reserve_samples. al_uninstall_audioal_reserve_samplesReserves 'reserve_samples' number of samples attached to the default mixer. al_install_audio must have been called first. If no default mixer is set, then this function will create a voice with an attached mixer. Returns true on success, false on error. Voice functionsal_create_voiceCreates a voice struct and allocates a voice from the digital sound driver. The sound driver's allocate_voice function should change the voice's frequency, depth, chan_conf, and settings fields to match what is actually allocated. If it cannot create a voice with exact settings it will fail. Use a mixer in such a case. al_destroy_voiceDestroys the voice and deallocates it from the digital driver. Does nothing if the voice is NULL. al_detach_voiceDetaches the sample or mixer stream from the voice. al_attach_stream_to_voiceAttaches an audio stream to a voice. The same rules as al_attach_sample_to_voice apply. This may fail if the driver can't create a voice with the buffer count and buffer size the stream uses. al_attach_mixer_to_voiceAttaches a mixer to a voice. The same rules as al_attach_sample_to_voice apply, with the exception of the depth requirement. al_attach_sample_to_voiceAttaches a sample to a voice, and allows it to play. The sample's volume and loop mode will be ignored, and it must have the same frequency and depth (including signed-ness) as the voice. This function may fail if the selected driver doesn't support preloading sample data. al_get_voice_frequencyReturn the frequency of the voice, e.g. 44100. al_get_voice_channelsReturn the channel configuration of the voice. See also: ALLEGRO_CHANNEL_CONF. al_get_voice_depthReturn the audio depth of the voice. See also: ALLEGRO_AUDIO_DEPTH. al_get_voice_playingReturn true if the voice is currently playing. al_set_voice_playingChange whether a voice is playing or not. The voice must have a sample or mixer attached to it. Returns true on success, false on failure. al_get_voice_positionWhen the voice has a non-streaming object attached to it, e.g. a sample, returns the voice's current sample position. Otherwise, returns zero. al_set_voice_positionSet the voice position. This can only work if the voice has a non-streaming object attached to it, e.g. a sample. Returns true on success, false on failure. Sample functionsal_create_sampleCreate a sample data structure from the supplied buffer. If al_destroy_sampleFree the sample data structure. If it was created with the You must destroy any ALLEGRO_SAMPLE_INSTANCE structures which reference this ALLEGRO_SAMPLE beforehand. al_play_samplePlays a sample over the default mixer. al_reserve_samples must have previously been called. Returns true on success, false on failure. Playback may fail because all the reserved samples are currently used. al_stop_sampleStop the sample started by al_play_sample. al_stop_samplesStop all samples started by al_play_sample. al_create_sample_instanceCreates a sample stream, using the supplied data. This must be attached to a voice or mixer before it can be played. The argument may be NULL. You can then set the data later with al_set_sample. al_destroy_sample_instanceDetaches the sample stream from anything it may be attached to and frees it (the sample data is not freed!). al_play_sample_instancePlay an instance of a sample data. Returns true on success, false on failure. al_stop_sample_instanceStop an sample instance playing. al_get_sample_instance_channelsReturn the channel configuration. See also: ALLEGRO_CHANNEL_CONF. al_get_sample_instance_depthReturn the audio depth. See also: ALLEGRO_AUDIO_DEPTH. al_get_sample_instance_frequencyReturn the frequency of the sample instance. al_get_sample_instance_lengthReturn the length of the sample instance in sample values. al_set_sample_instance_lengthSet the length of the sample instance in sample values. Return true on success, false on failure. Will fail if the sample instance is currently playing. al_get_sample_instance_positionGet the playback position of a sample instance. al_set_sample_instance_positionSet the playback position of a sample instance. Returns true on success, false on failure. al_get_sample_instance_speedReturn the playback speed. al_set_sample_instance_speedSet the playback speed. Return true on success, false on failure. Will fail if the sample instance is attached directly to a voice. al_get_sample_instance_gainReturn the playback gain. al_set_sample_instance_gainSet the playback gain. Returns true on success, false on failure. Will fail if the sample instance is attached directly to a voice. al_get_sample_instance_panGet the pan value. al_set_sample_instance_panSet the pan value on a sample instance. A value of -1.0 means to play the sample only through the left speaker; +1.0 means only through the right speaker; 0.0 means the sample is centre balanced. A constant sound power level is maintained as the sample is panned from left to right. As a consequence, a pan value of 0.0 will play the sample 3 dB softer than the original level. To disable panning and play a sample at its original level, set the pan value to ALLEGRO_AUDIO_PAN_NONE. Returns true on success, false on failure. Will fail if the sample instance is attached directly to a voice. (A sound guy should explain that better; I only implemented it. Also this might be more properly called a balance control than pan. Also we don't attempt anything with more than two channels yet.) al_get_sample_instance_timeReturn the length of the sample instance in seconds, assuming a playback speed of 1.0. al_get_sample_instance_playmodeReturn the playback mode. al_set_sample_instance_playmodeSet the playback mode. Returns true on success, false on failure. al_get_sample_instance_playingReturn true if the sample instance is playing. al_set_sample_instance_playingChange whether the sample instance is playing. Returns true on success, false on failure. al_get_sample_instance_attachedReturn whether the sample instance is attached to something. al_detach_sample_instanceDetach the sample instance from whatever it's attached to, if anything. al_get_sampleReturn the sample data that the sample instance plays. al_set_sampleChange the sample data that a sample instance plays. This can be quite an involved process. First, the sample is stopped if it is not already. Next, if data is NULL, the sample is detached from its parent (if any). If data is not NULL, the sample may be detached and reattached to its parent (if any). This is not necessary if the old sample data and new sample data have the same frequency, depth and channel configuration. Reattaching may not always succeed. On success, the sample remains stopped. The playback position and loop end points are reset to their default values. The loop mode remains unchanged. Returns true on success, false on failure. On failure, the sample will be stopped and detached from its parent. Mixer functionsal_create_mixerCreates a mixer stream, to attach sample streams or other mixers to. It will mix into a buffer at the requested frequency and channel count. Only floating point mixing is currently supported. al_destroy_mixerDestroys the mixer stream. al_get_default_mixerReturn the default mixer. al_set_default_mixerSets the default mixer. All samples started with al_play_sample will be stopped. If you are using your own mixer, this should be called before al_reserve_samples. Returns true on success, false on error. al_restore_default_mixerRestores Allegro's default mixer. All samples started with al_play_sample will be stopped. Returns true on success, false on error. al_attach_mixer_to_mixerAttaches a mixer onto another mixer. The same rules as with al_attach_sample_to_mixer apply, with the added caveat that both mixers must be the same frequency. al_attach_sample_to_mixerAttach a sample instance to a mixer. Returns true on success, false on failure. al_attach_stream_to_mixerAttach a stream to a mixer. Returns true on success, false on failure. al_get_mixer_frequencyReturn the mixer frequency. al_set_mixer_frequencyal_get_mixer_channelsReturn the mixer channel configuration. al_get_mixer_depthReturn the mixer audio depth. al_get_mixer_qualityReturn the mixer quality. See also: ALLEGRO_MIXER_QUALITY. al_set_mixer_qualitySet the mixer quality. Returns true on success, false on failure. al_get_mixer_playingReturn true if the mixer is playing. al_set_mixer_playingChange whether the mixer is playing. Returns true on success, false on failure. al_get_mixer_attachedReturn true if the mixer is attached to something. al_detach_mixerDetach the mixer from whatever it is attached to, if anything. al_set_mixer_postprocess_callbackSets a post-processing filter function that's called after the attached streams have been mixed. The buffer's format will be whatever the mixer was created with. The sample count and user-data pointer is also passed. Stream functionsal_create_streamCreates an audio stream, using the supplied values. The stream will be set to play by default. al_destroy_streamal_drain_streamCalled by the user if sample data is not going to be passed to the stream any longer. This function waits for all pending buffers to finish playing. Stream's playing state will change to false. al_rewind_streamSet the streaming file playing position to the beginning. Returns true on success. Currently this can only be called on streams created with acodec's al_stream_from_file. al_get_stream_frequencyReturn the stream frequency. al_get_stream_channelsReturn the stream channel configuration. al_get_stream_depthReturn the stream audio depth. al_get_stream_lengthal_get_stream_speedReturn the playback speed. al_set_stream_speedSet the playback speed. Return true on success, false on failure. Will fail if the sample instance is attached directly to a voice. al_get_stream_gainReturn the playback gain. al_set_stream_gainSet the playback gain. Returns true on success, false on failure. Will fail if the sample instance is attached directly to a voice. al_get_stream_panGet the pan value. al_set_stream_panSet the pan value on a sample instance. A value of -1.0 means to play the sample only through the left speaker; +1.0 means only through the right speaker; 0.0 means the sample is centre balanced. Returns true on success, false on failure. Will fail if the sample instance is attached directly to a voice. al_get_stream_playingReturn true if the stream is playing. al_set_stream_playingChange whether the stream is playing. Returns true on success, false on failure. al_get_stream_playmodeReturn the playback mode. al_set_stream_playmodeSet the playback mode. Returns true on success, false on failure. al_get_stream_attachedReturn whether the stream is attached to something. al_detach_streamDetach the stream from whatever it's attached to, if anything. al_get_stream_bufferal_set_stream_bufferal_get_stream_fragmentsal_get_stream_used_fragmentsal_seek_stream_secsSet the streaming file playing position to time. Returns true on success. Currently this can only be called on streams created with acodec's al_stream_from_file. al_get_stream_position_secsReturn the position of the stream in seconds. Currently this can only be called on streams created with acodec's al_stream_from_file. al_get_stream_length_secsReturn the position of the stream in seconds. Currently this can only be called on streams created with acodec's al_stream_from_file. al_set_stream_loop_secsReturn the position of the stream in seconds. Currently this can only be called on streams created with acodec's al_stream_from_file. |
Last updated: 2009-07-05 05:34:24 UTC