Results 1 to 5 of 5

Thread: [RESOLVED] Use of variables in Activex8 sound API to set Constants.

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    403

    Resolved [RESOLVED] Use of variables in Activex8 sound API to set Constants.

    I am trying to write code using the ActiveX8 reference to generate short bursts of sound through my speaker at a FREQ(in Hz) and for a dur(ation) (in secs.). Parameters are specified at Option Explicit as constants.

    The routine works 100% if I write code which specifies these parameters : eg.

    Const FREQ = 500 'means 500 Hz
    Const dur = 0.2 'means 200 milliseconds

    So far, so good. But now I wish to have the VB6 program vary these parameters. For example, I would like to dim an integer variable named MYFREQ and be able to write Const FREQ = MYFREQ. However this fails. I get the error message "Assignment to Constant not permitted".

    How can I reset, in software, the value of an API Const to the instantaneous value of a variable? Does the variable need to be Dim'd as a special type? How to assign a new value to a Constant in software?

    Suggestions gratefully requested.

    camoore

    Wales
    UK
    Last edited by camoore; Oct 25th, 2011 at 09:03 AM. Reason: some more info added.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width