SidTune Class Reference

`#include <SidTune.h>`

## Public Member Functions

| SidTune (const char *fileName, const char **fileNameExt=0, bool separatorIsSlash=false)
| SidTune (const uint_least8_t *oneFileFormatSidtune, uint_least32_t sidtuneLength)
void | setFileNameExtensions (const char **fileNameExt)
void | load (const char *fileName, bool separatorIsSlash=false)
void | read (const uint_least8_t *sourceBuffer, uint_least32_t bufferLen)
unsigned int | selectSong (unsigned int songNum)
const SidTuneInfo * | getInfo () const
const SidTuneInfo * | getInfo (unsigned int songNum)
bool | getStatus () const
const char * | statusString () const
bool | placeSidTuneInC64mem (sidmemory *mem)
const char * | createMD5 (char *md5=0)
const uint_least8_t * | c64Data () const

## Static Public Attributes

static const int | MD5_LENGTH = 32

## Detailed Description

SidTune

Examples:
  demo.cpp.

## Constructor & Destructor Documentation

## SidTune() [1/2]

SidTune::SidTune | ( | const char * | fileName,
|  | const char ** | fileNameExt = `0`,
|  | bool | separatorIsSlash = `false`
| ) |  |

Load a sidtune from a file.

To retrieve data from standard input pass in filename "-". If you want to override the default filename extensions use this contructor. Please note, that if the specified "fileName" does exist and the loader is able to determine its file format, this function does not try to append any file name extension. See "SidTune.cpp" for the default list of file name extensions. You can specify "fileName = 0", if you do not want to load a sidtune. You can later load one with open().

Parameters

  fileName |
  fileNameExt |
  separatorIsSlash |

## SidTune() [2/2]

SidTune::SidTune | ( | const uint_least8_t * | oneFileFormatSidtune,
|  | uint_least32_t | sidtuneLength
| ) |  |

Load a single-file sidtune from a memory buffer. Currently supported: PSID format.

Parameters

  oneFileFormatSidtune | the buffer that contains song data
  sidtuneLength | length of the buffer

## Member Function Documentation

## createMD5()

const char * SidTune::createMD5 | ( | char * | md5 = `0` | ) |

Calculates the MD5 hash of the tune. Not providing an md5 buffer will cause the internal one to be used. If provided, buffer must be MD5_LENGTH + 1

Returns
  a pointer to the buffer containing the md5 string, 0 if no tune is loaded.

## getInfo() [1/2]

const SidTuneInfo * SidTune::getInfo | ( |  | ) | const

Retrieve current active sub-song specific information.

Returns
  a pointer to SidTuneInfo, 0 if no tune is loaded. The pointer must not be deleted.

## getInfo() [2/2]

const SidTuneInfo * SidTune::getInfo | ( | unsigned int | songNum | ) |

Select sub-song and retrieve information.

Parameters

  songNum | the selected song (0 = default starting song)

Returns
  a pointer to SidTuneInfo, 0 if no tune is loaded. The pointer must not be deleted.

## getStatus()

bool SidTune::getStatus | ( |  | ) | const

Determine current state of object. Upon error condition use statusString to get a descriptive text string.

Returns
  current state (true = okay, false = error)

Examples:
  demo.cpp.

## load()

void SidTune::load | ( | const char * | fileName,
|  | bool | separatorIsSlash = `false`
| ) |  |

Load a sidtune into an existing object from a file.

Parameters

  fileName |
  separatorIsSlash |

## placeSidTuneInC64mem()

bool SidTune::placeSidTuneInC64mem | ( | sidmemory * | mem | ) |

Copy sidtune into C64 memory (64 KB).

## read()

void SidTune::read | ( | const uint_least8_t * | sourceBuffer,
|  | uint_least32_t | bufferLen
| ) |  |

Load a sidtune into an existing object from a buffer.

Parameters

  sourceBuffer | the buffer that contains song data
  bufferLen | length of the buffer

## selectSong()

unsigned int SidTune::selectSong | ( | unsigned int | songNum | ) |

Select sub-song.

Parameters

  songNum | the selected song (0 = default starting song)

Returns
  active song number, 0 if no tune is loaded.

Examples:
  demo.cpp.

## setFileNameExtensions()

void SidTune::setFileNameExtensions | ( | const char ** | fileNameExt | ) |

The SidTune class does not copy the list of file name extensions, so make sure you keep it. If the provided pointer is 0, the default list will be activated. This is a static list which is used by all SidTune objects.

Parameters

  fileNameExt |

## statusString()

const char * SidTune::statusString | ( |  | ) | const

Error/status message of last operation.

Examples:
  demo.cpp.

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

- SidTune.h
- SidTune.cpp