QWrk Class Reference

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

#include <qwrk.h>

Inheritance diagram for QWrk:

Inheritance graph
[legend]

List of all members.

Classes

class  QWrkPrivate
struct  RecTempo

Signals

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

Public Member Functions

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


Detailed Description

Cakewalk WRK file format (input only).

This class is used to parse Cakewalk WRK Files

Examples:

dumpwrk.cpp, and guiplayer.cpp.

Definition at line 80 of file qwrk.h.


Constructor & Destructor Documentation

QWrk ( QObject parent = 0  ) 

Definition at line 122 of file qwrk.cpp.

~QWrk (  )  [virtual]

Definition at line 127 of file qwrk.cpp.


Member Function Documentation

bool getAutoRestart (  )  const

Auto-restart?

Returns:
Auto-restart

Definition at line 354 of file qwrk.cpp.

References QWrkPrivate::m_AutoRestart.

bool getAutoRewind (  )  const

Auto-rewind?

Returns:
Auto-rewind

Definition at line 291 of file qwrk.cpp.

References QWrkPrivate::m_AutoRewind.

int getAutoSave (  )  const

Auto save (0=disabled, 1.

.256=minutes)

Returns:
Auto save

Definition at line 219 of file qwrk.cpp.

References QWrkPrivate::m_AutoSave.

bool getAutoStop (  )  const

Auto-stop?

Returns:
Auto-stop

Definition at line 273 of file qwrk.cpp.

References QWrkPrivate::m_AutoStop.

int getClock (  )  const

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

Returns:
Clock Source

Definition at line 210 of file qwrk.cpp.

References QWrkPrivate::m_Clock.

int getCountIn (  )  const

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

Returns:
Measures of count-in

Definition at line 336 of file qwrk.cpp.

References QWrkPrivate::m_CountIn.

int getCurTempoOfs (  )  const

Which of the 3 tempo offsets is used: 0.

.2

Returns:
tempo offset index

Definition at line 363 of file qwrk.cpp.

References QWrkPrivate::m_CurTempoOfs.

int getEndAllTime (  )  const

Time of latest event (incl.

all tracks)

Returns:
Time of latest event

Definition at line 456 of file qwrk.cpp.

References QWrkPrivate::m_EndAllTime.

long getFilePos (  ) 

Current position in the data stream.

Returns:
current position

Definition at line 590 of file qwrk.cpp.

References QWrkPrivate::m_IOStream.

int getFrom (  )  const

From marker time.

Returns:
From marker time

Definition at line 183 of file qwrk.cpp.

References QWrkPrivate::m_From.

int getKeySig (  )  const

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

.. 11=B)

Returns:
Key signature

Definition at line 201 of file qwrk.cpp.

References QWrkPrivate::m_KeySig.

QByteArray getLastChunkRawData (  )  const

Gets the last chunk raw data (undecoded).

Returns:
last chunk raw data

Definition at line 157 of file qwrk.cpp.

References QWrkPrivate::m_lastChunkData.

bool getMetroAccent (  )  const

Metronome accents primary beats?

Returns:
Metronome accents primary beats

Definition at line 327 of file qwrk.cpp.

References QWrkPrivate::m_MetroAccent.

bool getMetroPlay (  )  const

Metronome on during playback?

Returns:
Metronome on during playback

Definition at line 309 of file qwrk.cpp.

References QWrkPrivate::m_MetroPlay.

bool getMetroRecord (  )  const

Metronome on during recording?

Returns:
Metronome on during recording

Definition at line 318 of file qwrk.cpp.

References QWrkPrivate::m_MetroRecord.

int getNow (  )  const

Now marker time.

Returns:
Now marker time

Definition at line 174 of file qwrk.cpp.

References QWrkPrivate::m_Now.

bool getPatchSearch (  )  const

Patch/controller search-back?

Returns:
Patch/controller search-back

Definition at line 264 of file qwrk.cpp.

References QWrkPrivate::m_PatchSearch.

int getPlayDelay (  )  const

Play Delay.

Returns:
Play Delay

Definition at line 228 of file qwrk.cpp.

References QWrkPrivate::m_PlayDelay.

bool getPunchEnabled (  )  const

Auto-Punch enabled?

