From ewing2121 at yahoo.com  Mon Dec  2 09:03:10 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Mon, 2 Dec 2002 06:03:10 -0800 (PST)
Subject: need help putting it all together (sdl_sound,sdl_mixer,physfs)
Message-ID: <20021202140310.52991.qmail@web20703.mail.yahoo.com>

Hello, can anybody help me with the following
problems?

I am working on a small game and would like to have
music, sound effects, and speech in it. Furthermore, I
am also very interested in using PhysicsFS because I
have lots of little files and packing them makes a lot
of sense.

I was going to use SDL_Mixer to do all my sound, but I
have discovered that it can't do everything I need it
to do. My music and speech files are kind of large, so
I would like to use MP3 or OGG formats. However, with
SDL_Mixer, it looks like only the dedicated MUSIC
channel can decode these formats, and you can only
play one file at a time. Furthermore, there is no
SDL_mixer function to allow loading a MUSIC file
through RWops (which I think I need if I want to use
PhysFS).

So I've been reading about SDL_Sound and I've read
that you can get the two to work together. However, I
haven't been able to get them to work together in a
useful way.

First, FYI, I think there is a bug with the Init code
and MikMod. If I initialize both SDL_Sound and
SDL_Mixer (with Sound_Init() and Mix_OpenAudio(...)),
my program hangs. I think it gets stuck in an infinite
loop. If I interrupt the process with a debugger, I am
left inside "mloader" which seems to be a park of
MikMod. 

void _mm_registerloader(MLOADER* lrd)
{
    MLOADER *cruise=firstloader;
    if(cruise) {
stuckhere->    while(cruise->next) cruise =
cruise->next;
               cruise->next=ldr;
    } else 
          firstloader=ldr;
}

It doesn't matter which one I initialize first. Once I
hit the second initialization call, I get stuck.

I am running Debian Woody (stable) and have SDL_Sound
1.0. I tried it with the Deb packaged SDL_Mixer 1.2.1
and the current cvs version 1.2.5. I recompiled
SDL_mixer 1.2.5 without Mikmod support and the problem
went away.

Anyway, after I removed Mikmod, I was able to get a
little further. Then I tried the following sequence:

sdl_sound_sample = Sound_NewSample(...);
Sound_DecodeAll(sdl_sound_sample);
sound =
Mix_QuickLoad_RAW((Uint8*)sdl_sound_sample->buffer,
sdl_sound_sample->buffer_size);
Mix_PlayChannel(-1, sound, 0);

I tried several different types of files. Most of my
files played something recognizable, but they played
at the wrong speed. I was wondering how I can fix
this. I also had some low quality WAV files which were
unrecognizable. 

But also, the DecodeAll option was taking a very long
time to run on my MP3 files, and I presume it's also
taking a lot of memory. I doubt I will be able to use
this function with the number of speech files I have.
Is there a way I can do this so I don't have to decode
the whole thing, or am I totally out of luck? I see
the Sound_Decode() function, but I don't know how I
can stream it to SDL_Mixer.

I would appreciate any ideas or solutions to these
problems. Also, if SDL_Sound/SDL_Mixer/PhysFS won't
work, is there another (LGPL compatible) solution,
perhaps SDL_Sound/OpenAL/PhysFS? (and what would the
interfaces look like)?

Thank you,
Eric 






__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From torbjorn.e.andersson at tietoenator.com  Tue Dec  3 08:48:49 2002
From: torbjorn.e.andersson at tietoenator.com (torbjorn.e.andersson at tietoenator.com)
Date: Tue, 3 Dec 2002 14:48:49 +0100 
Subject: [sdlsound] need help putting it all together (sdl_sound,sdl_m
	ixer,physfs)
Message-ID: <5B8B5EE38245A84A87677CD39CE251835DD6EB@gabriel.enator.se>

I've been hoping for someone else to answer, but...

Eric Wing [ewing2121 at yahoo.com] wrote:

> First, FYI, I think there is a bug with the Init code
> and MikMod. If I initialize both SDL_Sound and
> SDL_Mixer (with Sound_Init() and Mix_OpenAudio(...)),
> my program hangs. I think it gets stuck in an infinite
> loop. If I interrupt the process with a debugger, I am
> left inside "mloader" which seems to be a park of
> MikMod. 

Oof, I think I see what's causing this. Both SDL_Mixer and SDL_sound will
call MikMod_RegisterAllLoaders(), and that function won't check if the
loaders have already been registered. This probably creates loops in what's
supposed to be a linked list of loaders.

I guess we could make the MikMod loader first check if MikMod_InfoLoader()
returns a non-empty string, but it's not what I'd call a pretty solution.

(It's also quite possible, but less likely, that we have the same problem
with registering drivers.)

