Re: [NTLK] MadMax and >22kHz files, threading..

From: Eckhart Koeppen (eck1000_at_gmx.net)
Date: Mon Mar 18 2002 - 14:25:45 EST


Jim Witte wrote:
> I installed three files on an external card (all 48kbps, no VBR,
> 32kHz), and found that Mad Max doesn't want to play files encoded over
> 22kHz.

Currently, 22khz and 44khz are the only two sample rates supported. They
are hardcoded (see the simple "if" statement in Decode in MadNewton.cp),
but adding other rates should be fairly easy by either adding the
resampling code to the C layer or by letting the Newton do the resampling.

> Then I downloaded one of the files again encoded at 32kHz and it
> worked fine (as it had the day before).

32khz worked? Strange!

> Also, what thread does C++ code run in? Would it
> be possible to have it run preemptively with the NS thread, or to fork
> off the Mad Max player itself (or at least the code that stuffs the
> sound buffer) into a seperate NS thread?

The MAD Newton C code is called from NewtonScript, so it is technically
the same as running NewtonScript stuff. There are some callbacks in MAD
Max that get called whenever a sound frame has finished (only for file
playback, not for streams), but I figure that this is still cooperative
multitasking.

To be more precise, the file playback is more pull-like (a sound frame
that finished playing triggers the creating of the next sound frame)
while stream playback is push-like (every incoming data packet gets
decoded and played).

The C decoding stuff can be used in any threading or multitasking model,
it should be reentrant.

Eckhart

-- 
                   -- eck_at_40hz.org -- www.40hz.org --

-- Read the List FAQ/Etiquette: http://www.newtontalk.net/faq.html Read the Newton FAQ: http://www.guns-media.com/mirrors/newton/faq/ This is the NewtonTalk mailing list - http://www.newtontalk.net



This archive was generated by hypermail 2.1.2 : Tue Apr 02 2002 - 14:03:05 EST