New SDL/opengl demo

roaddemo is at http://www.newimage.com/~rhk/roaddemo

This is my bezier-road demo ported from glut to SDL.

Use the right mouse button to select one of the endpoints or
control points, then click and drag with the left mouse
button to move the point.

This program is released under the GPL version 2, and requires
SDL version 1.1.0 or higher.

The original version used glut.

Hello,

Just curious - In SDL_BuildCVT(), is “rate” the same thing as “freq”? If
not, where do I find “rate”?

Thanks,
Brian Hayward

Hello,

Just curious - In SDL_BuildCVT(), is “rate” the same thing as “freq”? If
not, where do I find “rate”?

yes, they are the same.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

hayward at slothmud.org wrote:

Hello,

Just curious - In SDL_BuildCVT(), is “rate” the same thing as “freq”? If
not, where do I find “rate”?

Yes.

-John

@hayward_at_slothmud wrote:

Hello,

Just curious - In SDL_BuildCVT(), is “rate” the same thing as “freq”? If
not, where do I find “rate”?

Yes.

I must be doing something wrong then.

If I set my SDL_OpenAudio specs to those in the example, then try to
convert a 8000 freq wav to the current format, it only plays a chirp from
the start of it. But if I set my OpenAudio specs to that of the wav file
and don’t convert, it plays it just fine.

I’m playing the licq “message for you, sir” (monty python clip).

init function
extern void fillaud(void *udata, Uint8 *stream, int len);
spec.freq = 22050;
spec.format = AUDIO_S16;
spec.channels = 2;
spec.samples = 1024;
spec.callback = fillaud;
spec.userdata = NULL;

SDL_OpenAudio(&spec, NULL);

load wave/convert

// Spec = overall audio, myspec = newly read in wav
SDL_LoadWAV(wfil, &myspec, &(wave->sound), &(wave->soundlen));
SDL_BuildAudioCVT(&cvt, myspec.format,myspec.channels,
myspec.freq, spec.format,spec.channels,
spec.freq);
cvt.len = wave->soundlen;
aud_buf = malloc(cvt.len*cvt.len_mult);
for(i=0;isoundlen;i++)
aud_buf[i] = wave->sound[i];
free(wave->sound);
wave->sound = aud_buf;
cvt.buf = aud_buf;
SDL_ConvertAudio(&cvt);–
Brian

hayward at slothmud.org wrote:

Hello,

Just curious - In SDL_BuildCVT(), is “rate” the same thing as “freq”? If
not, where do I find “rate”?

Yes.

I must be doing something wrong then.

If I set my SDL_OpenAudio specs to those in the example, then try to
convert a 8000 freq wav to the current format, it only plays a chirp from
the start of it. But if I set my OpenAudio specs to that of the wav file
and don’t convert, it plays it just fine.

There’s a problem with the audio rate conversion code as it relates to
the audio driver.
See the comment near the following line in SDL_audiocvt.c:
if ( (lo_rate/100) != (hi_rate/100) ) {

You still shouldn’t get a chirp. Can you send me a working example
at @slouken?

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

There’s a problem with the audio rate conversion code as it relates to
the audio driver.
See the comment near the following line in SDL_audiocvt.c:
if ( (lo_rate/100) != (hi_rate/100) ) {

This must be why sounds converted from 8000 to 22050 resemble the
chipmonks.

You still shouldn’t get a chirp. Can you send me a working example
at slouken at libsdl.org?

I figured out the problem. I was only playing 1/2 after the conversion
from 1 channel to 2 channel. I allocated the correct amount of space for
the converted size, but overlooked updateing my local length used for
playing.

Thanks,
Brian

SDL_Event event;
bool nQuit = false;

// This code is not working for some reason
while(nQuit == false)
{
if( SDL_PollEvent(&event) != 0)
{
if( event.type == SDL_KEYDOWN )
nQuit = true;
}
}

I’m just trying to write a simple function that will wait for a key, any
key, to be pressed before continuing. The code sample above doesn’t work.
I was wondering what was wrong with it?

Thanks for any help,

Rob________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

changing
if ( SDL_PollEvent(&event) != 0)
to
while ( SDL_PollEvent(&event) != 0)

should do it for you I think.On Thu, 03 Aug 2000, you wrote:

SDL_Event event;
bool nQuit = false;

// This code is not working for some reason
while(nQuit == false)
{
if( SDL_PollEvent(&event) != 0)
{
if( event.type == SDL_KEYDOWN )
nQuit = true;
}
}

I’m just trying to write a simple function that will wait for a key, any
key, to be pressed before continuing. The code sample above doesn’t work.
I was wondering what was wrong with it?

Thanks for any help,

Rob


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com