> I tried several different types of files. Most of my
> files played something recognizable, but they played
> at the wrong speed. I was wondering how I can fix
> this. I also had some low quality WAV files which were unrecognizable. 

It sounds as if SDL_sound is decoding the audio to a different format than
SDL_Mixer expects it to. At least that would explain the wrong speed. I
don't know what'd cause the second bug though. If it was a problem with
byte order and/or signedness of the output, that should have been noticeable
with the other ones as well.

> But also, the DecodeAll option was taking a very long
> time to run on my MP3 files, and I presume it's also
> taking a lot of memory.

Yes, it will decode the entire MP3 into a memory buffer. You should probably
just decode a little bit at a time, like "playsound" does.

Mind you, I've never actually used SDL_sound (which is embarrassing since I
helped writing parts of it :-). Ryan has been threatening to rewrite
SDL_Mixer to use SDL_sound as a backend. This should make most of these
problems go away, but I understand he's been busy elsewhere lately.

Torbj?rn Andersson


From ewing2121 at yahoo.com  Tue Dec  3 17:07:17 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Tue, 3 Dec 2002 14:07:17 -0800 (PST)
Subject: [sdlsound] need help putting it all together (sdl_sound,sdl_m ixer,physfs)
In-Reply-To: <5B8B5EE38245A84A87677CD39CE251835DD6EB@gabriel.enator.se>
Message-ID: <20021203220717.68687.qmail@web20705.mail.yahoo.com>

--- torbjorn.e.andersson at tietoenator.com wrote:
> I've been hoping for someone else to answer, but...
> 

Thank you for the response. I've made a little more
progress but I'm still stuck on some things.

> Yes, it will decode the entire MP3 into a memory
> buffer. You should probably
> just decode a little bit at a time, like "playsound"
> does.
I totally missed the callback function for sounds in
the SDL_mixer. I saw the music callback but didn't see
the sound callback and I assumed it was like the
missing RWops support. So I was totally clueless on
how to know when to continue decoding without it. So I
got that working (kind of) now. Thanks. 


> It sounds as if SDL_sound is decoding the audio to a
> different format than
> SDL_Mixer expects it to. At least that would explain
> the wrong speed. I
> don't know what'd cause the second bug though. If it
> was a problem with
> byte order and/or signedness of the output, that
> should have been noticeable
> with the other ones as well.

Okay, I think you nailed both problems. My open call
to SDL_mixer is something like:
Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048);
My sound files are unfortunately recorded at all
different types of frequencies, mono and stereo, bit
precisions, and are in different formats. So I presume
SDL_Sound is decoding them for their "actual" stats.
However, I am not sure how to get the two to work
together correctly. In the case where I have an MP3
file encoded at 44100 and SDL_Mixer is set to the
same, I have no problems. But when my audio values
don't match, I get into a ton of problems.

I've found the "desired" field in Sound_NewSample.
I've create a Sound_AudioInfo desired; where,
desired.format = MIX_DEFAULT_FORMAT; // This fixed the
garbled problem
desired.channels = 0; // Assuming 0 takes the actual
desired.rate = (Whatever SDL_mixer is set to);

I call Sound_NewSample(rwops, fileext, &desired,
16384?);

So here are some of the weird cases:
With SDL_mixer set to 22050 (and thus desired), my MP3
file plays very stranglely. For each decoded chunk,
roughly the first half plays normally, and then the
second half plays at a slower speed (1/2 or 1/4). Then
when the next chunk is decoded and played, it repeats
the same problem (first half okay, second half slow).
Also I noticed that my playback seems click more
between chunk, and I have to increase the buffer size
to decode. However, if I do a DecodeAll instead of
streaming, the file plays fine.

With SDL_mixer set to 44100, and playing a 11025hz
WAV, it runs really fast, something like 8x. If I
select my desired rate to be 88200, then it plays
normally. If I take the same WAV file and make it an
OGG, I get no output. However, if I do DecodeAll
instead, I hear the output like the WAV.


Can somebody please explain this to me? And is there a
better way of getting the samples to play at the
correct speed? It seems that converting to extremely
high numbers like 88200 is not a good thing. I can
already see performance hits. SDL_mixer also seems to
vary in performance from system to system and it seems
that I would like to keep the SDL_mixer frequency user
adjustable.
 
> Mind you, I've never actually used SDL_sound (which
> is embarrassing since I
> helped writing parts of it :-). Ryan has been
> threatening to rewrite
> SDL_Mixer to use SDL_sound as a backend. This should
> make most of these
> problems go away, but I understand he's been busy
> elsewhere lately.
> 
That would be the greatest solution, but yeah, he
seems to be really busy.

