MusInitialize()

Syntax

int MusInitialize(musConfig *config);

Arguments

config
the address of configuration structure

Description

It initializes the music player. This function installs music player to the scheduler thread and configures it. Once called, the library API functions can be used. If the relevant entries in the configuration structure are present, then a default sample bank and a default sound effect bank will be defined.

The configuration structure assigned to "config" contains the following data:

  
typedef struct
{
  int           control_flag;
  int           channels;
  OSSched       *sched;
  int           thread_priority;
  unsigned char *heap;
  int           heap_length;
  unsigned char *ptr;
  unsigned char *wbk;
  void          *default_fxbank;
  int           fifo_length;
  int           syn_updates;
  int           syn_output_rate;
  int           syn_rsp_cmds;
  int           syn_retraceCount;
  int           syn_num_dma_bufs;
  int           syn_dma_buf_size;
  OSPiHandle    *diskrom_handle;
} musConfig;

Return Value

The amount of memory, from the heap, used by the music player and audio manager.

Example

int InitMusicPlayer(void)
{
  musConfig init;

  init.control_flag = 0; 
  init.channels = 24;
  init.sched = &scheduler;
  init.thread_priority = 12;

  init.heap = &audio_heap[0];
  init.heap_length = AUDIO_HEAP_SIZE;

  init.fifo_length = 64;

  init.ptr = &ptr_buffer[0];
  init.wbk = &_wbankSegmentRomStart[0];

  init.default_fxbank = NULL;

  init.syn_output_rate = 44100;
  init.syn_updates = 256;
  init.syn_rsp_cmds = 4096;
  init.syn_retraceCount = 1;
  init.syn_num_dma_bufs = 36;
  init.syn_dma_buf_size = 0x1000;

  /* Please delete the following command */
  /* if using a sample stored in 64DD ROM */
  /* init.diskrom_handle = osDriveRomInit(); */

  return (MusInitialize(&init));
}