[futurebasic] Re: [FB] Sound Question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2004 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Mon, 1 Nov 2004 18:23:14 +1300
Walter Lenk wrote:

> Is it possible to have stereo 'snd' resources?
> Is it possible to construct them on the fly?
> Are there better ways of going about this?


Apple's header file Sound.h defines the following:

struct SoundParamBlock {
   long                recordSize;             /*size of this record in 
bytes*/
   SoundComponentData  desc;                   /*description of sound 
buffer*/
   UnsignedFixed       rateMultiplier;         /*rate multiplier to 
apply to sound*/
   short               leftVolume;             /*volumes to apply to 
sound*/
   short               rightVolume;
   long                quality;                /*quality to apply to 
sound*/
   ComponentInstance   filter;                 /*filter to apply to 
sound*/
   SoundParamUPP       moreRtn;                /*routine to call to get 
more data*/
   SoundParamUPP       completionRtn;          /*routine to call when 
buffer is complete*/
   long                refCon;                 /*user refcon*/
   short               result;                 /*result*/
};

typedef SoundParamBlock *               SoundParamBlockPtr;
typedef struct OpaqueSoundSource*       SoundSource;

extern ComponentResult
SoundComponentPlaySourceBuffer(
   ComponentInstance    ti,
   SoundSource          sourceID,
   SoundParamBlockPtr   pb,
   long                 actions);

from which it seems that a sound ComponentInstance can play a sound 
with arbitrary volume in right and left speakers.  Some work would be 
involved converting the definitions to FB, finding out how to load a 
sound ComponentInstance, getting a SoundInstance etc, but it looks like 
a plausible starting point.  Your hope would be to play two words at 
the same time, one with leftVolume = 0 and the other with rightVolume = 
0.

Robert P.