play_sample, delay in sound when looping
Jesse Shepherd

Hello,

Allegro (4.2) function in question:

play_sample(const SAMPLE *spl, int vol, int pan, int freq, int loop);

I call the following line to play my_sample, loaded from a wav file:

play_sample(my_sample, 255, 128, 1000, TRUE);

When the sample is about to loop, a slight delay occurs before the sample plays again from the start. Is there something I could be doing in regards to a more seamless sounding loop?

Thanks very much for any information

weapon_S

Perhaps the sample itself has a little silence...? Try editing in audacity.

Jesse Shepherd

There was silence in the sample- I didn't look closely enough. I've lost all credibility to ask questions on here, ha. Thanks man

wolf_wolf17

I made a post like this too, I felt like you feel now. But then again, they say humiliation makes a humble man.

Arthur Kalliokoski

The hardware guys say experience is directly proportional to the amount of equipment ruined, so I guess programming experience is proportional to the mistakes that were so embarrassing you're determined not to make them again. I myself just went through two hours of frustration trying to remember how to get UV coordinates in an OBJ file exported by Blender, and I'm pretty sure I'll remember next time.

Felix-The-Ghost

I guess programming experience is proportional to the mistakes that were so embarrassing you're determined not to make them again

For me, this caused headaches yesterday:
(Not actual code, simple example [I don't actually remember the problematic code])

for (int i = 0; i < 1337; i++);
{
   if (i % 2 = 0)
   some_var = i * i - i;
}

I never noticed such a problem, and there was no compiler warning.

Arthur Kalliokoski

I've done that a dozen or so times also, and I've read the compiler doesn't warn you because so many people use a bare loop for a delay. It's the muscle memory in your pinky that puts that colon there.

Thomas Fjellstrom

It's the muscle memory in your pinky that puts that colon there.

Heh, took me a moment to figure out what you meant. Didn't even see that. I did however see this: 'if (i % 2 = 0)'

weapon_S

Same as Thomas...

al_clear_to_color(al_map_rgb(255, 225, 255);
al_draw_rotated_tinted_bitmap(al_map_rgba(127, 127, 255, 255), 0.0f, 0.0f, 0.5f * BMP_WIDTH, 0.5f * BMP_HEIGHT, 0.5f * ALLEGRO_PI, 0);

Spent a couple of hours figuring out how a call to al_draw_rotated_tinted_bitmap could turn my screen pink.

gnolam

I never noticed such a problem, and there was no compiler warning.

Quote:

if (i % 2 = 0)

i % 2 isn't an lvalue (and as such can't be assigned to), so that can't compile...

Arthur Kalliokoski

He didn't have that in there when I responded.

Thread #609256. Printed from Allegro.cc