GetAttribute() using #SAMPLE and #ATTRPOSITION

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

GetAttribute() using #SAMPLE and #ATTRPOSITION

Post by evil » Sat May 04, 2019 2:51 pm

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: 3075
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: GetAttribute() using #SAMPLE and #ATTRPOSITION

Post by airsoftsoftwair » Sat May 04, 2019 7:23 pm

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: 129
Joined: Mon Jun 14, 2010 1:38 pm

Re: GetAttribute() using #SAMPLE and #ATTRPOSITION

Post by evil » Sun May 05, 2019 12:40 pm

Yes, that helps. Thanks!

User avatar
airsoftsoftwair
Posts: 3075
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: GetAttribute() using #SAMPLE and #ATTRPOSITION

Post by airsoftsoftwair » Tue May 28, 2019 5:46 pm

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