Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::Sequencer Class Reference
Collaboration diagram for Burger::Sequencer:

Classes

struct  Channel_t
 
struct  Command_t
 A buffer describing a single note. More...
 
struct  EnvelopeMarker_t
 A single entry for sound envelope marking. More...
 
struct  InstrData_t
 
struct  PatternData_t
 A buffer describing a group of notes. More...
 
class  SampleDescription
 A buffer describing digital sample for an instrument. More...
 
struct  SongDescription_t
 
class  SongPackage
 

Public Types

enum  eImporterErrors {
  IMPORT_OKAY , IMPORT_UNKNOWN , IMPORT_BADFILE , IMPORT_TRUNCATION ,
  IMPORT_OUTOFMEMORY
}
 
enum  eLoopType { LOOP_NORMAL = 0 , LOOP_PINGPONG = 1 }
 
enum  eNote {
  NOTE_MIN =0 , NOTE_MID =40 , NOTE_LAST =95 , NOTE_MAX =96 ,
  NOTE_OFF =254 , NOTE_UNUSED =255
}
 
typedef uint_t(*) ImportProc(SongPackage *pOutput, const uint8_t *pInput, uintptr_t uInputLength)
 

Public Member Functions

 Sequencer (SoundManager *pSoundManager)
 Constructor for the music sequencer.
 
 ~Sequencer ()
 Destructor for the music sequencer.
 
uint_t Init (void)
 Initialize the music sequencer.
 
void Shutdown (void)
 Dispose of everything in the sequencer.
 
uint_t AddImporter (ImportProc pImportProc)
 Add a song file importer.
 
uint_t ImportSong (SongPackage **ppOutput, const uint8_t *pInput, uintptr_t uInputLength)
 Import a song.
 
uint_t GetVolume (void) const
 
void SetVolume (uint_t uVolume)
 Set the volume of the song.
 
void ClearChannels (void)
 Clear all of the channels.
 
uint_t CalculateVolume (const Channel_t *pChannel, uint_t uSpeaker) const
 Calculate the final volume for a voice.
 
uint_t SetSong (SongPackage *pSongPackage)
 Set the song to play.
 
uint_t Play (SongPackage *pSongPackage)
 Play a song.
 
uint_t Play (const void *pInput, uintptr_t uInputLength)
 Play a song.
 
uint_t Play (const char *pFilename)
 Play a song.
 
uint_t PlayRez (RezFile *pRezFile, uint_t uRezNum)
 
uint_t StartSequencing (void)
 Start music sequencer.
 
uint_t StopSequencing (void)
 Stop music sequencer.
 
void DisposeSong (void)
 Stop music sequencer and release the song.
 
void Reset (void)
 Reset music sequencer.
 
void Pause (void)
 Pause music sequencer.
 
void Resume (void)
 Resume music sequencer.
 
uint_t GetMaxVoices (void) const
 
void SetMaxVoices (uint_t uMaxVoices)
 Set the maximum number of voices.
 
SoundManager::eDataType GetOutputDataType (void) const
 
void SetOutputDataType (SoundManager::eDataType uOutputDataType)
 Set the bit size for the final sound output.
 
uint_t GetSampleRate (void) const
 
void SetSampleRate (uint_t uSampleRate)
 Set the sample rate for the final sound output.
 
uint_t GetMicroDelayDuration (void) const
 
void SetMicroDelayDuration (uint_t uMicroDelayDuration)
 Set the delay duration.
 
uint_t GetReverbSize (void) const
 
uint_t GetReverbStrength (void) const
 
void SetReverb (uint_t uReverbSizeMS, uint_t uReverbStrength)
 Set the reverb settings.
 
uint_t IsPlaying (void) const
 
uint_t IsLooping (void) const
 
void EnableLooping (void)
 
void DisableLooping (void)
 
void SetSoundManager (SoundManager *pSoundManager)
 
SoundManagerGetSoundManager (void) const
 

Static Public Member Functions

static eNote AddNoteSaturate (eNote uNote, int32_t iOffset)
 Add a offset to a note and clamp the result.
 
static uint_t GetNotePeriod (eNote uNote, uint_t uC2Speed)
 Calculate the sample rate period from a note.
 

Static Public Attributes

static const uint_t cAmigaFrequency = 8363
 Default MOD file sample frequency (7159090/856)
 
static const uint_t cInstrumentMaxCount = 255
 Maximum number of instruments.
 
static const uint_t cSampleMaxCount = 64
 Maximum number of samples.
 
static const uint_t cPointerMaxCount = 999
 Maximum number of track pointers.
 
static const uint_t cTrackMaxCount = 256
 Maximum number of tracks.
 
static const uint_t cPatternMaxCount = 200
 Maximum number of patterns.
 
static const uint_t cArpeggioMaxCount = 3
 Maximum number of arpeggio commands.
 
static const uint_t cMaxPlugIns = 16
 Maximum number of song format importers.
 