Returns:
Auto-Punch enabled

Definition at line 429 of file qwrk.cpp.

References QWrkPrivate::m_PunchEnabled.

int getPunchInTime (  )  const

Punch-in time.

Returns:
punch-in time

Definition at line 438 of file qwrk.cpp.

References QWrkPrivate::m_PunchInTime.

int getPunchOutTime (  )  const

Punch-out time.

Returns:
Punch-out time

Definition at line 447 of file qwrk.cpp.

References QWrkPrivate::m_PunchOutTime.

double getRealTime ( long  ticks  )  const

Definition at line 873 of file qwrk.cpp.

References QWrkPrivate::m_division, and QWrkPrivate::m_tempos.

int getRewindTime (  )  const

Auto-rewind time.

Returns:
Auto-rewind time

Definition at line 300 of file qwrk.cpp.

References QWrkPrivate::m_RewindTime.

bool getSendCont (  )  const

Send MIDI Continue?

Returns:
Send MIDI Continue

Definition at line 255 of file qwrk.cpp.

References QWrkPrivate::m_SendCont.

bool getSendSPP (  )  const

Send Song Position Pointer?

Returns:
Send Song Position Pointer

Definition at line 246 of file qwrk.cpp.

References QWrkPrivate::m_SendSPP.

unsigned int getStopTime (  )  const

Auto-stop time.

Returns:
Auto-stop time

Definition at line 282 of file qwrk.cpp.

References QWrkPrivate::m_StopTime.

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 382 of file qwrk.cpp.

References QWrkPrivate::m_TempoOfs1.

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 401 of file qwrk.cpp.

References QWrkPrivate::m_TempoOfs2.

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 420 of file qwrk.cpp.

References QWrkPrivate::m_TempoOfs3.

QTextCodec * getTextCodec (  ) 

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

Returns:
QTextCodec pointer

Definition at line 136 of file qwrk.cpp.

References QWrkPrivate::m_codec.

int getThru (  )  const

Thru marker time.

Returns:
Thru marker time

Definition at line 192 of file qwrk.cpp.

References QWrkPrivate::m_Thru.

bool getThruOn (  )  const

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

Returns:
MIDI Thru enabled

Definition at line 345 of file qwrk.cpp.

References QWrkPrivate::m_ThruOn.

bool getZeroCtrls (  )  const

Zero continuous controllers?

Returns:
Zero continuous controllers

Definition at line 237 of file qwrk.cpp.

References QWrkPrivate::m_ZeroCtrls.

void readFromFile ( const QString &  fileName  ) 

Reads a stream from a disk file.

Parameters:
fileName Name of an existing file.

Definition at line 637 of file qwrk.cpp.

References QWrk::readFromStream().

void readFromStream ( QDataStream *  stream  ) 

Reads a stream.

Parameters:
stream Pointer to an existing and opened stream

Definition at line 627 of file qwrk.cpp.

References QWrkPrivate::m_IOStream.

Referenced by QWrk::readFromFile().

void setTextCodec ( QTextCodec *  codec  ) 

Sets the text codec for text meta-events.

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

Parameters:
codec QTextCodec pointer

Definition at line 147 of file qwrk.cpp.

References QWrkPrivate::m_codec.

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

Emitted after reading a Channel Aftertouch message.

Parameters:
track track number
time musical time
chan MIDI Channel
press Pressure amount

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

Emitted after reading a chord diagram chunk.

Parameters:
track track number
time event time in ticks
name chord name
data chord data definition (not decoded)

void signalWRKComments ( const QString &  data  )  [signal]

Emitted after reading a comments chunk.

Parameters:
data file text comments

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

Emitted after reading a Control Change message.

Parameters:
track track number
time musical time
chan MIDI Channel
ctl MIDI Controller
value Control value

void signalWRKEnd (  )  [signal]

Emitted after reading the last chunk of a WRK file.

void signalWRKError ( const QString &  errorStr  )  [signal]

Emitted for a WRK file read error.

Parameters:
errorStr Error string

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

Emitted after reading an expression indication (notation) chunk.

Parameters:
track track number
time event time in ticks
code expression event code
text expression text

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()

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

Emitted after reading a hairpin symbol (notation) chunk.