Thanks,
Eric


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From khan1 at mail.ru  Wed Dec  4 18:41:28 2002
From: khan1 at mail.ru (vano)
Date: Wed, 4 Dec 2002 18:41:28 -0500
Subject: hello. problems with initialization
In-Reply-To: <20021203220717.68687.qmail@web20705.mail.yahoo.com>
References: <20021203220717.68687.qmail@web20705.mail.yahoo.com>
Message-ID: <246382458.20021204184128@mail.ru>

First of all i want to kinda introduce myself. My name is Ivan.
I'm not a hardcore C programmer, as a matter of fact i'm in high
school. so expect dumb questions from me :)
Anyway when i do Sound_Init(); sdl (not sdl_sound) gives me the
following error: Couldn't open \TIMIDITY\timidity.cfg . i've tried to
trace where the program is looking for the file using filemon,
but don't see a reference to it anywhere. Ideas?
Another thing is that when i use Sound_NewSampleFromFile() i get this
error (again from sdl): Passed a NULL mutex. i can't even imagine what
could be causeing the problem. one thing is that i'm using the lib
with wxWindows, but wx (win version) is just a wrapper around mfc
and i don't think sdl should have problems with mfc.
that's it. i've been trying to get sdl_sound working for a couple of
weeks now, i even decided to use the bass library instead, but i ended
up with a sense of guilt for using a commercial library :)
thnx




From tsm at accesscomm.ca  Wed Dec  4 19:10:27 2002
From: tsm at accesscomm.ca (Corona688)
Date: Wed, 04 Dec 2002 18:10:27 -0600
Subject: [sdlsound] hello. problems with initialization
References: <20021203220717.68687.qmail@web20705.mail.yahoo.com> <246382458.20021204184128@mail.ru>
Message-ID: <3DEE9973.22051DA0@accesscomm.ca>

The first problem is with the Timidity MIDI decoder.  It expects a
timidity.cfg file in the directory of execution;  this specifies what MIDI
patch sets to load, and where to load them from.  You can get the .cfg
file and MIDI patch set here(Warning, 14MB download):
http://www.libsdl.org/projects/SDL_mixer/timidity/timidity.tar.gz

Or if you don't want MIDI support, you can save yourself the trouble of
lugging around a 17MB MIDI patchset by simply not enabling Timidity during
a recompile ( get the compiler to not define the SOUND_SUPPORTS_MIDI
symbol  )

vano wrote:

> First of all i want to kinda introduce myself. My name is Ivan.
> I'm not a hardcore C programmer, as a matter of fact i'm in high
> school. so expect dumb questions from me :)
> Anyway when i do Sound_Init(); sdl (not sdl_sound) gives me the
> following error: Couldn't open \TIMIDITY\timidity.cfg . i've tried to
> trace where the program is looking for the file using filemon,
> but don't see a reference to it anywhere. Ideas?

This part, I don't know.  :(

> Another thing is that when i use Sound_NewSampleFromFile() i get this
> error (again from sdl): Passed a NULL mutex. i can't even imagine what
> could be causeing the problem. one thing is that i'm using the lib
> with wxWindows, but wx (win version) is just a wrapper around mfc
> and i don't think sdl should have problems with mfc.
> that's it. i've been trying to get sdl_sound working for a couple of
> weeks now, i even decided to use the bass library instead, but i ended
> up with a sense of guilt for using a commercial library :)
> thnx



From ewing2121 at yahoo.com  Wed Dec  4 20:06:56 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Wed, 4 Dec 2002 17:06:56 -0800 (PST)
Subject: [sdlsound] need help putting it all together (sdl_sound,sdl_m ixer,physfs)
In-Reply-To: <20021203220717.68687.qmail@web20705.mail.yahoo.com>
Message-ID: <20021205010656.44024.qmail@web20705.mail.yahoo.com>

I figured out my playback speed problem. I was
incorrectly assuming that the number of bytes decoded
was the same as the sample->buffer_size for
Sound_Decode(sample) (except for EOF).

However finding this made me discover another problem
I'm hoping somebody can help me with. I noticed that
when running Sound_Decode() on .OGG files, the bytes
returned never matches my requested buffer size. This
occurs in both my own programs and Ryan's "playsound"
demo.

Using "playsound", for the default 16384 decodebuf
size, I seem to get one of three fixed sizes per
decode: 4096, 512, 2304. (I'm not sure what the
significance of these values are, especially the last
one.)

Furthermore, I noticed that in all cases, the
SOUND_SAMPLEFLAG_EAGAIN flag gets set on every decode
(and I am nowhere near EOF). Is this a bad thing, or
is it normal? Can somebody explain what this flag
means. SOUND_SAMPLEFLAG_ERROR ever gets set.

