Forums > Javascript

creating a buffer~ object in javascript

January 17, 2008 | 6:31 pm

Hi,

I created a buffer in a patcher, called buf, which I’d like to manipulate in a jsui. I am not sure of the syntax I should use. Can anyone point me what I’m doing wrong in what follows?

var _buf= new Maxobj("buffer~", "buf");

_buf.message("clear"); // here I’d like to clear the buffer. I assumed that doing _buf.clear() would work but I had an error

_buf.channel = 1;

for (var i = 0 ; i < 100 ; i++)
_buf[i] = -1; // my buffer has 4 channels, I want to write data in the first channel from my jsui file

Thanks

jean-Baptiste


January 21, 2008 | 3:48 pm

Can’t create a buffer~ in JS. :(

No MSP.

b

On Jan 17, 2008, at 10:31 AM, Jean-Baptiste Thiebaut wrote:

>
> Hi,
>
> I created a buffer in a patcher, called buf, which I’d like to
> manipulate in a jsui. I am not sure of the syntax I should use. Can
> anyone point me what I’m doing wrong in what follows?
>
> var _buf= new Maxobj("buffer~", "buf");
>
>
> _buf.message("clear"); // here I’d like to clear the buffer. I
> assumed that doing _buf.clear() would work but I had an error
>
> _buf.channel = 1;
>
> for (var i = 0 ; i < 100 ; i++)
> _buf[i] = -1; // my buffer has 4 channels, I want to write data in
> the first channel from my jsui file
>
> Thanks
>
> jean-Baptiste


Barry Threw
Media Art and Technology

San Francisco, CA
Work: 857-544-3967
Email: bthrew (at) gmail (dot) com
IM: captogreadmore (AIM)

http://www.barrythrew.com

"The greatest of the changes that science has brought us is the acuity
of change; the greatest novelty the extent of novelty."
- J. Robert Oppenheimer


January 21, 2008 | 4:02 pm

Thanks Barry.

C74 devs, any chance that we could manipulate MSP objects with JS?

best
JB


January 22, 2008 | 12:06 am

On 21 janv. 08, at 17:02, Jean-Baptiste Thiebaut wrote:

> Thanks Barry.
>
> C74 devs, any chance that we could manipulate MSP objects with JS?

In the meantime, you can use java do achieve that. It’s almost as
simple as JS for those kinda things. Have a look to the buf.Op object,
or to the lists objects in the ejies if you want some examples.

Cheers,
ej


Viewing 4 posts - 1 through 4 (of 4 total)