You are not logged in.

vpr

Beginner

  • "vpr" is male
  • "vpr" started this thread

Posts: 30

Date of registration: May 21st 2014

  • Send private message

1

Thursday, April 6th 2017, 6:55pm

Beads Buffer Question

Hi, I've asked this before as part of another thread but didn't get a response, so I thought I'd bump it as it's still a frustration for me.

Basically, I'm using the Java Beads audio DSP library and trying to fill a custom buffer for use by the waveplayer object. There's an example of using a custom buffer on page 126 of this tutorial. Here's the source for the sinewave buffer.

We need to extend the abstract base class BufferFactoryand override generateBuffer to fill a custom buffer.

In my general declarations on Form1 I'm writing this:

Jabaco Source

1
2
3
4
5
Import beads#*
Dim BufferClass As New MyBuffer

Dim ac As New AudioContext
Dim wPlayer As New WavePlayer(ac, 440, BufferClass.generateBuffer(4096))



I'm creating a class called MyBuffer with the superclass beads/BufferFactory and in that class writing:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
Import beads#*
Public Function generateBuffer(bufferSize As Integer) As beads#buffer
Dim b As New Buffer(bufferSize)
For j = 0 To Ubound(b.buf)
b.buf(j) = Sin(2.0 * PI * j / bufferSize)
Next j
generateBuffer= b
End Function

Public Function getName As String
getName="MyBuffer"
End Function



The problem is that attempting to fill the buffer with b.buf(j) = ... does nothing. If I look at the buffer using Debug.Print(b.getValueIndex(aValue)), every element is 0.0.

Any idea what I'm doing wrong?

Rate this thread
WoltLab Burning Board