static const uint_t cDefaultVolumeFade = 300
 Default volume fade speed.
 
static const uint_t cAmigaClock = 14317456
 Scream Tracker Amiga base clock.
 
static const uint_t cFixedPointShift = 8
 Number of bits for fixed point math 24.8.
 
static const uint_t cMaxVolume = 64
 Maximum internal volume for commands.
 
static const uint_t cMaxPan = 64
 Maximum internal pan for commands.
 
static const uint_t cMinimumPitch = 113
 Minimum pitch (Samples per second)
 
static const uint_t cMaximumPitch = 27392
 Maximum pitch (Samples per second)
 
static const int32_t g_VibratoTable [64]
 Vibrato table.
 

Protected Member Functions

uint_t CreateReverbTables (void)
 Create the reverb table.
 
void DisposeReverbTables (void)
 Get rid of the reverb tables.
 
uint_t CreateDriverBuffer (void)
 Create the main sound buffer.
 
void DisposeDriverBuffer (void)
 Get rid of the main sound buffer.
 
uint_t CreateVolumeBuffer (void)
 Create the main accumulation buffer.
 
void DisposeVolumeBuffer (void)
 Get rid of the accumulator buffers.
 
void ProcessTick (Channel_t *pChannel, int32_t *pLeft, int32_t *pRight)
 Process the fading of a buffer.
 
void DetermineSpeed (void)
 Determine the starting speed of a song.
 
void PrepareSequencer (void)
 Prepare the sequencer to start music.
 
void ClearSequencer (void)
 Clear the sequencer from music playback.
 
void SetChannelCount (void)
 Set up the output channel count.
 
void Sample8To32AddDelay (Channel_t *pChannel, int32_t *pAccumBuffer)
 Add in a channel's 8 bit sample into a 32 bit stereo buffer.
 
void Sample16To32AddDelay (Channel_t *pChannel, int32_t *pAccumBuffer)
 Add in a channel's 16 bit sample into a 32 bit stereo buffer.
 
void Sample8To16AddDelay (Channel_t *pChannel, int16_t *pAccumBuffer)
 Add in a channel's 8 bit sample into a 16 bit stereo buffer.
 
void Sample16To16AddDelay (Channel_t *pChannel, int16_t *pAccumBuffer)
 Add in a channel's 16 bit sample into a 16 bit stereo buffer.
 
void Sample8To32AddDelayStereo (Channel_t *pChannel, int32_t *pAccumBuffer)
 Add in a channel's 8 bit stereo sample into a 32 bit stereo buffer.
 
void Sample16To32AddDelayStereo (Channel_t *pChannel, int32_t *pAccumBuffer)
 Add in a channel's 16 bit stereo sample into a 32 bit stereo buffer.
 
void Sample8To16AddDelayStereo (Channel_t *pChannel, int16_t *pAccumBuffer)
 Add in a channel's 8 bit stereo sample into a 16 bit stereo buffer.
 
void Sample16To16AddDelayStereo (Channel_t *pChannel, int16_t *pAccumBuffer)
 Add in a channel's 16 bit stereo sample into a 16 bit stereo buffer.
 
void MixTo32 (void)
 Mix all channels into the 32 bit buffer.
 
void MixTo16 (void)
 Mix all channels into the 16 bit buffer.
 
void GenerateSound (void)
 Mix all the channels into the output buffer.
 
void ApplySurround (void)
 Apply surround sound to the output buffer.
 
void PurgeChannels (void)
 Purge all of the channels from playback.
 
void SetUpEffect (Channel_t *pChannel)
 Process the current active effect.
 
void DoEffect (Channel_t *pChannel, uint_t uStep)
 Process the current active effect.
 
void ProcessFadeOut (Channel_t *pChannel) const
 Handle the volume fading.
 
void ProcessEnvelope (Channel_t *pChannel) const
 Handle the volume envelope.
 
void ProcessPanning (Channel_t *pChannel) const
 Handle the pan envelope.
 
void ProcessNote (Channel_t *pChannel, const Command_t *pCommand)
 Process a note on/off command.
 
void PerformSequencing (void)
 Perform the sequencing and fill the output buffer.
 
uint_t PlatformInit (void)
 Allocate the platform specific resources.
 
void PlatformShutdown (void)
 Release the platform specific resources.
 

Static Protected Member Functions

static unsigned long __stdcall ThreadCallback (void *pThis)
 

Protected Attributes

SoundManagerm_pSoundManager
 Pointer to the sound manager to send audio data to.
 
IDirectSoundBuffer8 * m_pDirectSoundBuffer8
 DirectSoundBuffer (Windows Only)
 
IDirectSoundNotify * m_pDirectSoundNotify
 DirectSoundNotify for alert when sound is complete (Windows Only)
 
void * m_hCallback
 HANDLE of the callback thread (Windows only)
 