I've run these experiments using playsound in both
Linux (Debian,Redhat) and OSX, and this behavior is
consistent among machines.

I believe this small buffer size is making continuous
sounding streaming very difficult. Playsound can get
away with this in Linux, but my faster Mac cannot
stream my OGGs without bad breakup. 

Also, I have an additional problem because I'm trying
write my own applications to run SDL_Sound through
SDL_mixer. Because of the unfortunately long latencies
in SDL_mixer, the small buffersize is killing my
streaming ability, even in Linux.

So is there a way I can get Sound_Decode to actually
decode to my requested buffer size. Or is there a
workaround I can try?

Thanks,
Eric





__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From icculus at clutteredmind.org  Thu Dec  5 14:56:04 2002
From: icculus at clutteredmind.org (Ryan C. Gordon)
Date: Thu, 5 Dec 2002 14:56:04 -0500 (EST)
Subject: [sdlsound] need help putting it all together (sdl_sound,sdl_m
 ixer,physfs)
In-Reply-To: <20021205010656.44024.qmail@web20705.mail.yahoo.com>
Message-ID: <Pine.LNX.4.33L2.0212051453080.12844-100000@gamehenge.icculus.org>


> Furthermore, I noticed that in all cases, the
> SOUND_SAMPLEFLAG_EAGAIN flag gets set on every decode
> (and I am nowhere near EOF). Is this a bad thing, or
> is it normal? Can somebody explain what this flag
> means. SOUND_SAMPLEFLAG_ERROR ever gets set.

EAGAIN means that SDL_sound couldn't fully fill your buffer without
blocking for some unreasonable time...it's not really an error, but it
will alert you of a buffer underrun. It's safe to just call Sound_Decode()
again to get more, but this gives you the opportunity to do other
processing.

It's possible that the OGG decoder is incorrectly reporting this when it
could fill the buffer more, and since playsound just calls Sound_Decode()
in a loop, we never noticed.

--ryan.





From khan1 at mail.ru  Sat Dec  7 16:55:45 2002
From: khan1 at mail.ru (vano)
Date: Sat, 7 Dec 2002 16:55:45 -0500
Subject: probs with sound_init
Message-ID: <72459056.20021207165545@mail.ru>

hello. ok, when i do sound_init() sdl gives me me this error: Passed a
NULL mutex. i've never used sdl threads and don't have time to learn
them, so i can't really tell what in the function causes probs (it is
a pretty small function and it sux that i'm not good at sdl). any
ideas about what can cause that?




From icculus at clutteredmind.org  Sat Dec  7 17:23:51 2002
From: icculus at clutteredmind.org (Ryan C. Gordon)
Date: Sat, 7 Dec 2002 17:23:51 -0500 (EST)
Subject: [sdlsound] probs with sound_init
In-Reply-To: <72459056.20021207165545@mail.ru>
Message-ID: <Pine.LNX.4.33.0212071723050.8076-100000@gemini.verizon.net>


> hello. ok, when i do sound_init() sdl gives me me this error: Passed a
> NULL mutex. i've never used sdl threads and don't have time to learn
> them, so i can't really tell what in the function causes probs (it is
> a pretty small function and it sux that i'm not good at sdl). any
> ideas about what can cause that?

Sound_Init() does that, or SDL_Init() does that? I don't see anywhere
where Sound_Init() could return an error with that message.

--ryan.





From ewing2121 at yahoo.com  Sun Dec  8 00:25:15 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Sat, 7 Dec 2002 21:25:15 -0800 (PST)
Subject: [sdlsound] probs with sound_init
In-Reply-To: <72459056.20021207165545@mail.ru>
Message-ID: <20021208052515.36757.qmail@web20701.mail.yahoo.com>

Hello. Out of a strange coincidence, at the same
moment I read your email, I got the exact same error
message: Passed a NULL mutex. Spooky.

Are you using things like SDL_PollEvent to grab
keyboard strokes? If so, make sure you init SDL with
INIT_VIDEO and use SDL_SetVideoMode. It looks like SDL
can only grab events from a SDL created focus. This
cleared up my problem and had nothing to do with
SDL_sound.

-Eric

--- vano <khan1 at mail.ru> wrote:
> hello. ok, when i do sound_init() sdl gives me me
> this error: Passed a
> NULL mutex. i've never used sdl threads and don't
> have time to learn
> them, so i can't really tell what in the function
> causes probs (it is
> a pretty small function and it sux that i'm not good
> at sdl). any
> ideas about what can cause that?
> 
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From ewing2121 at yahoo.com  Sun Dec  8 00:52:50 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Sat, 7 Dec 2002 21:52:50 -0800 (PST)
Subject: [sdlsound] need help putting it all together (sdl_sound,sdl_m ixer,physfs)
In-Reply-To: <Pine.LNX.4.33L2.0212051453080.12844-100000@gamehenge.icculus.org>
Message-ID: <20021208055250.40043.qmail@web20708.mail.yahoo.com>

