BBC BASIC for Windows
Programming >> Sound, Music and Video >> Using variables in SOUND command http://bb4w.conforums.com/index.cgi?board=multimedia&action=display&num=1273860674 Using variables in SOUND command
Post by cinningbao on May 14th, 2010, 6:11pm
hi,
I've got an actual BBC master, but I can't believe the language is much different!.. Anyway, I'm trying to build a program which allows me to manipulate the SOUND and ENVELOPE parameters individually, and save presets.. that kind of thing. But I noticed I need to also send &11 and &1010 to the channel parameter, along with other non-numeric values, which can't be done with the single C numeric variable I'm using. So, I change the C value to C$, but now the SOUND command complains of a 'Type Mismatch'. eg SOUND C$,1,100,200.
How to I program my way around this?
Many thanks Re: Using variables in SOUND command
Post by admin on May 14th, 2010, 9:36pm
I need to also send &11 and &1010 to the channel parameter, along with other non-numeric values, which can't be done with the single C numeric variable I'm using.
Why not? You could define a number of constants such as:
Code:
channel = 1
flush = &10
hold = &1000
then you can build your variable C by combining them as required:
Code:
C = channel + flush + hold
SOUND C,1,100,200
Quote:
So, I change the C value to C$, but now the SOUND command complains of a 'Type Mismatch'
Using a string variable seems unnecessarily complicated to me, but if that's the way you want to do it you can convert the string to a numeric using EVAL:
Code:
C$ = "&1011"
C = EVAL(C$)
SOUND C,1,100,200
Richard. Re: Using variables in SOUND command
Post by cinningbao on May 16th, 2010, 2:19pm
Hi Richard,
Thanks for your reply - I went wrong thinking that a string variable was required for anything but numerical values (including the ampersand); I'll now be able to finish what I started!