unsigned long m_uCallbackID
 ID of the callback thread (Windows only)
 
void * m_hEvents [cMaxEventCount]
 Events for DirectSound completion functions (Windows Only)
 
SongPackagem_pSongPackage
 Current song being played.
 
int32_t * m_pAccumBuffer32
 32 bit accumulator buffer (Used for 16 bit samples)
 
int16_t * m_pAccumBuffer16
 16 bit accumulator buffer (Used for 8 bit samples)
 
void * m_pReverbBuffer
 Pointer to the reverb buffer.
 
uintptr_t m_uReverbDelayBufferSize
 Length in samples of the reverb buffer.
 
void * m_pBuffer
 Data buffer.
 
uintptr_t m_uBufferSize
 Size of the data buffer in bytes.
 
uintptr_t m_uBytesGenerated
 Number of bytes generated and uploaded to sound driver.
 
uintptr_t m_uBytesToGenerate
 Number of bytes to generate.
 
uintptr_t m_uChunkSize
 Number of bytes per time quantum (50Hz)
 
uintptr_t m_uAccumBufferSize
 Size in bytes of the accumulator buffer.
 
uintptr_t m_uMicroDelayBufferSize
 Size in bytes of the delay buffer.
 
uint_t m_uImporterCount
 Number of pointers in m_pImporters.
 
uint_t m_uMaxVoices
 Active number of track for the currently playing song.
 
uint_t m_uMicroDelayDuration
 Micro delay duration (min 0 ms, max 1000 ms)
 
SoundManager::eDataType m_eOutputDataType
 Mix to 8 or 16 bit size.
 
uint_t m_uFinalSampleRate
 Mix to this many samples per second.
 
uint_t m_uReverbSizeMS
 Reverb delay duration (min 25 ms, max 1000 ms)
 
uint_t m_uReverbStrength
 Reverb strength in % (0 <-> 70, default 20%)
 
uint_t m_uVolume
 Burgerlib volume for the song (0-255)
 
uint_t m_uMasterSpeed
 Current music speed, 80 = normal.
 
uint_t m_uMasterPitch
 Current music pitch, 80 = normal.
 
uint_t m_uCurrentSpeed
 Current speed.
 
uint_t m_uFineSpeed
 Current fine speed.
 
uint_t m_uPatternPosition
 Current position in pattern.
 
uint_t m_uCurrentIDPattern
 Current ID Pattern.
 
uint_t m_uPartitionPosition
 Current position in partition.
 
uint_t m_uSpeedCounter
 Current mark for song speed.
 
uint8_t m_bSurroundEnabled
 Surround effect active if TRUE.
 
uint8_t m_bReverbEnabled
 Reverb effect active if TRUE.
 
uint8_t m_bTickRemoverEnabled
 Remove volume/sample/loop ticks.
 
uint8_t m_bRepeatEnabled
 If music finished, repeat if TRUE.
 
uint8_t m_bSongIsPlaying
 TRUE if song is in progress
 
uint8_t m_bSequencingInProgress
 TRUE if song is being sequenced
 
uint8_t m_bPaused
 TRUE if song is paused
 
ImportProc m_pImporters [cMaxPlugIns]
 Pointers to the active song importers.
 
Channel_t m_Channels [cTrackMaxCount]
 Current note channels.
 

Static Protected Attributes

static const uint_t cMaxEventCount = 2
 

Member Typedef Documentation

◆ ImportProc

uint_t( *) Burger::Sequencer::ImportProc(SongPackage *pOutput, const uint8_t *pInput, uintptr_t uInputLength)

Member Enumeration Documentation

◆ eImporterErrors

Enumerator
IMPORT_OKAY 
IMPORT_UNKNOWN 
IMPORT_BADFILE 
IMPORT_TRUNCATION 
IMPORT_OUTOFMEMORY 

◆ eLoopType

Enumerator
LOOP_NORMAL 

Loop from the beginning to the end.

LOOP_PINGPONG 

Loop from the beginning to the end and back to the beginning.

◆ eNote

Enumerator
NOTE_MIN 

Minimum note value (C natural - ascending)

NOTE_MID 

Middle value for defaults.

NOTE_LAST 

Last valid note.

NOTE_MAX 

8 octave range

NOTE_OFF 

Silence this channel.

NOTE_UNUSED 

Note value is not used.

Constructor & Destructor Documentation

◆ Sequencer()

Burger::Sequencer::Sequencer ( SoundManager * pSoundManager)

Constructor for the music sequencer.


◆ ~Sequencer()

Burger::Sequencer::~Sequencer ( )

Destructor for the music sequencer.


Member Function Documentation

◆ AddImporter()

uint_t BURGER_API Burger::Sequencer::AddImporter ( ImportProc pImportProc)

Add a song file importer.


Add a function pointer to the list of file format importers so when a song is attempted to be played, there is a method for extracting the notes into Burgerlib format

