AlsaPlayer 0.99.81

Data Structures | Macros | Typedefs
scope_plugin.h File Reference

Go to the source code of this file.

## Data Structures
struct | _scope_plugin

## Macros
#define | SCOPE_PLUGIN_BASE_VERSION 0x1000
#define | SCOPE_PLUGIN_VERSION (SCOPE_PLUGIN_BASE_VERSION + 7)
#define | SCOPE_NICE 10
#define | SCOPE_SLEEP 20000
#define | SCOPE_BG_RED 0
#define | SCOPE_BG_GREEN 0
#define | SCOPE_BG_BLUE 0

## Typedefs
typedef int | scope_version_type
typedef int(* | scope_init_type) (void *arg)
typedef void(* | scope_start_type) (void)
typedef int(* | scope_running_type) (void)
typedef void(* | scope_stop_type) (void)
typedef void(* | scope_shutdown_type) (void)
typedef void(* | scope_set_data_type) (void *buffer, int count)
typedef void(* | scope_set_fft_type) (void *buffer, int samples, int channels)
typedef struct _scope_plugin | scope_plugin
typedef scope_plugin *(* | scope_plugin_info_type) (void)

## Macro Definition Documentation

## ◆ SCOPE_BG_BLUE

#define SCOPE_BG_BLUE 0

The value of the BLUE component of the default background color for scope windows. Value should be from 0-255

## ◆ SCOPE_BG_GREEN

#define SCOPE_BG_GREEN 0

The value of the GREEN component of the default background color for scope windows. Value should be from 0-255

## ◆ SCOPE_BG_RED

#define SCOPE_BG_RED 0

The value of the RED component of the default background color for scope windows. Value should be from 0-255

## ◆ SCOPE_NICE

#define SCOPE_NICE 10

The default nice level scope plugins should be set at. Most scope plugins are just eye candy and as such should not interfere with other processes on your system. They should only use CPU cycles that would otherwise be wasted. Setting the scopes to a nice level of 10 or higher pretty much insures this. If you don't like this policy you can lower the value. Keep in mind that negative values will only work if you run the HOST as root

## ◆ SCOPE_PLUGIN_BASE_VERSION

#define SCOPE_PLUGIN_BASE_VERSION 0x1000

The base version number of the scope plugin. Set at 0x1000

## ◆ SCOPE_PLUGIN_VERSION

#define SCOPE_PLUGIN_VERSION (SCOPE_PLUGIN_BASE_VERSION + 7)

The version of the scope plugin API. This should be increased whenever structural changes are made to the API. This value should only be changed by the maintainers.

## ◆ SCOPE_SLEEP

#define SCOPE_SLEEP 20000

The default sleep time in microseconds for scopes. After every render iteration a scope should sleep for this amount of time. You should use the dosleep() call i.e. dosleep(SCOPE_SLEEP). A value of 20000 will let scopes run at 100000/20000 = 50 frames per second. If the scopes are consuming too much CPU consider raising this value.

## Typedef Documentation

## ◆ scope_init_type

typedef int(* scope_init_type) (void *arg)

The init function of a scope plugin. This function should initialize all data structures needed for the scope plugin. Return value should be 1 on success, 0 if initialization fails.

Parameters

  Set | to NULL. This currently used for internal plugins only

## ◆ scope_plugin

typedef struct _scope_plugin scope_plugin

You should declare a scope_plugin variable and populate it with pointers of the specific functions implemented by your scope

## ◆ scope_plugin_info_type

typedef scope_plugin*(* scope_plugin_info_type) (void)

Every scope plugin should have a scope_plugin_info() function that returns a pointer to a scope_plugin structure that is filled with pointers to your function implementations.

## ◆ scope_running_type

typedef int(* scope_running_type) (void)

This function should tell the HOST if the scope is running i.e. on-screen and rendering. A value of 1 should be returned if this is the case, 0 if the scope is not active.

## ◆ scope_set_data_type

typedef void(* scope_set_data_type) (void *buffer, int count)

Parameters

  buffer | pointer to buffer data
  count | number of short (int16) samples in buffer

The set_data function should be defined if your scope wants to get it hands on PCM data. The format of the buffer is short (int16) interleaved stereo data. A count value of 1024 means there are 2048 short samples in the buffer. These samples are interleaved, so even sample positions are from the left channel, uneven sample positions from the right channel. The API will be changed to accommodate variable channels in the not too distant future.

## ◆ scope_set_fft_type

typedef void(* scope_set_fft_type) (void *buffer, int samples, int channels)

Parameters

  buffer | buffer with FFT values
  samples | number of FFT values per channel
  channels | number of channels

This function should be defined if your scope wants to get FFT data. The HOST typically calculates 256 FFT values per channel (going from low frequency range to high). The value is betwee 0-256. The buffer format is NON-interleaved int (int32). So if samples = 256 and channels = 2 then there are 2 * 256 number of samples in the buffer. The first 256 are for channel 1, the other 256 for channel 2.

## ◆ scope_shutdown_type

typedef void(* scope_shutdown_type) (void)

The shutdown function is called just before the plugin is unloaded or just before the HOST decides to exit. All data structures allocated in the init routine should be freed here.

## ◆ scope_start_type

typedef void(* scope_start_type) (void)

This function will be called when the HOST wants to activate the scope. It should pop up the scope window and start rendering the PCM or FFT data

## ◆ scope_stop_type

typedef void(* scope_stop_type) (void)

This function should stop and close the scope window if it was running. It should just return if the scope is not running.

## ◆ scope_version_type

typedef int scope_version_type

The API this scope was compiled against. It should always be set to SCOPE_PLUGIN_VERSION. Failing to set this will most likely result in a scope plugin that won't load.