[SDL] SDL Audio questions
nb at synthcom.com
Sun Jul 28 21:59:01 PDT 2002
> > indicates the sample type. However, with the current API, I need to know
> > what that is before I do an SDL_OpenAudio, and it looks like the only way
> > I can set userdata to anything is by doing an SDL_OpenAudio. Is there any
> > way to change the user data callback after SDL_OpenAudio has been called?
> Could you pass it a pointer to data that you update? The callback will get
> the original pointer, but what it points to can be changed.
I'm not quite sure what you're suggesting. As you mentioned above, a copy
of the structure is made, so updating my SDL_AudioSpec structure locally
won't have any effect. Is there a way to change the user data area pointer
after a stream has been opened?
> > wrong (not sure what it is, but it's definitley wrong). Plus, there's a
> > good amount of noise/grainyness introduced.
> The SDL sample rate converter only successfully converts between rates
> that are powers of two (and even there, some would argue, not very well).
> We have a more accurate converter in the works that is being developed in
> the SDL_sound project (http://icculus.org/SDL_sound/)...the hope is that
> after SDL_sound is finished being a good testbed for it, we can adapt it
> to SDL for the 2.0 revision of the library. Might be worth your time to
> look at.
I took a look, but SDL_Sound looks like it's overkill for what I'm
needing/looking for. While very useful to others, it's not useful in my
I guess my fundamental issue is that SDL_ConvertAudio doesn't work as
advertised. The documentation says it'll convert from one sample rate to
another, but it makes no mention of powers of two rate conversions nor
will it return an error if an "odd" conversion rate is chosen. So I see it
that the current implementation is "wrong" according to the documentation,
and either one of two things need to be done:
1) Modify the SDL_Convert routine so it'll correctly resample audio at odd
2) Modify the documentation to stipulate that only powers of 2 conversions
will be performed, and modify the code to return an error if an "odd"
sample rate is provided
And I'm willing to do either for the good of the project. While the
SDL_sound stuff is a solution, it seems like overkill to have to go to yet
another library when the default API would be sufficient if #1 or #2 above
> > Is there any interest in me submitting a sample rate converter that has
> > antialiasing? What is the process for submitting code?
> Generally, send patches to the list against the latest CVS. After we are
> done making fun of your code (no, we don't really. Honest.), we can decide
> if it's right for SDL. I tend to commit fixes, but leave it up to Sam to
> decide on big changes. (However, I'm the dictator for SDL_sound. :) )
Really? So sending ZIP or tar files of changes is appropriate for this
Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 "It tastes like it came off the back porch." - Me
More information about the SDL