|
From: Kevin N. <bea...@ya...> - 2005-02-11 12:02:13
|
I disabled all of the status updates the server was
printing out. Here's the snippit of code I was given:
const char *fname = p.string().c_str();
Sound_Sample * sample = Sound_NewSampleFromFile
(fname, NULL,
1024*64);
if (!sample) {
cerr << "Error opening " << fname << ": " <<
Sound_GetError();
return;
}
do {
Uint32 br = Sound_Decode(sample);
if (br > 0) // write this block of decoded data
to stdout.
cout.write((const char *) sample->buffer,
sample->buffer_size);
if (sample->flags & SOUND_SAMPLEFLAG_ERROR) {
cerr << "Error decoding " << fname << ": "
<<
Sound_GetError();
break;
}
} while (sound->flags & SOUND_SAMPLEFLAG_EOF);
Sound_FreeSample(sample);
I believe the line "sound->flags" is supposed to be
sample->flags.
I'm also wondering if this needs to be in a loop. The
NewSampleFromFile function may only be returning part
of the file.
I'll experiment and I guess I'll probably write back
to the list explaining that a stream to my audio
device doesn't work, unless you come up with any
ideas.
Kevin
--- Tim Nowaczyk <zi...@cs...> wrote:
> On Thu, Feb 10, 2005 at 05:46:01PM -0800, Kevin
> Nowaczyk wrote:
> > A person on the SDL_sound gave me some code out
> decode
> > and output an audio stream to stdout.
> >
> Cool!
>
> > When I compile and run it as ./tjukeboxd >>
> /dev/dsp and queue up a
> > song I just get noise for about 10-20 seconds. Do
> you think I should
> > be hearing the song, or do I need something to
> take this stream and
> > feed it to the soundcard at the proper rate?
> >
> It should be working. Is the daemon still outputing
> "Ready to Accept
> connections"?
>
> Tim
>
> --
> "As I hammered in the last bolt and staggered over
> the rim, it was not at all
> clear to me who was conqueror and who was conquered.
> I do recall that El Cap
> seemed to be in much better condition than I was"
> -- Warren Harding
>
> ----------Tim
>
Now...@cs...--------------------
> GPG Fingerprint: 5AC1 1E3C 611F BE19 6725 A3B1 6AFF
> E4CD D40A 039B
>
>
>
-------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT
> Products from real users.
> Discover which products truly live up to the hype.
> Start reading now.
>
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Tjukebox-general mailing list
> Tju...@li...
>
https://lists.sourceforge.net/lists/listinfo/tjukebox-general
>
=====
Manage your PEZ collection online. Visit PezBase at http://pezbase.beakerboy.com
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|