I'm trying to follow along this example, as I'm trying to get the same idea going, drawing the waveform for the whole song/sample.
I'm stuck in a few spots.
1) "reate an instance of BeadsPlayer". There doesn't appear to be a "BeadsPlayer". Was this something in an older version? I'm trying it with SamplePlayer, but that also is not working. When I use this line:
viewer = new SampleView( s );
I get this error:
"The constructor SampleView( Sample) is undefined"
(One thing I'm doing differently is setting up a "Sample" from the "SamplePlayer". I've also tried just like recommended:
viewer = new SampleView( player.sample );
But that results in this error:
"The field SamplePlayer.sample is not visible"
The only form of this I can get working is:
viewer = new SampleView();
But then it's not referencing the sample in any way.
2) "viewer.bindToSamplePlayer( player );" Isn't working
I get this error:
"the function bindToSamplePlayer( SamplePlayer ) does not exist.
3) I'm looking through the source code, and I'm finding no "SampleViewer" file. Since I can use "viewer = new SampleView();" just fine... It seems that there is code behind it, but I can't seem to see where that is coming from. It's not in core and it's not in analysis.
Here's the code I've got now, which is functioning (with a line commented out). Not sure how to proceed.
"
// SampleView.pde
import beads.*;
import org.jaudiolibs.beads.*;
AudioContext ac;
Gain g;
SamplePlayer player;
SampleView viewer;
Sample s;
void setup()
{
size( 800, 600 );
// Beads basics setup
ac = new AudioContext();
g = new Gain( ac, 2, 0.75 );
ac.out.addInput( g );
// Load the sample
try
{
player = new SamplePlayer( ac, new Sample( sketchPath( "" ) + "248 - Sugar Hill Gang - Rapper's Delight (Original).wav" ) );
g.addInput( player );
}
catch( Exception e )
{
e.printStackTrace();
}
s = player.getSample();
// Add Sample Veiwer component
viewer = new SampleView();
//viewer.bindToSamplePlayer( player );
ac.start();