Search found 9 matches

by erion
Tue Mar 14, 2017 4:29 pm
Forum: Coding Questions
Topic: Error when setting array elements by a pointer
Replies: 1
Views: 2868

Error when setting array elements by a pointer

Hello,

The following SB code does not define the PB internal pointer properly:

Global i
Dim S.l(2)
Global *Sp = @S()

PokeL(*Sp, 0, 42)
PokeL(*Sp, 1, 1984)
PokeL(*Sp, 2, 2012)
For i = 0 To 2
debug s(i)
Next

Produces the error: TypeError: a.view is undefined

The slightly modified code in ...
by erion
Fri Mar 10, 2017 12:36 pm
Forum: Coding Questions
Topic: Passing an SB pointer to a JS function
Replies: 3
Views: 2884

Re: Passing an SB pointer to a JS function

Hi Fred,
Thank you very much. The irony of this is that I've tried this already, but now I spent a few hours trying to figure out why it still did not work.
Turns out that no matter what file I tried to load, it always read 6056440 bytes. I suspect that this was a caching issue somewhere.
Now I can ...
by erion
Thu Mar 09, 2017 6:53 pm
Forum: Coding Questions
Topic: Passing an SB pointer to a JS function
Replies: 3
Views: 2884

Re: Passing an SB pointer to a JS function

As a followup to this, SB pointers seem to be that of the ArrayBuffer type, however, even though a WebAudio context expects an ArrayBuffer, it is unable to decode when I am passing an SB pointer directly. I am not sure why. Could it be because SB adds a few elements to it, like DataView, viewu8, etc ...
by erion
Tue Mar 07, 2017 12:26 pm
Forum: Coding Questions
Topic: Passing an SB pointer to a JS function
Replies: 3
Views: 2884

Passing an SB pointer to a JS function

Hello,

I would like to load an encrypted sound, then later an entire databank into a WebAudio buffer, via the 'context.decodeAudioData' function.

At the moment, I'm using SB's ReadFile() and ReadData() functions to load a file, then decrypt the loaded buffer with the AES cypher. This works.

My ...
by erion
Sat Mar 04, 2017 1:19 pm
Forum: Feature Requests and Wishlists
Topic: Procedures are not compiled unless they are called from SB
Replies: 2
Views: 3173

Re: Procedures are not compiled unless they are called from

Hi Peter,
I thought so, but I really believe that this should be customisable. Interacting with third party libraries would be a lot easier. In Go, for example, declaring but not using a function is considered a compiler error. If SB has inline JS support, it should really scan for at least ...
by erion
Sat Mar 04, 2017 12:45 pm
Forum: Feature Requests and Wishlists
Topic: Procedures are not compiled unless they are called from SB
Replies: 2
Views: 3173

Procedures are not compiled unless they are called from SB

Hello,

As the subject says: if a procedure is not called directly from SB, it will not be compiled into JS code. Please see the following code:

Procedure ProcA()
!alert('Procedure A');
EndProcedure

Procedure ProcB()
!alert('Procedure B');
EndProcedure

! f_procb();

This produces a reference ...
by erion
Sat Mar 04, 2017 10:21 am
Forum: Coding Questions
Topic: Embedding the Sono WebAudio library
Replies: 4
Views: 3383

Re: Embedding the Sono WebAudio library

Peter,
You are wonderful, thank you very much!

For some reason, setting the sono object as a global variable's value does not work in 'main()', but your module works nicely. I will probably post the result in the Tips and Tricks forum.

Cheers,
Erion
by erion
Fri Mar 03, 2017 11:22 pm
Forum: Coding Questions
Topic: Embedding the Sono WebAudio library
Replies: 4
Views: 3383

Re: Embedding the Sono WebAudio library

Hello Peter,

Thank you very much for your solution, it works like a charm here as well.

Your solution is interesting, because I thought Sono returns an object on the window. Here, however, as far as I can see, you used 'require', which is commonly used for Node packages.

Please excuse my ...
by erion
Fri Mar 03, 2017 8:31 pm
Forum: Coding Questions
Topic: Embedding the Sono WebAudio library
Replies: 4
Views: 3383

Embedding the Sono WebAudio library

Hello,

I'm currently trying to embed the Sono webAudio library (https://github.com/Stinkstudios/sono), however I get a reference not found error in the web console, when running the application. The main sono object is not found.

Procedure.i HeaderInclude(filename.s)
Protected filetype.s ...