player-core.cpp File Reference

#include <cstdio>
#include <signal.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <libgen.h>
#include <time.h>
#include <sys/times.h>
#include <math.h>
#include <qdialog.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "player-core.h"
#include "memory.h"
#include "scripts.h"
#include "version.h"
#include "dsp-drivers.h"
#include "energy-analyzer.h"
#include "player-config.h"
#include "capacity.h"
#include "clock-drivers.h"
#include "info.h"
Include dependency graph for player-core.cpp:

Classes

class  source_template< RMS >

Defines

#define wave_bufsize   (32L*1024L)
#define DIFF   100
#define DECAY   11050

Typedefs

typedef source_template< falsebare_source
typedef source_template< truenormalized_source

Functions

QString get_rawpath ()
FILE * openCoreRawFile ()
void writer_died ()
void something_died (int sig, siginfo_t *info, void *hu)
int wave_open (Index *playing, bool synchronous)
void wave_close ()
unsigned4 wave_max ()
int wave_read (unsigned4 pos, stereo_sample2 *val)
void jumpto (signed8)
_lfo_ lfo_get ()
void lfo_set (const char *name, _lfo_ l, unsigned8 freq, unsigned8 phase)
stereo_sample2 lfo_no (stereo_sample2 lt)
stereo_sample2 lfo_volume (stereo_sample2 x, signed4 multiplierleft, signed4 divisorleft, signed4 multiplierright, signed4 divisorright)
stereo_sample2 lfo_metronome (stereo_sample2 x)
stereo_sample2 lfo_pan (stereo_sample2 x)
stereo_sample2 lfo_saw (stereo_sample2 x)
stereo_sample2 lfo_break (stereo_sample2 x)
stereo_sample2 lfo_revsaw (stereo_sample2 x)
void lfo_init ()
void map_loop_set (bool l)
unsigned8 map_active (unsigned8 a)
void map_stop ()
void map_set_diskrate (signed2 size, map_data inmap, unsigned8 msize, signed8 mexit, bool l)
void map_init ()
void cue_set ()
void cue_shift_metarate (signed8 whence)
void cue_store (int nr)
void cue_retrieve (int nr)
void cue_write ()
void cue_read ()
void rms_init ()
void rms_normalize (stereo_sample2 *l)
int loop_set_diskrate (unsigned8 jumpback)
void loop_jump ()
void pause_playing ()
void unpause_playing ()
void copyright ()
int core_meta_init ()
int core_object_init (bool sync)
void core_done ()
int core_start (bool ui)
void core_stop ()
void set_normalperiod_metarate (quad_period_type newnormalperiod, bool update_on_disk)

Variables

volatile int finished = 1
int opt_quiet = 0
int opt_match = 0
char * arg_match = 0
char * argument
Indexplaying = NULL
PlayerConfigconfig
QString rawpath = ""
char * wave_name = NULL
stereo_sample2 wave_buffer [wave_bufsize]
FILE * wave_file
unsigned4 wave_bufferpos = wave_bufsize
unsigned8 lfo_phase_playrate = 0
quad_period_type lfo_period_playrate = 0
_lfo_ lfo_do
unsigned8 map_start_pos_diskrate = 0
unsigned8 map_stop_pos_diskrate = 0
bool map_loop = false
signed8 map_exit_pos_diskrate = 0
bool map_do
map_data bpmdj_map = NULL
signed2 map_size = 0
cue_info cue_metarate = 0
cue_info cues_metarate [4] = {0,0,0,0}
const signed8 loop_off = 0x7FFFFFFFFFFFFFFFLL
signed8 loop_at_diskrate = loop_off
signed8 loop_restart_diskrate = 0
clock_drivermetronome

Define Documentation

#define DECAY   11050
#define DIFF   100
#define wave_bufsize   (32L*1024L)

Referenced by wave_read().


Typedef Documentation


Function Documentation

void copyright (  ) 

Referenced by core_meta_init().

void core_done (  ) 

Closes the wave and writes any changes to the index

References Index::changed(), cue_write(), Debug(), finished, Info(), opt_quiet, wave_close(), and Index::write_idx().

Referenced by batch_start(), and Player::done().

int core_meta_init (  ) 

Initializes the index fields and start reading the audio The error can be err_none (wanted !), err_needidx, err_noraw, err_nospawn, or err_dsp.

References arg_match, argument, common_init(), copyright(), cue_read(), currentperiod_metarate, err_needidx, err_none, Index::get_period(), normalperiod_metarate, opt_match, period_to_quad(), target, and targetperiod_metarate.

Referenced by batch_start(), check_start(), and normal_start().

int core_object_init ( bool  sync  ) 

References wave_open().

Referenced by batch_start(), and Player::initCore().

int core_start ( bool  ui  ) 

Starts the core if the wave is already opened. If user interface is true it will use QMessageBox to display errors.

References assert(), dsp_driver::close(), dsp, err_dsp, err_none, finished, lfo_init(), map_init(), msg_playing_state_changed(), dsp_driver::open(), pause_playing(), rms_init(), and dsp_driver::start().

Referenced by Player::startCore().

void core_stop (  ) 

Waits for the core to finish, does nothing else

References dsp, finished, and dsp_driver::stop().

Referenced by Player::done(), and Player::stopCore().

void cue_read (  ) 
void cue_retrieve ( int  nr  ) 

