BBC BASIC for Windows
« Using variables in SOUND command »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:24pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Using variables in SOUND command  (Read 1095 times)
cinningbao
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Using variables in SOUND command
« Thread started 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 smiley
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Using variables in SOUND command
« Reply #1 on: May 14th, 2010, 9:36pm »

on May 14th, 2010, 6:11pm, cinningbao wrote:
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.
User IP Logged

cinningbao
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Re: Using variables in SOUND command
« Reply #2 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!

Cheers smiley
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls