## Data property of TWave has gone?

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

### Data property of TWave has gone?

Hello,

I suppose that it was your deliberate decision to remove it, but it breaks my code written years ago.

What I can write instead of the following where wv1 and wv2 are TWave?
Code: Select all
Move(wv2.Data^, w1^, wv2.DataSize);

Best,
stfine
stfine
Active Member

Posts: 12
Joined: August 1st, 2006, 7:00 am

### Re: Data property of TWave has gone?

In the older versions of WaveAudio, TWave was a TMemoryStream but now TWave is a TWaveStreamAdapter.

TWaveStreamAdapter is not a stream but provides a wrapper around any kind of stream to access or modify the wave data. In this case, TWave is a special kind of TWaveStreamAdapter that manipulates a TMemoryStream in behind.

Here is a way to have your old code:

Code: Select all
Move(Pointer(DWORD(TMemoryStream(Wave.Stream).Memory) + Wave.DataOffset)^, w1^, Wave.DataSize);

but it's recommended to use the following code instead:

Code: Select all
if Wave.BeginRead thenbegin  Wave.Read(w1^, Wave.DataSize);  Wave.EndRead;end;
Kambiz

Kambiz

Posts: 2428
Joined: March 7th, 2003, 7:10 pm

### Re: Data property of TWave has gone?

nice, thanks
stfine
Active Member

Posts: 12
Joined: August 1st, 2006, 7:00 am

### Re: Data property of TWave has gone?

I forgot to mention that if you want to make a copy of a TWave (or genrally TWaveStreamAdapter) instance, you can simply use the Assign method of the target or the AssignTo method of the source.

Code: Select all
SrcWave.AssignTo(DstWave);ORDstWave.Assign(SrcWave);
Kambiz

Kambiz