Parameters
pImportProcPointer to a function that will parse a song file
Returns
Zero if successful, non zero if there table is full.

◆ AddNoteSaturate()

Burger::Sequencer::eNote BURGER_API Burger::Sequencer::AddNoteSaturate ( eNote uNote,
int32_t iOffset )
static

Add a offset to a note and clamp the result.


Add a note shift to a note enumeration and return it clamped to be between NOTE_MIN and NOTE_LAST inclusive.

Parameters
uNoteParse slide argument to process
iOffsetSigned value to add to the note
Returns
Note enumeration clamped to the valid range

◆ ApplySurround()

void BURGER_API Burger::Sequencer::ApplySurround ( void )
protected

Apply surround sound to the output buffer.


Assuming the output buffer is stereo, and phase reverse the left channel

◆ CalculateVolume()

uint_t BURGER_API Burger::Sequencer::CalculateVolume ( const Channel_t * pChannel,
uint_t uSpeaker ) const

Calculate the final volume for a voice.


Given a voice and a requested speaker channel, return the volume for the current state of the channel

Parameters
pChannel
uSpeakerWhich speaker to get the volume for (0=left, 1 = right)
Returns
0-256, volume of the channel at this moment in time

◆ ClearChannels()

void BURGER_API Burger::Sequencer::ClearChannels ( void )

Clear all of the channels.


◆ ClearSequencer()

void BURGER_API Burger::Sequencer::ClearSequencer ( void )
protected

Clear the sequencer from music playback.


◆ CreateDriverBuffer()

uint_t BURGER_API Burger::Sequencer::CreateDriverBuffer ( void )
protected

Create the main sound buffer.


Returns
Zero is no error, non-zero means out of memory

◆ CreateReverbTables()

uint_t BURGER_API Burger::Sequencer::CreateReverbTables ( void )
protected

Create the reverb table.


Returns
Zero is no error, non-zero means out of memory

◆ CreateVolumeBuffer()

uint_t BURGER_API Burger::Sequencer::CreateVolumeBuffer ( void )
protected

Create the main accumulation buffer.


Returns
Zero is no error, non-zero means out of memory

◆ DetermineSpeed()

void BURGER_API Burger::Sequencer::DetermineSpeed ( void )
protected

Determine the starting speed of a song.


Parse the patterns from the end and locate the speed and fine speed commands and set the initial speeds to those values to allow the looped speed commands to be effective

◆ DisableLooping()

void Burger::Sequencer::DisableLooping ( void )
inline

◆ DisposeDriverBuffer()

void BURGER_API Burger::Sequencer::DisposeDriverBuffer ( void )
protected

Get rid of the main sound buffer.


◆ DisposeReverbTables()

void BURGER_API Burger::Sequencer::DisposeReverbTables ( void )
protected

Get rid of the reverb tables.


◆ DisposeSong()

void BURGER_API Burger::Sequencer::DisposeSong ( void )

Stop music sequencer and release the song.


◆ DisposeVolumeBuffer()

void BURGER_API Burger::Sequencer::DisposeVolumeBuffer ( void )
protected

Get rid of the accumulator buffers.


◆ DoEffect()

void BURGER_API Burger::Sequencer::DoEffect ( Channel_t * pChannel,
uint_t uStep )
protected

Process the current active effect.


◆ EnableLooping()

void Burger::Sequencer::EnableLooping ( void )
inline

◆ GenerateSound()

void BURGER_API Burger::Sequencer::GenerateSound ( void )
protected

Mix all the channels into the output buffer.


◆ GetMaxVoices()

uint_t Burger::Sequencer::GetMaxVoices ( void ) const
inline

◆ GetMicroDelayDuration()

uint_t Burger::Sequencer::GetMicroDelayDuration ( void ) const
inline

◆ GetNotePeriod()

uint_t BURGER_API Burger::Sequencer::GetNotePeriod ( eNote uNote,
uint_t uC2Speed )
static

Calculate the sample rate period from a note.


Given a note enumeration and a samples per second fine tuning value assuming 8363 is no adjustment, calculate the samples per second to play a sample

Parameters
uNoteNote to play
uC2SpeedSamples per second to play C2 (C one octave higher than middle C)

◆ GetOutputDataType()

SoundManager::eDataType Burger::Sequencer::GetOutputDataType ( void ) const
inline

◆ GetReverbSize()

uint_t Burger::Sequencer::GetReverbSize ( void ) const
inline

◆ GetReverbStrength()

uint_t Burger::Sequencer::GetReverbStrength ( void ) const
inline

◆ GetSampleRate()

uint_t Burger::Sequencer::GetSampleRate ( void ) const
inline

◆ GetSoundManager()

SoundManager * Burger::Sequencer::GetSoundManager ( void ) const
inline

◆ GetVolume()

uint_t Burger::Sequencer::GetVolume ( void ) const
inline

◆ ImportSong()