> It's possible that the OGG decoder is incorrectly
> reporting this when it
> could fill the buffer more, and since playsound just
> calls Sound_Decode()
> in a loop, we never noticed.

Thanks for the info. I tracked down the problem and it
is in the decoder. Apparently, according to the Vorbis
documentation, ov_read() will only return up to one
decoded packet at a time which is almost always less
than the amount of data you request.

I have fixed this issue. Would you like me to send you
a patch? 

Also, I added the quick fix that Torbj?rn Andersson
suggested about the problem with the MikMod
double-initialization infinite loop. It seems to work
now as I can get SDL_mixer and SDL_sound to work
together while still having Mikmod compiled in both. 

One interesting tidbit though, if Mods are played both
through SDL_mixer (native) and SDL_sound (decoded by
and passed raw to mixer) and at the same time, all but
one stop playing and the remaining one plays at a very
fast speed. Then the cutoff mod seems to restart at
normal speed after the other finishes. Quite strange.

Thanks,
Eric









__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From khan1 at mail.ru  Sun Dec  8 12:16:46 2002
From: khan1 at mail.ru (vano)
Date: Sun, 8 Dec 2002 12:16:46 -0500
Subject: [sdlsound] probs with sound_init
In-Reply-To: <Pine.LNX.4.33.0212071723050.8076-100000@gemini.verizon.net>
References: <Pine.LNX.4.33.0212071723050.8076-100000@gemini.verizon.net>
Message-ID: <1035598670.20021208121646@mail.ru>

damn, damn, damn. sorry guys, that's not what gives me the error. i'm
really sorry for posting junk.
anyway this is it : sample = Sound_NewSampleFromFile("shine.ogg", 0, buff);
after this i get the error.
Ryan, i'm not using any events or anything, as a matter of fact i'm
not using ANY sdl functions other than the ones that initialize and
close sdl.




From icculus at clutteredmind.org  Sun Dec  8 12:21:21 2002
From: icculus at clutteredmind.org (Ryan C. Gordon)
Date: Sun, 8 Dec 2002 12:21:21 -0500 (EST)
Subject: [sdlsound] need help putting it all together (sdl_sound,sdl_m
 ixer,physfs)
In-Reply-To: <20021208055250.40043.qmail@web20708.mail.yahoo.com>
Message-ID: <Pine.LNX.4.33L2.0212081219010.16087-100000@gamehenge.icculus.org>


> I have fixed this issue. Would you like me to send you
> a patch?

Very much so; thank you!

> Also, I added the quick fix that Torbj?rn Andersson
> suggested about the problem with the MikMod
> double-initialization infinite loop. It seems to work
> now as I can get SDL_mixer and SDL_sound to work
> together while still having Mikmod compiled in both.
>
> One interesting tidbit though, if Mods are played both
> through SDL_mixer (native) and SDL_sound (decoded by
> and passed raw to mixer) and at the same time, all but
> one stop playing and the remaining one plays at a very
> fast speed. Then the cutoff mod seems to restart at
> normal speed after the other finishes. Quite strange.

MikMod keeps a bunch of global state, such as sample rate of the output
buffer. SDL_sound sets this, and no doubt so will SDL_mixer. If they don't
match, things will break. There's no good way to fix this short of making
sure everything matches and praying, or using one or the other.

When I rewrite SDL_mixer, it will use SDL_sound as a backend for all
decoding, which will fix this, but I've been promising this forever.

--ryan.





From icculus at clutteredmind.org  Sun Dec  8 12:23:30 2002
From: icculus at clutteredmind.org (Ryan C. Gordon)
Date: Sun, 8 Dec 2002 12:23:30 -0500 (EST)
Subject: [sdlsound] probs with sound_init
In-Reply-To: <1035598670.20021208121646@mail.ru>
Message-ID: <Pine.LNX.4.33L2.0212081222280.16087-100000@gamehenge.icculus.org>


> damn, damn, damn. sorry guys, that's not what gives me the error. i'm
> really sorry for posting junk.
> anyway this is it : sample = Sound_NewSampleFromFile("shine.ogg", 0, buff);
> after this i get the error.
> Ryan, i'm not using any events or anything, as a matter of fact i'm
> not using ANY sdl functions other than the ones that initialize and
> close sdl.

Any chance I can see the source code to your program? It makes tracing
this easier.

Also make sure you're using SDL_sound 1.0.0 (not an older version), and
that you've got a relatively recent SDL (1.2.5 is a good idea), to make
sure it's not a bug we've already fixed.

