Re: [AD] al_play_sample_data parameters |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2008-12-15, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> 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.)
Yep, looks fine.
> 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.
I agree.
One suggestion would be to introduce a non-opaque type for the "tune id"
instead of int.
typedef struct ALLEGRO_TUNE_ID {
int __internal_dont_touch;
} ALLEGRO_TUNE_ID;
Peter