Will retrieve the cue from memory and place it in cue It will effectively be used later in the jumpto function which will also try to stay in sync with the current position in the phrase.

References cue_metarate, and cues_metarate.

void cue_set (  ) 
void cue_shift_metarate ( signed8  whence  ) 
void cue_store ( int  nr  ) 

Will write the current position into one of the cue points

References cue_metarate, and cues_metarate.

void cue_write (  ) 
QString get_rawpath (  ) 

References assert(), and rawpath.

Referenced by openCoreRawFile(), wave_open(), and DecoderChecker::works().

void jumpto ( signed8  mes  ) 
stereo_sample2 lfo_break ( stereo_sample2  x  ) 

References lfo_phase_playrate, and y_playrate.

Referenced by Player::breakLfo().

_lfo_ lfo_get (  ) 

References lfo_do.

Referenced by Player::metronome().

void lfo_init (  ) 

References lfo_do, and lfo_no().

Referenced by core_start().

stereo_sample2 lfo_metronome ( stereo_sample2  x  ) 
stereo_sample2 lfo_no ( stereo_sample2  lt  ) 

References stereo_sample2::muldiv().

Referenced by lfo_init(), and Player::normalLfo().

stereo_sample2 lfo_pan ( stereo_sample2  x  ) 
stereo_sample2 lfo_revsaw ( stereo_sample2  x  ) 
stereo_sample2 lfo_saw ( stereo_sample2  x  ) 
void lfo_set ( const char *  name,
_lfo_  l,
unsigned8  freq,
unsigned8  phase 
)
stereo_sample2 lfo_volume ( stereo_sample2  x,
signed4  multiplierleft,
signed4  divisorleft,
signed4  multiplierright,
signed4  divisorright 
)

References stereo_sample2::muldiv2().

Referenced by lfo_pan(), lfo_revsaw(), and lfo_saw().

void loop_jump (  ) 
int loop_set_diskrate ( unsigned8  jumpback  ) 
unsigned8 map_active ( unsigned8  a  ) 
void map_init (  ) 

References map_do.

Referenced by core_start().

void map_loop_set ( bool  l  ) 

References map_loop.

Referenced by Player::mapLoopChange().

void map_set_diskrate ( signed2  size,
map_data  inmap,
unsigned8  msize,
signed8  mexit,
bool  l 
)
void map_stop (  ) 
FILE* openCoreRawFile (  ) 
void pause_playing (  ) 

Asks the player to pause its playing. This function must return immediately and simply signals a pause request

References dsp, dsp_driver::get_paused(), msg_playing_state_changed(), and dsp_driver::pause().

Referenced by core_start(), cue_shift_metarate(), map_active(), and Player::start_stop().

void rms_init (  ) 
void rms_normalize ( stereo_sample2 l  ) 
void set_normalperiod_metarate ( quad_period_type  newnormalperiod,
bool  update_on_disk 
)
void something_died ( int  sig,
siginfo_t *  info,
void *  hu 
)
void unpause_playing (  ) 
void wave_close (  ) 

References assert(), fclose(), wave_file, and wave_name.

Referenced by core_done().

unsigned4 wave_max (  ) 

References fsize(), wave_file, and wave_name.

Referenced by Player::timerTick(), wave_read(), and writer_died().

int wave_open ( Index playing,
bool  synchronous 
)
int wave_read ( unsigned4  pos,
stereo_sample2 val 
)
void writer_died (  ) 

Bug# 975: the jackd daemon seems to spawn its own processes To make sure that we retrieve the proper signal from the process we spawned, we retrieve the signal info and compare it against what we expect.

References diskrate, msg_writing_finished(), samples2s, Index::set_time(), sprintf(), wave_file, and wave_max().

Referenced by something_died(), and wave_open().


Variable Documentation

char* arg_match = 0
char* argument

cue points are expressed as positions (samples) in the song at metarate cue is the current cue

Referenced by Player::checkCueNonZero(), cue_read(), cue_retrieve(), cue_set(), cue_shift_metarate(), cue_store(), cue_write(), BeatGraphLabel::drawCueText(), jumpto(), loop_set_diskrate(), map_set_diskrate(), and Player::start_stop().

cue_info cues_metarate[4] = {0,0,0,0}

These are the for Z, X, C and V cues, in that order

Referenced by cue_read(), cue_retrieve(), cue_store(), cue_write(), BeatGraphLabel::drawCueText(), and Player::mapStart().

volatile int finished = 1

Referenced by lfo_get(), lfo_init(), and lfo_set().

Referenced by loop_set_diskrate().

const signed8 loop_off = 0x7FFFFFFFFFFFFFFFLL

Referenced by loop_set_diskrate().

Referenced by loop_jump(), and loop_set_diskrate().

bool map_do

Referenced by map_active(), and map_set_diskrate().

bool map_loop = false

Referenced by map_active(), and map_set_diskrate().

Referenced by map_active(), and map_set_diskrate().

Referenced by map_active(), and map_set_diskrate().

int opt_match = 0
int opt_quiet = 0

Referenced by core_done(), and process_options().

Index* playing = NULL
QString rawpath = ""

Referenced by get_rawpath().

stereo_sample2 wave_buffer[wave_bufsize]
unsigned4 wave_bufferpos = wave_bufsize

Referenced by wave_read().

FILE* wave_file
char* wave_name = NULL
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by  doxygen 1.6.2