[AD] al_play_sample_data parameters |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: "Coordination of admins/developers of the game programming library Allegro" <alleg-developers@xxxxxxxxxx>
- Subject: [AD] al_play_sample_data parameters
- From: "Matthew Leverton" <meffer@xxxxxxxxxx>
- Date: Mon, 15 Dec 2008 16:14:58 -0600
I suggest the method to be changed as such:
int al_play_sample_data(ALLEGRO_SAMPLE_DATA *data, float gain, float
pan, float speed, int loop)
e.g.,
int tune_id = al_play_sample_data(tune, 1.0, 0.5, 1.0, ALLEGRO_PLAYMODE_ONEDIR);
al_stop_simple_sample(tune_id);
The above change makes the "simple" API sufficient for almost any
common task. I've already made the above changes locally to support
Speed (which has a very hacky music player) and can supply a working
patch. (The pan setting is ignored.)
The id that is returned is the index of "simp_samples." So if the
sample has already stopped (non looped) before al_stop_simple_sample()
is called, then the wrong sample is likely to be stopped. Personally,
I don't think that's a major concern, as there is not much use in
stopping a sample that doesn't loop.
Alternatively, it could work like Allegro 4:
al_stop_sample_data(tune);
The problem with that is all instances are stopped, but the advantages
are no arbitrary id is needed and you cannot accidentally stop the
wrong sample if you try to stop a non-looping one.
--
Matthew Leverton