uint_t BURGER_API Burger::Sequencer::ImportSong ( SongPackage ** ppOutput,
const uint8_t * pInput,
uintptr_t uInputLength )

Import a song.


Given a song file in memory, try all the song importers until one accepts the file format and converts the song into a SongPackage

Parameters
ppOutputPointer to a pointer that will have a new SongPackage if parsing is successful
pInputPointer to a valid song file
uInputLengthLength of the valid song file in bytes
Returns
Zero if successful, non zero if there was an error

◆ Init()

uint_t BURGER_API Burger::Sequencer::Init ( void )

Initialize the music sequencer.


◆ IsLooping()

uint_t Burger::Sequencer::IsLooping ( void ) const
inline

◆ IsPlaying()

uint_t Burger::Sequencer::IsPlaying ( void ) const
inline

◆ MixTo16()

void BURGER_API Burger::Sequencer::MixTo16 ( void )
protected

Mix all channels into the 16 bit buffer.


◆ MixTo32()

void BURGER_API Burger::Sequencer::MixTo32 ( void )
protected

Mix all channels into the 32 bit buffer.


◆ Pause()

void BURGER_API Burger::Sequencer::Pause ( void )

Pause music sequencer.


◆ PerformSequencing()

void BURGER_API Burger::Sequencer::PerformSequencing ( void )
protected

Perform the sequencing and fill the output buffer.


◆ PlatformInit()

uint_t BURGER_API Burger::Sequencer::PlatformInit ( void )
protected

Allocate the platform specific resources.


◆ PlatformShutdown()

void BURGER_API Burger::Sequencer::PlatformShutdown ( void )
protected

Release the platform specific resources.


◆ Play() [1/3]

uint_t BURGER_API Burger::Sequencer::Play ( const char * pFilename)

Play a song.


Load a song file and then run the data through an importer and then play the song if there were no importation errors

Returns
Zero is no error, non-zero means no song present

◆ Play() [2/3]

uint_t BURGER_API Burger::Sequencer::Play ( const void * pInput,
uintptr_t uInputLength )

Play a song.


Run the data through an importer and then play the song if there were no importation errors

Returns
Zero is no error, non-zero means no song present

◆ Play() [3/3]

uint_t BURGER_API Burger::Sequencer::Play ( SongPackage * pSongPackage)

Play a song.


Returns
Zero is no error, non-zero means no song present

◆ PlayRez()

uint_t BURGER_API Burger::Sequencer::PlayRez ( RezFile * pRezFile,
uint_t uRezNum )

◆ PrepareSequencer()

void BURGER_API Burger::Sequencer::PrepareSequencer ( void )
protected

Prepare the sequencer to start music.


◆ ProcessEnvelope()

void BURGER_API Burger::Sequencer::ProcessEnvelope ( Channel_t * pChannel) const
protected

Handle the volume envelope.


◆ ProcessFadeOut()

void BURGER_API Burger::Sequencer::ProcessFadeOut ( Channel_t * pChannel) const
protected

Handle the volume fading.


◆ ProcessNote()

void BURGER_API Burger::Sequencer::ProcessNote ( Channel_t * pChannel,
const Command_t * pCommand )
protected

Process a note on/off command.


◆ ProcessPanning()

void BURGER_API Burger::Sequencer::ProcessPanning ( Channel_t * pChannel) const
protected

Handle the pan envelope.


◆ ProcessTick()

void BURGER_API Burger::Sequencer::ProcessTick ( Channel_t * pChannel,
int32_t * pLeft,
int32_t * pRight )
protected

Process the fading of a buffer.


Parameters
pChannelPointer to a channel to process
pLeftPointer to the left audio buffer
pRightPointer to the right audio buffer

◆ PurgeChannels()

void BURGER_API Burger::Sequencer::PurgeChannels ( void )
protected

Purge all of the channels from playback.


◆ Reset()

void BURGER_API Burger::Sequencer::Reset ( void )

Reset music sequencer.


◆ Resume()

void BURGER_API Burger::Sequencer::Resume ( void )

Resume music sequencer.


◆ Sample16To16AddDelay()

void BURGER_API Burger::Sequencer::Sample16To16AddDelay ( Channel_t * pChannel,
int16_t * pAccumBuffer )
protected

Add in a channel's 16 bit sample into a 16 bit stereo buffer.


Parameters
pChannelPointer to channel being added
pAccumBufferPointer to stereo buffer to add in the sample

◆ Sample16To16AddDelayStereo()

void BURGER_API Burger::Sequencer::Sample16To16AddDelayStereo ( Channel_t * pChannel,
int16_t * pAccumBuffer )
protected

Add in a channel's 16 bit stereo sample into a 16 bit stereo buffer.


Parameters
pChannelPointer to channel being added
pAccumBufferPointer to stereo buffer to add in the sample

◆ Sample16To32AddDelay()

