Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Sequencer Class Reference

Play sounds through /dev/sequencer. More...

#include <Sequencer.h>

Inheritance diagram for Sequencer

Inheritance graph
[legend]
Collaboration diagram for Sequencer:

Collaboration graph
[legend]
List of all members.

Public Methods

 Sequencer ()
 Sequencer Constructor. Query the sequencer for the synth devices. If there is a wavetable synth then use it.

virtual ~Sequencer ()
virtual Result Play (Sample& sample)
 Play the given sample.

virtual Result PlayNoWait (Sample& sample, int& NewChanelID, int& NewVoice)
 Play the sample and return without waiting for it to finish.

virtual Result WaitForVoiceToFinish (int voice, int ChannelID)
 do as it says.

virtual int AllocateVoice ( const Sample& sample, int voice=-1 )
 Allocates a voice for a sound which will be mixed into the buffer. More...

virtual Result DeleteVoice (int voice)
 Remove the given voice from the Audio manager.

virtual int VoicesAllocated () const
 Return the number of current voices allocated.

virtual ChannelAllocateChannel ()
 Create a new Channel.

virtual void DeleteChannel (Channel*& channel)
 Delete the given Channel.

virtual Result SetLocation (int x, int y, int z, int channel)
virtual Result SetX (int x, int channel)
virtual Result SetY (int y, int channel)
virtual Result SetZ (int z, int channel)
virtual Result GetLocation (int& x, int& y, int& z, int channel)
virtual Result GetX (int& x, int channel)
virtual Result GetY (int& y, int channel)
virtual Result GetZ (int& z, int channel)
virtual Result SetVolume (Volume volume, int channel)
 Set the expression volume. The final volume will be "main volume * expression * velocity".

virtual Volume GetVolume (int channel)
virtual Result SetVelocity (Velocity velocity, int channel)
 velocity -- how hard the key was pressed -- is this useful?

virtual Velocity GetVelocity (int channel)
virtual Result SetFrequency (Frequency frequency, int channel)
 PROBLEM: the sequencer expects me set the pitch of the voice by giving it a note and pitch bend rather than a frequency. If the voice is already playing it expects me to bend the pitch of the note. Thus we need to convert the frequency to a note and pitch bend . If the voice is already playing then we need to convert the frequency to a note, get the current note and pitch bend and then calculate the difference. SEQ_BENDER has a value from 0 to 16384, and the center (no pitch shift) is 8192.

virtual Frequency GetFrequency (int channel)
virtual Result SetPosition (unsigned long position, int channel)
 position.

unsigned long GetPosition (int channel)
virtual Result SetVoice (int voice, int channel)
 Set the voice for the given channel.

virtual int GetVoice (int channel)
 get the voice that has been assigned to the channel.

virtual int NextChannel ()
 return the channel id for the next channel.

virtual long GetPlaybackRate ()
virtual void SetTimeout (long milliseconds)
virtual void StartTimeout ()
virtual void StopTimeout ()
virtual void WaitForTimeout ()
void SetChorusMode (int mode)
void SetChorusDepth (int channel, int depth)
void SetReverbMode (int mode)
void SetReverbDepth (int channel, int depth)
bool SetDevice (int device)
 This is used to set the synth device to use. On my AWE 64 Value, when I cat /dev/sndstat I get Synth devices: 0: Yamaha OPL-3 1: AWE32-0.4.2c (RAM512k).

int GetDevice ()
void Start (int channel)
 Start the channel playing.

void Stop (int channel)
 Stop the channel from making any noise.

void StartNote (int channel, int note = 60, int velocity = 64)
void StopNote (int channel, int note = 60, int velocity = 64)

Detailed Description

Play sounds through /dev/sequencer.

Aiming to make portable to gus, awe, and any other card that can be controlled through /dev/sequencer

With a bit of work this is could also be used to control the OPL-3 chip, adlib, mpu401 or any other device that shows up under "Synth devices" in /dev/sndstat.


Member Function Documentation

int Sequencer::AllocateVoice ( const Sample & sample,
int voice = -1 ) [virtual]
 

Allocates a voice for a sound which will be mixed into the buffer.

It returns number corresponding to it's place in the array of samples (voices.)

this should make a copy of the sample structure or at least not rely on the reference to Sample given always being valid it will assign the voice to the number "voice" or if voice is -1 then it will get the next free voice number and return it.

Reimplemented from Audio.


The documentation for this class was generated from the following files:
Generated at Mon Nov 27 01:47:18 2000 for LibPenguinPlay by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000