--ryan.





From khan1 at mail.ru  Sun Dec  8 12:26:56 2002
From: khan1 at mail.ru (vano)
Date: Sun, 8 Dec 2002 12:26:56 -0500
Subject: [sdlsound] probs with sound_init
In-Reply-To: <Pine.LNX.4.33L2.0212081222280.16087-100000@gamehenge.icculus.org>
References: <Pine.LNX.4.33L2.0212081222280.16087-100000@gamehenge.icculus.org>
Message-ID: <1096208871.20021208122656@mail.ru>

the code is
        SDL_Init(SDL_INIT_AUDIO);
        Sound_Init();

        int buff = 4096;

        Sound_Sample *sample;
        sample = Sound_NewSampleFromFile("shine.ogg", 0, buff);
        text->AppendText(wxString(SDL_GetError())+"\n");

I've got all libs up-to-date




From icculus at clutteredmind.org  Sun Dec  8 14:03:20 2002
From: icculus at clutteredmind.org (Ryan C. Gordon)
Date: Sun, 8 Dec 2002 14:03:20 -0500 (EST)
Subject: [sdlsound] probs with sound_init
In-Reply-To: <1096208871.20021208122656@mail.ru>
Message-ID: <Pine.LNX.4.33L2.0212081402360.2318-100000@gamehenge.icculus.org>


>         SDL_Init(SDL_INIT_AUDIO);
>         Sound_Init();

Please check the return values from SDL_Init() and Sound_Init()...it's
possible one or both are failing, which will cause problems later.

--ryan.





From khan1 at mail.ru  Sun Dec  8 14:18:06 2002
From: khan1 at mail.ru (vano)
Date: Sun, 8 Dec 2002 14:18:06 -0500
Subject: [sdlsound] probs with sound_init
In-Reply-To: <Pine.LNX.4.33L2.0212081402360.2318-100000@gamehenge.icculus.org>
References: <Pine.LNX.4.33L2.0212081402360.2318-100000@gamehenge.icculus.org>
Message-ID: <1212879659.20021208141806@mail.ru>

>Please check the return values from SDL_Init() and Sound_Init()...it's
>possible one or both are failing, which will cause problems later.

SDL_Init() returns 0, and Sound_Init() returns a nonzero value, so
everything alright. maybe it's the fact that i'm using wxwindows?
anyway, i'll try it without the wx sometime today.




From ewing2121 at yahoo.com  Thu Dec 12 00:36:13 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Wed, 11 Dec 2002 21:36:13 -0800 (PST)
Subject: Problems with Rewind and seek
In-Reply-To: <Pine.LNX.4.33L2.0212051453080.12844-100000@gamehenge.icculus.org>
Message-ID: <20021212053613.58305.qmail@web20706.mail.yahoo.com>

I'm trying to use the Seek and Rewind functions, but
I'm having some problems.

For rewind, my problem seems to be specifically with
MP3's. When I start playing an MP3, I can successfully
call the rewind function and it will start over.
However, if the MP3 file finishes (hits EOF), then I
can no longer get SDL_Sound to rewind it for me. The
rewind function itself does not return any error. But
when I call Sound_Decode() right after, I get 0 bytes
decoded and the sample->flags say I'm at EOF.

So far, I've only gotten this behavior with MP3s. Has
anybody else experienced this problem, or know what
the problem might be?

For seek, I was wondering if it's possible to use seek
after you've already predecoded the the sample. I have
not had any success with this. After the sample has
been predecoded with Sound_DecodeAll, I try calling
seek, and then try calling Sound_DecodeAll (again),
but this second time, I get 0 bytes decoded. I've
tried forcing the issue, by still accessing old
sample->buffer (which was valid before the Seek
operation), but it usually results in a crash or
garbage playback.

Thanks,
Eric









__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From icculus at clutteredmind.org  Thu Dec 12 04:37:17 2002
From: icculus at clutteredmind.org (Ryan C. Gordon)
Date: Thu, 12 Dec 2002 04:37:17 -0500 (EST)
Subject: [sdlsound] Problems with Rewind and seek
In-Reply-To: <20021212053613.58305.qmail@web20706.mail.yahoo.com>
Message-ID: <Pine.LNX.4.33L2.0212120429560.24290-100000@gamehenge.icculus.org>


> So far, I've only gotten this behavior with MP3s. Has
> anybody else experienced this problem, or know what
> the problem might be?

Can you run "playsound --decoders" and see what MP3 decoder is lissted
first? I need to know if this is SMPEG or mpglib.

> For seek, I was wondering if it's possible to use seek
> after you've already predecoded the the sample. I have
> not had any success with this. After the sample has