void BURGER_API Burger::Sequencer::Sample16To32AddDelay ( Channel_t * pChannel,
int32_t * pAccumBuffer )
protected

Add in a channel's 16 bit sample into a 32 bit stereo buffer.


Parameters
pChannelPointer to channel being added
pAccumBufferPointer to stereo buffer to add in the sample

◆ Sample16To32AddDelayStereo()

void BURGER_API Burger::Sequencer::Sample16To32AddDelayStereo ( Channel_t * pChannel,
int32_t * pAccumBuffer )
protected

Add in a channel's 16 bit stereo sample into a 32 bit stereo buffer.


Parameters
pChannelPointer to channel being added
pAccumBufferPointer to stereo buffer to add in the sample

◆ Sample8To16AddDelay()

void BURGER_API Burger::Sequencer::Sample8To16AddDelay ( Channel_t * pChannel,
int16_t * pAccumBuffer )
protected

Add in a channel's 8 bit sample into a 16 bit stereo buffer.


Parameters
pChannelPointer to channel being added
pAccumBufferPointer to stereo buffer to add in the sample

◆ Sample8To16AddDelayStereo()

void BURGER_API Burger::Sequencer::Sample8To16AddDelayStereo ( Channel_t * pChannel,
int16_t * pAccumBuffer )
protected

Add in a channel's 8 bit stereo sample into a 16 bit stereo buffer.


Parameters
pChannelPointer to channel being added
pAccumBufferPointer to stereo buffer to add in the sample

◆ Sample8To32AddDelay()

void BURGER_API Burger::Sequencer::Sample8To32AddDelay ( Channel_t * pChannel,
int32_t * pAccumBuffer )
protected

Add in a channel's 8 bit sample into a 32 bit stereo buffer.


Parameters
pChannelPointer to channel being added
pAccumBufferPointer to stereo buffer to add in the sample

◆ Sample8To32AddDelayStereo()

void BURGER_API Burger::Sequencer::Sample8To32AddDelayStereo ( Channel_t * pChannel,
int32_t * pAccumBuffer )
protected

Add in a channel's 8 bit stereo sample into a 32 bit stereo buffer.


Parameters
pChannelPointer to channel being added
pAccumBufferPointer to stereo buffer to add in the sample

◆ SetChannelCount()

void BURGER_API Burger::Sequencer::SetChannelCount ( void )
protected

Set up the output channel count.


◆ SetMaxVoices()

void BURGER_API Burger::Sequencer::SetMaxVoices ( uint_t uMaxVoices)

Set the maximum number of voices.


Parameters
uMaxVoicesMaximum number of voices to use

◆ SetMicroDelayDuration()

void BURGER_API Burger::Sequencer::SetMicroDelayDuration ( uint_t uMicroDelayDuration)

Set the delay duration.


Parameters
uMicroDelayDuration0 turns it off and 1000 is one second (In milliseconds)

◆ SetOutputDataType()

void BURGER_API Burger::Sequencer::SetOutputDataType ( SoundManager::eDataType uOutputDataType)

Set the bit size for the final sound output.


Parameters
uOutputDataType8 or 16 to set the bit size.

◆ SetReverb()

void BURGER_API Burger::Sequencer::SetReverb ( uint_t uReverbSizeMS,
uint_t uReverbStrength )

Set the reverb settings.


Parameters
uReverbSizeMS24 or less turns it off and 1000 is one second (In milliseconds)
uReverbStrength0 turns it off to 70 in percentage (0-70)

◆ SetSampleRate()

void BURGER_API Burger::Sequencer::SetSampleRate ( uint_t uSampleRate)

Set the sample rate for the final sound output.


Parameters
uSampleRate5000 to 48000

◆ SetSong()

uint_t BURGER_API Burger::Sequencer::SetSong ( SongPackage * pSongPackage)

Set the song to play.


Returns
Zero is no error, non-zero means package install failure

◆ SetSoundManager()

void Burger::Sequencer::SetSoundManager ( SoundManager * pSoundManager)
inline

◆ SetUpEffect()

void BURGER_API Burger::Sequencer::SetUpEffect ( Channel_t * pChannel)
protected

Process the current active effect.


◆ SetVolume()

void BURGER_API Burger::Sequencer::SetVolume ( uint_t uVolume)

Set the volume of the song.


Set the volume for song playback, 0 = silence, 255 = maximum volume

Parameters
uVolumeNew volume for the song
See also
GetVolume(void) const

◆ Shutdown()

void BURGER_API Burger::Sequencer::Shutdown ( void )

Dispose of everything in the sequencer.


◆ StartSequencing()

uint_t BURGER_API Burger::Sequencer::StartSequencing ( void )

Start music sequencer.


Returns
Zero is no error, non-zero means no song present

◆ StopSequencing()

uint_t BURGER_API Burger::Sequencer::StopSequencing ( void )

Stop music sequencer.


Returns
Zero is no error, non-zero means no song present