Parameters:
track track number
time event time in ticks
code hairpin code
dur duration

void signalWRKHeader ( int  verh,
int  verl 
) [signal]

Emitted after reading a WRK header.

Parameters:
verh WRK file format version major
verl WRK file format version minor

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

Emitted after reading a Polyphonic Aftertouch message.

Parameters:
track track number
time musical time
chan MIDI Channel
pitch MIDI Note
press Pressure amount

void signalWRKKeySig ( int  bar,
int  alt 
) [signal]

Emitted after reading a WRK Key Signature.

Parameters:
bar Measure number
alt Number of alterations (negative=flats, positive=sharps)

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:
name track name
trackno track number
channel forced MIDI channel
pitch Note transposition
velocity Velocity increment
port MIDI port number
selected track is selected
muted track is muted
loop track loop enabled

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

Emitted after reading a Note message.

Parameters:
track track number
time musical time
chan MIDI Channel
pitch MIDI Note
vol Velocity
dur Duration

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

Emitted after reading a Bender message.

Parameters:
track track number
time musical time
chan MIDI Channel
value Bender value

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

Emitted after reading a Program change message.

Parameters:
track track number
time musical time
chan MIDI Channel
patch Program number

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

Emitted after reading a segment prefix chunk.

Parameters:
track track number
time segment time offset
name segment name

void signalWRKSoftVer ( const QString &  version  )  [signal]

Emitted after reading a software version chunk.

Parameters:
version software version string

void signalWRKStreamEnd ( long  time  )  [signal]

Emitted after reading the last event of a event stream.

void signalWRKStringTable ( const QStringList &  strs  )  [signal]

Emitted after reading a string event types chunk.

Parameters:
strs list of declared string event types

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

Emitted after reading a System Exclusive Bank.

Parameters:
bank Sysex Bank number
name Sysex Bank name
autosend Send automatically after loading the song
port MIDI output port
data Sysex bytes

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

Emitted after reading a System Exclusive event.

Parameters:
track track number
time musical time
bank Sysex Bank number

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:
time musical time
tempo beats per minute multiplied by 100

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

Emitted after reading a text message.

Parameters:
track track number
time musical time
type Text type
data Text data

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)
port MIDI port
channel MIDI channel
keyPlus Note transpose
velPlus Velocity transpose
localPort MIDI local port

void signalWRKTimeBase ( int  timebase  )  [signal]

Emitted after reading the timebase chunk.

Parameters:
timebase ticks per quarter note

void signalWRKTimeFormat ( int  frames,
int  offset 
) [signal]

Emitted after reading a SMPTE time format chunk.

Parameters:
frames frames/sec (24, 25, 29=30-drop, 30)
offset frames of offset

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

Emitted after reading a WRK Time signature.

Parameters:
bar Measure number
num Numerator
den Denominator (exponent in a power of two)

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:
name1 track 1st name
name2 track 2nd name
trackno track number
channel track forced channel (-1=no forced)
pitch track pitch transpose in semitones (-127..127)
velocity track velocity increment (-127..127)
port track forced port
selected true if track is selected
muted true if track is muted
loop true if loop is enabled

void signalWRKTrackBank ( int  track,
int  bank 
) [signal]

Emitted after reading a track bank chunk.

Parameters:
track track number
bank 

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

Emitted after reading a track name chunk.

Parameters:
track track number
name track name

void signalWRKTrackOffset ( int  track,
int  offset 
) [signal]

Emitted after reading a track offset chunk.

Parameters:
track track number
offset time offset

void signalWRKTrackPatch ( int  track,
int  patch 
) [signal]

Emitted after reading a track patch chunk.

Parameters:
track track number
patch 

void signalWRKTrackReps ( int  track,
int  reps 
) [signal]

Emitted after reading a track offset chunk.

Parameters:
track track number
reps number of repetitions

void signalWRKTrackVol ( int  track,
int  vol 
) [signal]

Emitted after reading a track volume chunk.

Parameters:
track track number
vol initial volume

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

Emitted after reading an unknown chunk.

Parameters:
type chunk type
data chunk data (not decoded)

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:
name record identifier
data record variable data


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

Generated on Wed Sep 8 10:12:54 2010 for drumstick by  doxygen 1.5.9