Hey,

As far as i know, in most versions of JACK, DEFAULT_AUDIO_TYPE is float (32
bit).
So I've been casting to (float*), which doesnt segfault. That's not to say
that it wont
on other peoples computers...

Casting to DEF_AUDIO is a better idea.. Ill test it later when I'm at
programming. :-)

Thanks for the replies. -Harry

On Fri, Jul 2, 2010 at 9:16 AM, alberto colombo <v...@albx79.it> wrote:

> I've used get_buffer only for MIDI, so far, so I'm not sure how it'd
> work on raw audio ports.
>
> With MIDI ports, you use it like this:
>
>        void *port_buffer = midi_in.get_buffer(nframes);
>        NFrames count = Midi.get_event_count(port_buffer);
>
>        for (NFrames i=0; i<count; ++i)
>        {
>            Midi.Event e;
>            Midi.Event.get(out e, port_buffer, i);
>            ...
>
> I guess, for audio, you'd have to cast void* get_buffer to
> DefaultAudioSample, something like this (untested!):
>
> DefaultAudioSample* buffer =
> (DefaultAudioSample*)master_l.get_buffer(nframes);
>
> Let me know if it works.
> alb
>
>
> On Wed, 2010-06-30 at 14:26 +0100, Harry Van Haaren wrote:
> > Hey All,
> >
> > I've got a function in the JACK.vapi binding, that returns a buffer. Now
> it
> > doesnt "physically"
> > return the buffer, but returns a  void*  to the buffer.
> >
> > I checked the Vala tutorial for any references to void*, and didnt find
> > anything...
> >
> > This is the function (to be called on a Port object):
> > public void* get_buffer(NFrames nframes);         // nframes is a
> uint32..
> > not that it matters
> >
> > And this is what I tried (master_l is of Port type):
> > var buffer = master_l.get_buffer(nframes);
> >
> > And what I want to do with this buffer is the following:
> >     for(int i = 0; i < (uint32) nframes; i++)
> >     {
> >         buffer[i] = array[i];   // have an array of samples, need to
> write
> > them to this void* buffer.
> >     }
> >
> > Any suggestions..? Thanks for reading, -Harry
> > _______________________________________________
> > vala-list mailing list
> > vala-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/vala-list
>
>
> _______________________________________________
> vala-list mailing list
> vala-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/vala-list
>
_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to