Don't use anything (except Sound_FreeSample()) on a DecodeAll()'d
sample.

Once you've got such a sample, you can manage all the stuff yourself:
"rewinding"  and "seeking" become a matter of repositioning a memory
pointer.

Trying to further decode a DecodeAll()'d sample should return EOF. Seek
and rewind should probably return an error without changing the sample's
state (and it's probably a bug if they don't).

--ryan.





From ewing2121 at yahoo.com  Thu Dec 12 05:22:12 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Thu, 12 Dec 2002 02:22:12 -0800 (PST)
Subject: [sdlsound] Problems with Rewind and seek
In-Reply-To: <Pine.LNX.4.33L2.0212120429560.24290-100000@gamehenge.icculus.org>
Message-ID: <20021212102213.15853.qmail@web20707.mail.yahoo.com>

> Can you run "playsound --decoders" and see what MP3
> decoder is lissted
> first? I need to know if this is SMPEG or mpglib.

The SMPEG library is listed first.

> Don't use anything (except Sound_FreeSample()) on a
> DecodeAll()'d
> sample.
> 
> Once you've got such a sample, you can manage all
> the stuff yourself:
> "rewinding"  and "seeking" become a matter of
> repositioning a memory
> pointer.

On a semirelated note, is there a way to get the total
playing time from files that aren't predecoded? I see
in some of the source code (like Ogg), you retrieve
this information for debugging purposes. Is this data
accessable anywhere else? It would be really useful to
have, even if not all files cannot provide it.


> Trying to further decode a DecodeAll()'d sample
> should return EOF. Seek
> and rewind should probably return an error without
> changing the sample's
> state (and it's probably a bug if they don't).
>

It seems that for Seek with DecodeAll()'d, I rarly get
an error. I've only gotten the message on one of my
ogg files (I/O error), but most of my other oggs don't
trigger any error. Wav's and MP3's also don't trigger
anything. Mod files did trigger an error, but I think
they are unseekable no matter what because they also
triggered an error with regular Decode()/Seek().


Thank you for your help,
Eric


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From ewing2121 at yahoo.com  Fri Dec 13 23:31:52 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Fri, 13 Dec 2002 20:31:52 -0800 (PST)
Subject: [sdlsound] Problems with Rewind and seek
In-Reply-To: <Pine.LNX.4.33L2.0212120429560.24290-100000@gamehenge.icculus.org>
Message-ID: <20021214043152.90869.qmail@web20707.mail.yahoo.com>

Hello, I did a little bit more testing. The problem
seems to only effect SMPEG. Mpglib works fine. I was
able to reproduce the problem by adding rewind and
decode at the end of the playsound demo.

Any ideas of what might be causing this in the SMPEG
branch? 

Thanks,
Eric

--- "Ryan C. Gordon" <icculus at clutteredmind.org>
wrote:
> 
> > So far, I've only gotten this behavior with MP3s.
> Has
> > anybody else experienced this problem, or know
> what
> > the problem might be?
> 
> Can you run "playsound --decoders" and see what MP3
> decoder is lissted
> first? I need to know if this is SMPEG or mpglib.
> 

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From icculus at clutteredmind.org  Sat Dec 21 06:39:34 2002
From: icculus at clutteredmind.org (Ryan C. Gordon)
Date: Sat, 21 Dec 2002 06:39:34 -0500 (EST)
Subject: Ogg and Mikmod fixes...
Message-ID: <Pine.LNX.4.33.0212210638580.27184-100000@wickedsick.verizon.net>


...are in CVS. Better late than never. Thanks to Eric for putting the
patches together.

--ryan.





From ewing2121 at yahoo.com  Mon Dec 23 13:34:50 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Mon, 23 Dec 2002 10:34:50 -0800 (PST)
Subject: Timidity in Windows
In-Reply-To: <Pine.LNX.4.33L2.0212081222280.16087-100000@gamehenge.icculus.org>
Message-ID: <20021223183450.38896.qmail@web20708.mail.yahoo.com>

Hi, has anybody successfully played a midi file
through SDL_sound in Windows? I've been working on
updating the Project file trying to get it to build
with the latest fixes, and I just realized that even
though everything compiles including the Timidity
stuff and SOUND_SUPPORTS_MIDI is defined, Timidity is
not actually showing up as an available decoder
through playsound (and I cannot play MIDIs).

Thanks,
Eric


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From tsm at accesscomm.ca  Tue Dec 24 16:47:53 2002
From: tsm at accesscomm.ca (Corona688)
Date: Tue, 24 Dec 2002 15:47:53 -0600
Subject: [sdlsound] Timidity in Windows
References: <20021223183450.38896.qmail@web20708.mail.yahoo.com>
Message-ID: <3E08D609.B190FC16@accesscomm.ca>