◆ ThreadCallback()

unsigned long __stdcall Burger::Sequencer::ThreadCallback ( void * pThis)
staticprotected

Member Data Documentation

◆ cAmigaClock

const uint_t Burger::Sequencer::cAmigaClock = 14317456
static

Scream Tracker Amiga base clock.

◆ cAmigaFrequency

const uint_t Burger::Sequencer::cAmigaFrequency = 8363
static

Default MOD file sample frequency (7159090/856)


C one octave above Middle C is 523.25 Hz. To play this on the Amiga with 16 samples would require a sample rate of 8372 Hz. However, the Amiga has a clock rate of 7,159,090 Hz on NTSC and 7,093,790 Hz for PAL. So, by dividing by 855 and 847 respectively, the effective sample rate is actually 8363 Hz. To reduce the chance of harmonic distortion by sample rate adjusted tuning, samples are optimized at 8363 samples per second.

Hence, this weird magic number used for tuning.

◆ cArpeggioMaxCount

const uint_t Burger::Sequencer::cArpeggioMaxCount = 3
static

Maximum number of arpeggio commands.

◆ cDefaultVolumeFade

const uint_t Burger::Sequencer::cDefaultVolumeFade = 300
static

Default volume fade speed.

◆ cFixedPointShift

const uint_t Burger::Sequencer::cFixedPointShift = 8
static

Number of bits for fixed point math 24.8.

◆ cInstrumentMaxCount

const uint_t Burger::Sequencer::cInstrumentMaxCount = 255
static

Maximum number of instruments.

◆ cMaxEventCount

const uint_t Burger::Sequencer::cMaxEventCount = 2
staticprotected

◆ cMaximumPitch

const uint_t Burger::Sequencer::cMaximumPitch = 27392
static

Maximum pitch (Samples per second)

◆ cMaxPan

const uint_t Burger::Sequencer::cMaxPan = 64
static

Maximum internal pan for commands.

◆ cMaxPlugIns

const uint_t Burger::Sequencer::cMaxPlugIns = 16
static

Maximum number of song format importers.

◆ cMaxVolume

const uint_t Burger::Sequencer::cMaxVolume = 64
static

Maximum internal volume for commands.

◆ cMinimumPitch

const uint_t Burger::Sequencer::cMinimumPitch = 113
static

Minimum pitch (Samples per second)

◆ cPatternMaxCount

const uint_t Burger::Sequencer::cPatternMaxCount = 200
static

Maximum number of patterns.

◆ cPointerMaxCount

const uint_t Burger::Sequencer::cPointerMaxCount = 999
static

Maximum number of track pointers.

◆ cSampleMaxCount

const uint_t Burger::Sequencer::cSampleMaxCount = 64
static

Maximum number of samples.

◆ cTrackMaxCount

const uint_t Burger::Sequencer::cTrackMaxCount = 256
static

Maximum number of tracks.

◆ g_VibratoTable

const int32_t Burger::Sequencer::g_VibratoTable
static
Initial value:
= {
0, 50, 100, 149, 196, 241, 284, 325, 362, 396, 426, 452, 473,490,502,510,512,
510, 502, 490, 473, 452, 426, 396, 362, 325, 284, 241, 196, 149,100, 50, 0,-49,
-99,-148,-195,-240,-283,-324,-361,-395,-425,-451,-472,-489,-501,
-509,-511,-509,-501,-489,-472,-451,-425,-395,-361,-324,-283,-240,
-195,-148, -99, -49
}

Vibrato table.

Table with values to use for vibrato.


◆ m_bPaused

uint8_t Burger::Sequencer::m_bPaused
protected

TRUE if song is paused

◆ m_bRepeatEnabled

uint8_t Burger::Sequencer::m_bRepeatEnabled
protected

If music finished, repeat if TRUE.

◆ m_bReverbEnabled

uint8_t Burger::Sequencer::m_bReverbEnabled
protected

Reverb effect active if TRUE.

◆ m_bSequencingInProgress

uint8_t Burger::Sequencer::m_bSequencingInProgress
protected

TRUE if song is being sequenced

◆ m_bSongIsPlaying

uint8_t Burger::Sequencer::m_bSongIsPlaying
protected

TRUE if song is in progress

◆ m_bSurroundEnabled

uint8_t Burger::Sequencer::m_bSurroundEnabled
protected

Surround effect active if TRUE.

◆ m_bTickRemoverEnabled

uint8_t Burger::Sequencer::m_bTickRemoverEnabled
protected

Remove volume/sample/loop ticks.

◆ m_Channels

Channel_t Burger::Sequencer::m_Channels[cTrackMaxCount]
protected

Current note channels.

◆ m_eOutputDataType

SoundManager::eDataType Burger::Sequencer::m_eOutputDataType
protected

Mix to 8 or 16 bit size.

◆ m_hCallback

void* Burger::Sequencer::m_hCallback
protected

HANDLE of the callback thread (Windows only)

◆ m_hEvents

void* Burger::Sequencer::m_hEvents[cMaxEventCount]
protected

Events for DirectSound completion functions (Windows Only)

◆ m_pAccumBuffer16

int16_t* Burger::Sequencer::m_pAccumBuffer16
protected

16 bit accumulator buffer (Used for 8 bit samples)

◆ m_pAccumBuffer32

int32_t* Burger::Sequencer::m_pAccumBuffer32
protected

32 bit accumulator buffer (Used for 16 bit samples)

◆ m_pBuffer

void* Burger::Sequencer::m_pBuffer
protected

Data buffer.

◆ m_pDirectSoundBuffer8

IDirectSoundBuffer8* Burger::Sequencer::m_pDirectSoundBuffer8
protected

DirectSoundBuffer (Windows Only)

◆ m_pDirectSoundNotify

IDirectSoundNotify* Burger::Sequencer::m_pDirectSoundNotify
protected

DirectSoundNotify for alert when sound is complete (Windows Only)

◆ m_pImporters

ImportProc Burger::Sequencer::m_pImporters[cMaxPlugIns]
protected

Pointers to the active song importers.

◆ m_pReverbBuffer

void* Burger::Sequencer::m_pReverbBuffer
protected

Pointer to the reverb buffer.

◆ m_pSongPackage

SongPackage* Burger::Sequencer::m_pSongPackage
protected

Current song being played.

◆ m_pSoundManager

SoundManager* Burger::Sequencer::m_pSoundManager
protected

Pointer to the sound manager to send audio data to.

◆ m_uAccumBufferSize

uintptr_t Burger::Sequencer::m_uAccumBufferSize
protected

Size in bytes of the accumulator buffer.

◆ m_uBufferSize

uintptr_t Burger::Sequencer::m_uBufferSize
protected

Size of the data buffer in bytes.

◆ m_uBytesGenerated

uintptr_t Burger::Sequencer::m_uBytesGenerated
protected

Number of bytes generated and uploaded to sound driver.

◆ m_uBytesToGenerate

uintptr_t Burger::Sequencer::m_uBytesToGenerate
protected

Number of bytes to generate.

◆ m_uCallbackID

unsigned long Burger::Sequencer::m_uCallbackID
protected

ID of the callback thread (Windows only)

◆ m_uChunkSize

uintptr_t Burger::Sequencer::m_uChunkSize
protected

Number of bytes per time quantum (50Hz)

◆ m_uCurrentIDPattern

uint_t Burger::Sequencer::m_uCurrentIDPattern
protected

Current ID Pattern.

◆ m_uCurrentSpeed

uint_t Burger::Sequencer::m_uCurrentSpeed
protected

Current speed.

◆ m_uFinalSampleRate

uint_t Burger::Sequencer::m_uFinalSampleRate
protected

Mix to this many samples per second.

◆ m_uFineSpeed

uint_t Burger::Sequencer::m_uFineSpeed
protected

Current fine speed.

◆ m_uImporterCount

uint_t Burger::Sequencer::m_uImporterCount
protected

Number of pointers in m_pImporters.

◆ m_uMasterPitch

uint_t Burger::Sequencer::m_uMasterPitch
protected

Current music pitch, 80 = normal.

◆ m_uMasterSpeed

uint_t Burger::Sequencer::m_uMasterSpeed
protected

Current music speed, 80 = normal.

◆ m_uMaxVoices

uint_t Burger::Sequencer::m_uMaxVoices
protected

Active number of track for the currently playing song.

◆ m_uMicroDelayBufferSize

uintptr_t Burger::Sequencer::m_uMicroDelayBufferSize
protected

Size in bytes of the delay buffer.

◆ m_uMicroDelayDuration

uint_t Burger::Sequencer::m_uMicroDelayDuration
protected

Micro delay duration (min 0 ms, max 1000 ms)

◆ m_uPartitionPosition

uint_t Burger::Sequencer::m_uPartitionPosition
protected

Current position in partition.

◆ m_uPatternPosition

uint_t Burger::Sequencer::m_uPatternPosition
protected

Current position in pattern.

◆ m_uReverbDelayBufferSize

uintptr_t Burger::Sequencer::m_uReverbDelayBufferSize
protected

Length in samples of the reverb buffer.

◆ m_uReverbSizeMS

uint_t Burger::Sequencer::m_uReverbSizeMS
protected

Reverb delay duration (min 25 ms, max 1000 ms)

◆ m_uReverbStrength

uint_t Burger::Sequencer::m_uReverbStrength
protected

Reverb strength in % (0 <-> 70, default 20%)

◆ m_uSpeedCounter

uint_t Burger::Sequencer::m_uSpeedCounter
protected

Current mark for song speed.

◆ m_uVolume

uint_t Burger::Sequencer::m_uVolume
protected

Burgerlib volume for the song (0-255)