GetAttribute() using #SAMPLE and #ATTRPOSITION

Discuss any general programming issues here
Post Reply
evil
Posts: 177
Joined: Mon Jun 14, 2010 1:38 pm

GetAttribute() using #SAMPLE and #ATTRPOSITION

Post by evil »

Hello!

I need to get the actual Sampleposition, while playing it.
So I use GetAttribute(#SAMPLE,id,#ATTRPOSITION) to get that value.

On OS3 (Amithlon) everything works fine, but on OS4 I get very nasty values.
In the following Code I get values around -1151680034, while the #DURATION-Attribute gives me a samplelenght of 2282 ms.

Whats the problem here??

Example Code:

Code: Select all

Function p_showduration()
	DebugPrint(GetAttribute(#SAMPLE,1,#ATTRDURATION),GetAttribute(#SAMPLE,1,#ATTRPOSITION))
EndFunction

smpdata = {}
slen = 200

For k = 0 To 30
	For i = 0 To (slen\2)-1
		smpdata[k*slen+i] = -128
		smpdata[k*slen+i+(slen\2)] = 127
	Next
Next

CreateSample(1, smpdata, 6982)
PlaySample(1)
SetInterval(1,p_showduration,40)

While IsSamplePlaying(1)
	waitevent()
wend
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: GetAttribute() using #SAMPLE and #ATTRPOSITION

Post by airsoftsoftwair »

Looks like a bug. As a workaround, you can try to activate legacy audio and it should work, i.e.

Code: Select all

1> Hollywood test.hws -legacyaudio
evil
Posts: 177
Joined: Mon Jun 14, 2010 1:38 pm

Re: GetAttribute() using #SAMPLE and #ATTRPOSITION

Post by evil »

Yes, that helps. Thanks!
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: GetAttribute() using #SAMPLE and #ATTRPOSITION

Post by airsoftsoftwair »

Code: Select all

- Fix [Amiga]: #ATTRPOSITION for #SAMPLE didn't return correct values with the new audio driver that
  was introduced with Hollywood 6.0
Post Reply