Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Types | Public Member Functions | List of all members
Scope Class Reference

An oscilloscope which allows data to be visualised in a browser in real time. More...

#include <Scope.h>

Public Types

enum  TriggerMode { AUTO, NORMAL, CUSTOM }
 
enum  TriggerSlope { POSITIVE, NEGATIVE, BOTH }
 

Public Member Functions

 Scope (unsigned int numChannels, float sampleRate)
 
void setup (unsigned int numChannels, float sampleRate)
 Initialise the scope, setting the number of channels and the sample rate. More...
 
void cleanup ()
 
void log (double chn1,...)
 Logs a frame of data to the scope. More...
 
void log (const float *values)
 Logs a frame of data to the scope. More...
 
bool trigger ()
 Cause the scope to trigger when set to custom trigger mode. More...
 
void setTrigger (TriggerMode mode, unsigned int channel=0, TriggerSlope dir=BOTH, float level=0)
 

Detailed Description

An oscilloscope which allows data to be visualised in a browser in real time.

To use the scope, ensure the Bela IDE is running, and navigate to http://bela.local/scope

Examples:
Analog/scope-analog/render.cpp, Audio/sample-piezo-trigger/render.cpp, Fundamentals/scope/render.cpp, Sensors/rotary-encoder/render.cpp, Sensors/ultrasonic-distance-sensor/render.cpp, and Trill/ring-sound/render.cpp.

Member Enumeration Documentation

Enumerator
AUTO 

Auto triggering.

NORMAL 

Normal triggering.

CUSTOM 

Triggering when calling trigger()

Enumerator
POSITIVE 

Trigger when crossing the threshold and the signal is increasing.

NEGATIVE 

Trigger when crossing the threshold and the signal is decreasing.

BOTH 

Trigger on any crossing of the threshold.

Member Function Documentation

void Scope::setup ( unsigned int  numChannels,
float  sampleRate 
)

Initialise the scope, setting the number of channels and the sample rate.

This function must be called once during setup. numChannels must be set to the number of parameters passed in to log() or the channels may not be displayed correctly. sampleRate must be the rate at which data is logged to the scope (the rate at which log() is called) in Hz or the x-axis time values displayed on the scope will be incorrect.

Parameters
numChannelsnumber of channels displayed by the scope.
sampleRatesample rate of the data passed in.
Examples:
Analog/scope-analog/render.cpp, Audio/sample-piezo-trigger/render.cpp, Fundamentals/scope/render.cpp, Sensors/rotary-encoder/render.cpp, Sensors/ultrasonic-distance-sensor/render.cpp, and Trill/ring-sound/render.cpp.
void Scope::log ( double  chn1,
  ... 
)

Logs a frame of data to the scope.

Pass one argument per channel (starting from the first), up to the number of channels of the object. Omitted values will be set to 0.

Examples:
Analog/scope-analog/render.cpp, Audio/sample-piezo-trigger/render.cpp, Fundamentals/scope/render.cpp, Sensors/rotary-encoder/render.cpp, Sensors/ultrasonic-distance-sensor/render.cpp, and Trill/ring-sound/render.cpp.
void Scope::log ( const float *  values)

Logs a frame of data to the scope.

Accepts a pointer to an array of floats representing each channel's value in ascending order.

Parameters
valuesa pointer to an array containing numChannels values.
bool Scope::trigger ( )

Cause the scope to trigger when set to custom trigger mode.

This method can be used to force the scope to trigger rather than relying on the typical auto or normal trigger.

Examples:
Fundamentals/scope/render.cpp.
void Scope::setTrigger ( TriggerMode  mode,
unsigned int  channel = 0,
TriggerSlope  dir = BOTH,
float  level = 0 
)

Set the triggering mode for the scope


The documentation for this class was generated from the following files: