drumstick  0.5.0
QWrk Class Reference

Cakewalk WRK file format (input only) More...

#include <qwrk.h>

Inheritance diagram for QWrk:

Signals

void signalWRKError (const QString &errorStr)
 Emitted for a WRK file read error. More...
 
void signalWRKUnknownChunk (int type, const QByteArray &data)
 Emitted after reading an unknown chunk. More...
 
void signalWRKHeader (int verh, int verl)
 Emitted after reading a WRK header. More...
 
void signalWRKEnd ()
 Emitted after reading the last chunk of a WRK file.
 
void signalWRKStreamEnd (long time)
 Emitted after reading the last event of a event stream.
 
void signalWRKNote (int track, long time, int chan, int pitch, int vol, int dur)
 Emitted after reading a Note message. More...
 
void signalWRKKeyPress (int track, long time, int chan, int pitch, int press)
 Emitted after reading a Polyphonic Aftertouch message. More...
 
void signalWRKCtlChange (int track, long time, int chan, int ctl, int value)
 Emitted after reading a Control Change message. More...
 
void signalWRKPitchBend (int track, long time, int chan, int value)
 Emitted after reading a Bender message. More...
 
void signalWRKProgram (int track, long time, int chan, int patch)
 Emitted after reading a Program change message. More...
 
void signalWRKChanPress (int track, long time, int chan, int press)
 Emitted after reading a Channel Aftertouch message. More...
 
void signalWRKSysexEvent (int track, long time, int bank)
 Emitted after reading a System Exclusive event. More...
 
void signalWRKSysex (int bank, const QString &name, bool autosend, int port, const QByteArray &data)
 Emitted after reading a System Exclusive Bank. More...
 
void signalWRKText (int track, long time, int type, const QString &data)
 Emitted after reading a text message. More...
 
void signalWRKTimeSig (int bar, int num, int den)
 Emitted after reading a WRK Time signature. More...
 
void signalWRKKeySig (int bar, int alt)
 Emitted after reading a WRK Key Signature. More...
 
void signalWRKTempo (long time, int tempo)
 Emitted after reading a Tempo Change message. More...
 
void signalWRKTrack (const QString &name1, const QString &name2, int trackno, int channel, int pitch, int velocity, int port, bool selected, bool muted, bool loop)
 Emitted after reading a track prefix chunk. More...
 
void signalWRKTimeBase (int timebase)
 Emitted after reading the timebase chunk. More...
 
void signalWRKGlobalVars ()
 Emitted after reading the global variables chunk. More...
 
void signalWRKThru (int mode, int port, int channel, int keyPlus, int velPlus, int localPort)
 Emitted after reading an Extended Thru parameters chunk. More...
 
void signalWRKTrackOffset (int track, int offset)
 Emitted after reading a track offset chunk. More...
 
void signalWRKTrackReps (int track, int reps)
 Emitted after reading a track offset chunk. More...
 
void signalWRKTrackPatch (int track, int patch)
 Emitted after reading a track patch chunk. More...
 
void signalWRKTrackBank (int track, int bank)
 Emitted after reading a track bank chunk. More...
 
void signalWRKTimeFormat (int frames, int offset)
 Emitted after reading a SMPTE time format chunk. More...
 
void signalWRKComments (const QString &data)
 Emitted after reading a comments chunk. More...
 
void signalWRKVariableRecord (const QString &name, const QByteArray &data)
 Emitted after reading a variable chunk. More...
 
void signalWRKTrackVol (int track, int vol)
 Emitted after reading a track volume chunk. More...
 
void signalWRKNewTrack (const QString &name, int trackno, int channel, int pitch, int velocity, int port, bool selected, bool muted, bool loop)
 Emitted after reading a new track prefix. More...
 
void signalWRKSoftVer (const QString &version)
 Emitted after reading a software version chunk. More...
 
void signalWRKTrackName (int track, const QString &name)
 Emitted after reading a track name chunk. More...
 
void signalWRKStringTable (const QStringList &strs)
 Emitted after reading a string event types chunk. More...
 
