peck@ral.rpi.edu (Joseph Peck) (12/15/90)
Hello all. I have a quick question on how to correctly select an audio channel for playing a sound. Currently everything works; i.e. I allocate all 4 channels, and can play a sound on any given channel. However, I get warnings when I compile my program with lattice C. I select the channel with: AIOptr->ioa_Request.io_Unit = #; where # is either 1,2,3 or 4. I am assuming that I should be putting something other than just simple constants here, but the RKM's don't cover this too well. (I am sure that someone will probably disagree with me, but I really don't see it) The better part is that the RKM's refer to io_Unit as a bit field, while the header files seem to think that it is a pointer to a structure. Maybe I am just too tired to read it correctly..... So, can anyone give me a hand? Thanks, Joe Peck peck@ral.rpi.edu
ken@cbmvax.commodore.com (Ken Farinsky - CATS) (12/18/90)
In article <8GG^X6$@rpi.edu> peck@ral.rpi.edu (Joseph Peck) writes: > >...how to correctly select an audio channel for playing a sound. > >I get warnings when I compile my program...I select the channel with: > >AIOptr->ioa_Request.io_Unit = #; /* where # is either 1,2,3 or 4. */ > >Joe Peck peck@ral.rpi.edu I'm not the audio expert, but I'll try to answer your questions. Looking through the RKM (Libs&Devs) in the Audio Device section, I found: p610: You specify the channel that you want to use by setting the appropriate bits in the ioa_Request.io_Unit field... from p615, it looks like the bits are set up as follows: CHANNEL_0 (1<<0) CHANNEL_1 (1<<1) CHANNEL_2 (1<<2) CHANNEL_3 (1<<3) Also, from page 614: If the allocation succeeds, the audio device will return the channels that you now own in the lower four bits of the ioa_Request.io_Unit field...So I would guess that you don't use numbers like 1,2,3 or 4. So, even though the field is a pointer, you have to put bit values into it. Try something like: AIOptr->ioa_Request.io_Unit = (struct Unit *)(CHANNEL_0); Also, remember to mask out any unused bits when checking the value of this variable and to set unused bits to zero when setting this variable. -- -- Ken Farinsky - CATS - (215) 431-9421 - Commodore Business Machines uucp: ken@cbmvax.commodore.com or ...{uunet,rutgers}!cbmvax!ken bix: kfarinsky