From: Steve Ricketts on
I'm converting a VB6 application to VB.net. In the program it deals with
audio data, stored as a variant, and uses rightb, leftb, and midb. Since
there are no equivalents in VB.net for those functions, are there any
examples of how you do the same thing with a user function or anything else?

Thanks,

Steve

From: Armin Zingler on
Steve Ricketts schrieb:
> I'm converting a VB6 application to VB.net. In the program it deals with
> audio data, stored as a variant, and uses rightb, leftb, and midb. Since
> there are no equivalents in VB.net for those functions, are there any
> examples of how you do the same thing with a user function or anything else?


Do not use a String as a buffer for these operations. Probably an Array better
suits your needs.


--
Armin
From: Steve Ricketts on
Thanks for your response. So, you're recommending that I just use a byte
array in every location where I've had a variant and then process the byte
array as necessary?

One of the uses is in an event routine that's fired from a 3rd party ActiveX
control that returns a variant data type:

private sub AudCodec1_FrameEvent(byval eventSender as system.object, byval
eventArgs as axAVPhone3.__AudCodec_FrameEvent) handles AudCodec1.FrameEvent

'UPGRADE WARNING: Couldn't resolve default property of object Data
recAudio = eventArgs.data

If recAudio is a byte array, is VB.net going to yell at me if I put the
eventArgs.data into it?

Thanks again for the response!



"Armin Zingler" <az.nospam(a)freenet.de> wrote in message
news:OUzkaoBUKHA.4360(a)TK2MSFTNGP04.phx.gbl...
> Steve Ricketts schrieb:
>> I'm converting a VB6 application to VB.net. In the program it deals with
>> audio data, stored as a variant, and uses rightb, leftb, and midb. Since
>> there are no equivalents in VB.net for those functions, are there any
>> examples of how you do the same thing with a user function or anything
>> else?
>
>
> Do not use a String as a buffer for these operations. Probably an Array
> better
> suits your needs.
>
>
> --
> Armin

From: Armin Zingler on
Steve Ricketts schrieb:
> Thanks for your response. So, you're recommending that I just use a byte
> array in every location where I've had a variant and then process the byte
> array as necessary?

Depends on the data you are processing. Audio data often fits into an array of this structure:

structure Sample
public left as short
public right as short
end structure


> One of the uses is in an event routine that's fired from a 3rd party ActiveX
> control that returns a variant data type:
>
> private sub AudCodec1_FrameEvent(byval eventSender as system.object, byval
> eventArgs as axAVPhone3.__AudCodec_FrameEvent) handles AudCodec1.FrameEvent
>
> 'UPGRADE WARNING: Couldn't resolve default property of object Data
> recAudio = eventArgs.data
>
> If recAudio is a byte array, is VB.net going to yell at me if I put the
> eventArgs.data into it?

As long as you don't turn Option Strict On, you are able to assign almost
everything to everything - but it can crash at runtime. But I suggest it's the
last thing to do after upgrading.

If you don't know the type of eventArgs.data you can try this:

dim o as object = eventargs.data
msgbox (o.gettype.fullname)

What does the msgbox say?



--
Armin

From: Steve Ricketts on
Basically, I've been processing the audio data (variant) as a sequence of
individual bytes.

sub AudCap1_Frame(vData as variant)
dim bt() as byte

bt = vData

So I just assumed a byte array would be a good replacement. Thanks for
putting up with dumb newbie questions.

sr

"Armin Zingler" <az.nospam(a)freenet.de> wrote in message
news:egviSjCUKHA.4360(a)TK2MSFTNGP04.phx.gbl...
> Steve Ricketts schrieb:
>> Thanks for your response. So, you're recommending that I just use a byte
>> array in every location where I've had a variant and then process the
>> byte
>> array as necessary?
>
> Depends on the data you are processing. Audio data often fits into an
> array of this structure:
>
> structure Sample
> public left as short
> public right as short
> end structure
>
>
>> One of the uses is in an event routine that's fired from a 3rd party
>> ActiveX
>> control that returns a variant data type:
>>
>> private sub AudCodec1_FrameEvent(byval eventSender as system.object,
>> byval
>> eventArgs as axAVPhone3.__AudCodec_FrameEvent) handles
>> AudCodec1.FrameEvent
>>
>> 'UPGRADE WARNING: Couldn't resolve default property of object Data
>> recAudio = eventArgs.data
>>
>> If recAudio is a byte array, is VB.net going to yell at me if I put the
>> eventArgs.data into it?
>
> As long as you don't turn Option Strict On, you are able to assign almost
> everything to everything - but it can crash at runtime. But I suggest it's
> the
> last thing to do after upgrading.
>
> If you don't know the type of eventArgs.data you can try this:
>
> dim o as object = eventargs.data
> msgbox (o.gettype.fullname)
>
> What does the msgbox say?
>
>
>
> --
> Armin
>