void signalWRKSegment (int track, long time, const QString &name)
 Emitted after reading a segment prefix chunk. More...
 
void signalWRKChord (int track, long time, const QString &name, const QByteArray &data)
 Emitted after reading a chord diagram chunk. More...
 
void signalWRKExpression (int track, long time, int code, const QString &text)
 Emitted after reading an expression indication (notation) chunk. More...
 
void signalWRKHairpin (int track, long time, int code, int dur)
 Emitted after reading a hairpin symbol (notation) chunk. More...
 

Public Member Functions

 QWrk (QObject *parent=0)
 Constructor.
 
virtual ~QWrk ()
 Destructor.
 
void readFromStream (QDataStream *stream)
 Reads a stream. More...
 
void readFromFile (const QString &fileName)
 Reads a stream from a disk file. More...
 
QTextCodec * getTextCodec ()
 Gets the text codec used for text meta-events I/O. More...
 
void setTextCodec (QTextCodec *codec)
 Sets the text codec for text meta-events. More...
 
long getFilePos ()
 Current position in the data stream. More...
 
int getNow () const
 Now marker time. More...
 
int getFrom () const
 From marker time. More...
 
int getThru () const
 Thru marker time. More...
 
int getKeySig () const
 Key signature (0=C, 1=C#, ... More...
 
int getClock () const
 Clock Source (0=Int, 1=MIDI, 2=FSK, 3=SMPTE) More...
 
int getAutoSave () const
 Auto save (0=disabled, 1..256=minutes) More...
 
int getPlayDelay () const
 Play Delay. More...
 
bool getZeroCtrls () const
 Zero continuous controllers? More...
 
bool getSendSPP () const
 Send Song Position Pointer? More...
 
bool getSendCont () const
 Send MIDI Continue? More...
 
bool getPatchSearch () const
 Patch/controller search-back? More...
 
bool getAutoStop () const
 Auto-stop? More...
 
unsigned int getStopTime () const
 Auto-stop time. More...
 
bool getAutoRewind () const
 Auto-rewind? More...
 
int getRewindTime () const
 Auto-rewind time. More...
 
bool getMetroPlay () const
 Metronome on during playback? More...
 
bool getMetroRecord () const
 Metronome on during recording? More...
 
bool getMetroAccent () const
 Metronome accents primary beats? More...
 
int getCountIn () const
 Measures of count-in (0=no count-in) More...
 
bool getThruOn () const
 MIDI Thru enabled? (only used if no THRU rec) More...
 
bool getAutoRestart () const
 Auto-restart? More...
 
int getCurTempoOfs () const
 Which of the 3 tempo offsets is used: 0..2. More...
 
int getTempoOfs1 () const
 Fixed-point ratio value of tempo offset 1. More...
 
int getTempoOfs2 () const
 Fixed-point ratio value of tempo offset 2. More...
 
int getTempoOfs3 () const
 Fixed-point ratio value of tempo offset 3. More...
 
bool getPunchEnabled () const
 Auto-Punch enabled? More...
 
int getPunchInTime () const
 Punch-in time. More...
 
int getPunchOutTime () const
 Punch-out time. More...
 
int getEndAllTime () const
 Time of latest event (incl. More...
 
QByteArray getLastChunkRawData () const
 Gets the last chunk raw data (undecoded) More...
 

Detailed Description

Cakewalk WRK file format (input only)

This class is used to parse Cakewalk WRK Files

Since
0.3.0
Examples
dumpwrk.cpp, and guiplayer.cpp.

Definition at line 81 of file qwrk.h.

Member Function Documentation

◆ getAutoRestart()

bool getAutoRestart ( ) const

Auto-restart?

Returns
Auto-restart

Definition at line 360 of file qwrk.cpp.

◆ getAutoRewind()

bool getAutoRewind ( ) const

Auto-rewind?

Returns
Auto-rewind

Definition at line 297 of file qwrk.cpp.

◆ getAutoSave()

int getAutoSave ( ) const

Auto save (0=disabled, 1..256=minutes)

Returns
Auto save

Definition at line 225 of file qwrk.cpp.

◆ getAutoStop()

bool getAutoStop ( ) const

Auto-stop?

Returns
Auto-stop

Definition at line 279 of file qwrk.cpp.

◆ getClock()

int getClock ( ) const

Clock Source (0=Int, 1=MIDI, 2=FSK, 3=SMPTE)

Returns
Clock Source

Definition at line 216 of file qwrk.cpp.

◆ getCountIn()

int getCountIn ( ) const

Measures of count-in (0=no count-in)

Returns
Measures of count-in

Definition at line 342 of file qwrk.cpp.

◆ getCurTempoOfs()

int getCurTempoOfs ( ) const

Which of the 3 tempo offsets is used: 0..2.

Returns
tempo offset index

Definition at line 369 of file qwrk.cpp.

◆ getEndAllTime()

int getEndAllTime ( ) const

Time of latest event (incl.

all tracks)

Returns
Time of latest event

Definition at line 462 of file qwrk.cpp.

◆ getFilePos()

long getFilePos ( )

Current position in the data stream.

Returns
current position

Definition at line 596 of file qwrk.cpp.

◆ getFrom()

int getFrom ( ) const

From marker time.

Returns
From marker time

Definition at line 189 of file qwrk.cpp.

◆ getKeySig()

int getKeySig ( ) const

Key signature (0=C, 1=C#, ...

11=B)

Returns
Key signature

Definition at line 207 of file qwrk.cpp.

◆ getLastChunkRawData()

QByteArray getLastChunkRawData ( ) const

Gets the last chunk raw data (undecoded)

Returns
last chunk raw data

Definition at line 163 of file qwrk.cpp.

◆ getMetroAccent()

bool getMetroAccent ( ) const

Metronome accents primary beats?

Returns
Metronome accents primary beats

Definition at line 333 of file qwrk.cpp.

◆ getMetroPlay()

bool getMetroPlay ( ) const

Metronome on during playback?

Returns
Metronome on during playback

Definition at line 315 of file qwrk.cpp.

◆ getMetroRecord()

bool getMetroRecord ( ) const

Metronome on during recording?

Returns
Metronome on during recording

Definition at line 324 of file qwrk.cpp.

◆ getNow()

int getNow ( ) const

Now marker time.

Returns
Now marker time

Definition at line 180 of file qwrk.cpp.

◆ getPatchSearch()

bool getPatchSearch ( ) const

Patch/controller search-back?

Returns
Patch/controller search-back

Definition at line 270 of file qwrk.cpp.

◆ getPlayDelay()

int getPlayDelay ( ) const

Play Delay.

Returns
Play Delay

Definition at line 234 of file qwrk.cpp.

◆ getPunchEnabled()

bool getPunchEnabled ( ) const

Auto-Punch enabled?

Returns
Auto-Punch enabled

Definition at line 435 of file qwrk.cpp.

◆ getPunchInTime()

int getPunchInTime ( ) const

Punch-in time.

Returns
punch-in time

Definition at line 444 of file qwrk.cpp.

◆ getPunchOutTime()

int getPunchOutTime ( ) const

Punch-out time.

Returns
Punch-out time

Definition at line 453 of file qwrk.cpp.

◆ getRewindTime()

int getRewindTime ( ) const

Auto-rewind time.

Returns
Auto-rewind time

Definition at line 306 of file qwrk.cpp.

◆ getSendCont()

bool getSendCont ( ) const

Send MIDI Continue?

Returns
Send MIDI Continue

Definition at line 261 of file qwrk.cpp.

◆ getSendSPP()

bool getSendSPP ( ) const

Send Song Position Pointer?

Returns
Send Song Position Pointer

Definition at line 252 of file qwrk.cpp.

◆ getStopTime()

unsigned int getStopTime ( ) const

Auto-stop time.

Returns
Auto-stop time

Definition at line 288 of file qwrk.cpp.

◆ getTempoOfs1()

int getTempoOfs1 ( ) const

Fixed-point ratio value of tempo offset 1.

NOTE: The offset ratios are expressed as a numerator in the expression n/64. To get a ratio from this number, divide the number by 64. To get this number from a ratio, multiply the ratio by 64. Examples: 32 ==> 32/64 = 0.5 63 ==> 63/64 = 0.9 64 ==> 64/64 = 1.0 128 ==> 128/64 = 2.0

Returns
tempo offset 1

Definition at line 388 of file qwrk.cpp.

◆ getTempoOfs2()

int getTempoOfs2 ( ) const

Fixed-point ratio value of tempo offset 2.

NOTE: The offset ratios are expressed as a numerator in the expression n/64. To get a ratio from this number, divide the number by 64. To get this number from a ratio, multiply the ratio by 64. Examples: 32 ==> 32/64 = 0.5 63 ==> 63/64 = 0.9 64 ==> 64/64 = 1.0 128 ==> 128/64 = 2.0

Returns
tempo offset 2

Definition at line 407 of file qwrk.cpp.

◆ getTempoOfs3()

int getTempoOfs3 ( ) const

Fixed-point ratio value of tempo offset 3.

NOTE: The offset ratios are expressed as a numerator in the expression n/64. To get a ratio from this number, divide the number by 64. To get this number from a ratio, multiply the ratio by 64. Examples: 32 ==> 32/64 = 0.5 63 ==> 63/64 = 0.9 64 ==> 64/64 = 1.0 128 ==> 128/64 = 2.0

Returns
tempo offset 3

Definition at line 426 of file qwrk.cpp.

◆ getTextCodec()

QTextCodec * getTextCodec ( )

Gets the text codec used for text meta-events I/O.

Returns
QTextCodec pointer

Definition at line 142 of file qwrk.cpp.

◆ getThru()

int getThru ( ) const

Thru marker time.

Returns
Thru marker time

Definition at line 198 of file qwrk.cpp.

◆ getThruOn()

bool getThruOn ( ) const

MIDI Thru enabled? (only used if no THRU rec)

Returns
MIDI Thru enabled

Definition at line 351 of file qwrk.cpp.

◆ getZeroCtrls()

bool getZeroCtrls ( ) const

Zero continuous controllers?

Returns
Zero continuous controllers

Definition at line 243 of file qwrk.cpp.

◆ readFromFile()

void readFromFile ( const QString &  fileName)

Reads a stream from a disk file.

Parameters
fileNameName of an existing file.

Definition at line 643 of file qwrk.cpp.

References QWrk::readFromStream().

◆ readFromStream()

void readFromStream ( QDataStream *  stream)

Reads a stream.

Parameters
streamPointer to an existing and opened stream

Definition at line 633 of file qwrk.cpp.

Referenced by QWrk::readFromFile().

◆ setTextCodec()

void setTextCodec ( QTextCodec *  codec)

Sets the text codec for text meta-events.

The engine doesn't take ownership of the codec instance.

Parameters
codecQTextCodec pointer

Definition at line 153 of file qwrk.cpp.

◆ signalWRKChanPress

void signalWRKChanPress ( int  track,
long  time,
int  chan,
int  press 
)
signal

Emitted after reading a Channel Aftertouch message.

Parameters
tracktrack number
timemusical time
chanMIDI Channel
pressPressure amount

◆ signalWRKChord

void signalWRKChord ( int  track,
long  time,
const QString &  name,
const QByteArray &  data 
)
signal

Emitted after reading a chord diagram chunk.

Parameters
tracktrack number
timeevent time in ticks
namechord name
datachord data definition (not decoded)

◆ signalWRKComments

void signalWRKComments ( const QString &  data)
signal

Emitted after reading a comments chunk.

Parameters
datafile text comments

◆ signalWRKCtlChange

void signalWRKCtlChange ( int  track,
long  time,
int  chan,
int  ctl,
int  value 
)
signal

Emitted after reading a Control Change message.

Parameters
tracktrack number
timemusical time
chanMIDI Channel
ctlMIDI Controller
valueControl value

◆ signalWRKError

void signalWRKError ( const QString &  errorStr)
signal

Emitted for a WRK file read error.

Parameters
errorStrError string

◆ signalWRKExpression

void signalWRKExpression ( int  track,
long  time,
int  code,
const QString &  text 
)
signal

Emitted after reading an expression indication (notation) chunk.

Parameters
tracktrack number
timeevent time in ticks
codeexpression event code
textexpression text

◆ signalWRKGlobalVars

void signalWRKGlobalVars ( )
signal

Emitted after reading the global variables chunk.

This record contains miscellaneous Cakewalk global variables that can be retrieved using individual getters.

See also
getNow(), getFrom(), getThru()

◆ signalWRKHairpin

void signalWRKHairpin ( int  track,
long  time,
int  code,
int  dur 
)
signal

Emitted after reading a hairpin symbol (notation) chunk.

Parameters
tracktrack number
timeevent time in ticks
codehairpin code
durduration

◆ signalWRKHeader

void signalWRKHeader ( int  verh,
int  verl 
)
signal

Emitted after reading a WRK header.

Parameters
verhWRK file format version major
verlWRK file format version minor

◆ signalWRKKeyPress

void signalWRKKeyPress ( int  track,
long  time,
int  chan,
int  pitch,
int  press 
)
signal

Emitted after reading a Polyphonic Aftertouch message.

Parameters
tracktrack number
timemusical time
chanMIDI Channel
pitchMIDI Note
pressPressure amount

◆ signalWRKKeySig

void signalWRKKeySig ( int  bar,
int  alt 
)
signal

Emitted after reading a WRK Key Signature.

Parameters
barMeasure number
altNumber of alterations (negative=flats, positive=sharps)

◆ signalWRKNewTrack

void signalWRKNewTrack ( const QString &  name,
int  trackno,
int  channel,
int  pitch,
int  velocity,
int  port,
bool  selected,
bool  muted,
bool  loop 
)
signal

Emitted after reading a new track prefix.

Parameters
nametrack name
tracknotrack number
channelforced MIDI channel
pitchNote transposition
velocityVelocity increment
portMIDI port number
selectedtrack is selected
mutedtrack is muted
looptrack loop enabled

◆ signalWRKNote

void signalWRKNote ( int  track,
long  time,
int  chan,
int  pitch,
int  vol,
int  dur 
)
signal

Emitted after reading a Note message.

Parameters
tracktrack number
timemusical time
chanMIDI Channel
pitchMIDI Note
volVelocity
durDuration

◆ signalWRKPitchBend

void signalWRKPitchBend ( int  track,
long  time,
int  chan,
int  value 
)
signal

Emitted after reading a Bender message.

Parameters
tracktrack number
timemusical time
chanMIDI Channel
valueBender value

◆ signalWRKProgram

void signalWRKProgram ( int  track,
long  time,
int  chan,
int  patch 
)
signal

Emitted after reading a Program change message.

Parameters
tracktrack number
timemusical time
chanMIDI Channel
patchProgram number

◆ signalWRKSegment

void signalWRKSegment ( int  track,
long  time,
const QString &  name 
)
signal

Emitted after reading a segment prefix chunk.

Parameters
tracktrack number
timesegment time offset
namesegment name

◆ signalWRKSoftVer

void signalWRKSoftVer ( const QString &  version)
signal

Emitted after reading a software version chunk.

Parameters
versionsoftware version string

◆ signalWRKStringTable

void signalWRKStringTable ( const QStringList &  strs)
signal

Emitted after reading a string event types chunk.

Parameters
strslist of declared string event types

◆ signalWRKSysex

void signalWRKSysex ( int  bank,
const QString &  name,
bool  autosend,
int  port,
const QByteArray &  data 
)
signal

Emitted after reading a System Exclusive Bank.

Parameters
bankSysex Bank number
nameSysex Bank name
autosendSend automatically after loading the song
portMIDI output port
dataSysex bytes

◆ signalWRKSysexEvent

void signalWRKSysexEvent ( int  track,
long  time,
int  bank 
)
signal

Emitted after reading a System Exclusive event.

Parameters
tracktrack number
timemusical time
bankSysex Bank number

◆ signalWRKTempo

void signalWRKTempo ( long  time,
int  tempo 
)
signal

Emitted after reading a Tempo Change message.

Tempo units are given in beats * 100 per minute, so to obtain BPM it is necessary to divide by 100 the tempo.

Parameters
timemusical time
tempobeats per minute multiplied by 100

◆ signalWRKText

void signalWRKText ( int  track,
long  time,
int  type,
const QString &  data 
)
signal

Emitted after reading a text message.

Parameters
tracktrack number
timemusical time
typeText type
dataText data

◆ signalWRKThru

void signalWRKThru ( int  mode,
int  port,
int  channel,
int  keyPlus,
int  velPlus,
int  localPort 
)
signal

Emitted after reading an Extended Thru parameters chunk.

It was introduced in Cakewalk version 4.0. These parameters are intended to override the global vars Thruon value, so this record should come after the VARS_CHUNK record. It is optional.

Parameters
mode(auto, off, on)
portMIDI port
channelMIDI channel
keyPlusNote transpose
velPlusVelocity transpose
localPortMIDI local port

◆ signalWRKTimeBase

void signalWRKTimeBase ( int  timebase)
signal

Emitted after reading the timebase chunk.

Parameters
timebaseticks per quarter note

◆ signalWRKTimeFormat

void signalWRKTimeFormat ( int  frames,
int  offset 
)
signal

Emitted after reading a SMPTE time format chunk.

Parameters
framesframes/sec (24, 25, 29=30-drop, 30)
offsetframes of offset

◆ signalWRKTimeSig

void signalWRKTimeSig ( int  bar,
int  num,
int  den 
)
signal

Emitted after reading a WRK Time signature.

Parameters
barMeasure number
numNumerator
denDenominator (exponent in a power of two)

◆ signalWRKTrack

void signalWRKTrack ( const QString &  name1,
const QString &  name2,
int  trackno,
int  channel,
int  pitch,
int  velocity,
int  port,
bool  selected,
bool  muted,
bool  loop 
)
signal

Emitted after reading a track prefix chunk.

Parameters
name1track 1st name
name2track 2nd name
tracknotrack number
channeltrack forced channel (-1=no forced)
pitchtrack pitch transpose in semitones (-127..127)
velocitytrack velocity increment (-127..127)
porttrack forced port
selectedtrue if track is selected
mutedtrue if track is muted
looptrue if loop is enabled

◆ signalWRKTrackBank

void signalWRKTrackBank ( int  track,
int  bank 
)
signal

Emitted after reading a track bank chunk.

Parameters
tracktrack number
bank

◆ signalWRKTrackName

void signalWRKTrackName ( int  track,
const QString &  name 
)
signal

Emitted after reading a track name chunk.

Parameters
tracktrack number
nametrack name

◆ signalWRKTrackOffset

void signalWRKTrackOffset ( int  track,
int  offset 
)
signal

Emitted after reading a track offset chunk.

Parameters
tracktrack number
offsettime offset

◆ signalWRKTrackPatch

void signalWRKTrackPatch ( int  track,
int  patch 
)
signal

Emitted after reading a track patch chunk.

Parameters
tracktrack number
patch

◆ signalWRKTrackReps

void signalWRKTrackReps ( int  track,
int  reps 
)
signal

Emitted after reading a track offset chunk.

Parameters
tracktrack number
repsnumber of repetitions

◆ signalWRKTrackVol

void signalWRKTrackVol ( int  track,
int  vol 
)
signal

Emitted after reading a track volume chunk.

Parameters
tracktrack number
volinitial volume

◆ signalWRKUnknownChunk

void signalWRKUnknownChunk ( int  type,
const QByteArray &  data 
)
signal

Emitted after reading an unknown chunk.

Parameters
typechunk type
datachunk data (not decoded)

◆ signalWRKVariableRecord

void signalWRKVariableRecord ( const QString &  name,
const QByteArray &  data 
)
signal

Emitted after reading a variable chunk.

This record may contain data in text or binary format.

Parameters
namerecord identifier
datarecord variable data

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