Eric Wing wrote:

> Hi, has anybody successfully played a midi file
> through SDL_sound in Windows? I've been working on
> updating the Project file trying to get it to build
> with the latest fixes, and I just realized that even
> though everything compiles including the Timidity
> stuff and SOUND_SUPPORTS_MIDI is defined, Timidity is
> not actually showing up as an available decoder
> through playsound (and I cannot play MIDIs).
>
> Thanks,
> Eric

I have.  Are you sure you're defining SOUND_SUPPORTS_MIDI for *all*
builds?  You might just be defining it for the debug build or something.

Happy Holidays,
Tyler Montbriand



From ewing2121 at yahoo.com  Tue Dec 24 19:16:37 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Tue, 24 Dec 2002 16:16:37 -0800 (PST)
Subject: [sdlsound] Timidity in Windows
In-Reply-To: <3E08D609.B190FC16@accesscomm.ca>
Message-ID: <20021225001637.1049.qmail@web20702.mail.yahoo.com>

Hi, thanks for responding!
I make that mistake a lot, but this time I made sure
that I declared it for all projects, so that's not the
problem. And I see the Timidity code compile during
build which I don't think would happen if I forgot the
flag, right?

Are there any external libraries that I need to have
on my system specifically for Timidity? For some of
the others, if I lack a library, I get an error during
linking, or a DLL complaint at runtime, but I've
gotten neither of these issues.

Thanks,
Eric



--- Corona688 <tsm at accesscomm.ca> wrote:
> Eric Wing wrote:
> 
> > Hi, has anybody successfully played a midi file
> > through SDL_sound in Windows? I've been working on
> > updating the Project file trying to get it to
> build
> > with the latest fixes, and I just realized that
> even
> > though everything compiles including the Timidity
> > stuff and SOUND_SUPPORTS_MIDI is defined, Timidity
> is
> > not actually showing up as an available decoder
> > through playsound (and I cannot play MIDIs).
> >
> > Thanks,
> > Eric
> 
> I have.  Are you sure you're defining
> SOUND_SUPPORTS_MIDI for *all*
> builds?  You might just be defining it for the debug
> build or something.
> 
> Happy Holidays,
> Tyler Montbriand
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From ewing2121 at yahoo.com  Fri Dec 27 17:01:00 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Fri, 27 Dec 2002 14:01:00 -0800 (PST)
Subject: [sdlsound] Timidity in Windows
In-Reply-To: <20021225001637.1049.qmail@web20702.mail.yahoo.com>
Message-ID: <20021227220100.26358.qmail@web20706.mail.yahoo.com>

I figured it out...Stupid me. I forgot that I never
installed Timidity with the current version of Windows
that I'm running. I guess SDL_sound was silently
failing on the loading of the timidity.cfg file and
just ignored it as a possible driver.

Thanks,
Eric

--- Eric Wing <ewing2121 at yahoo.com> wrote:
> Hi, thanks for responding!
> I make that mistake a lot, but this time I made sure
> that I declared it for all projects, so that's not
> the
> problem. And I see the Timidity code compile during
> build which I don't think would happen if I forgot
> the
> flag, right?
> 
> Are there any external libraries that I need to have
> on my system specifically for Timidity? For some of
> the others, if I lack a library, I get an error
> during
> linking, or a DLL complaint at runtime, but I've
> gotten neither of these issues.
> 
> Thanks,
> Eric
> 

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


From ewing2121 at yahoo.com  Fri Dec 27 17:01:04 2002
From: ewing2121 at yahoo.com (Eric Wing)
Date: Fri, 27 Dec 2002 14:01:04 -0800 (PST)
Subject: [sdlsound] Timidity in Windows
In-Reply-To: <20021225001637.1049.qmail@web20702.mail.yahoo.com>
Message-ID: <20021227220104.55001.qmail@web20710.mail.yahoo.com>

I figured it out...Stupid me. I forgot that I never
installed Timidity with the current version of Windows
that I'm running. I guess SDL_sound was silently
failing on the loading of the timidity.cfg file and
just ignored it as a possible driver.

Thanks,
Eric

--- Eric Wing <ewing2121 at yahoo.com> wrote:
> Hi, thanks for responding!
> I make that mistake a lot, but this time I made sure
> that I declared it for all projects, so that's not
> the
> problem. And I see the Timidity code compile during
> build which I don't think would happen if I forgot
> the
> flag, right?
> 
> Are there any external libraries that I need to have
> on my system specifically for Timidity? For some of
> the others, if I lack a library, I get an error
> during
> linking, or a DLL complaint at runtime, but I've
> gotten neither of these issues.
> 
> Thanks,
> Eric
> 

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


