Beispiel #1
0
 void restart()
 {
   if (tune != NULL) {
     stop_mod();
     done = 0;
     play_mod(tune, 0);
   }
 }
Beispiel #2
0
void destroy_mod (JGMOD *j)
{
    int index;
    PATTERN_INFO *pi;

    if (j == null)
        return;

    if (of == j)
        stop_mod();

    if (j->si != null)
        {
        _unlock_dpmi_data (j->si, sizeof (SAMPLE_INFO) * j->no_sample);
        free (j->si);
        }

    if (j->ii != null)
        {
        _unlock_dpmi_data (j->ii, sizeof (INSTRUMENT_INFO) * j->no_instrument);
        free (j->ii);
        }

    if (j->pi != null)
        {
        for (index=0; index<j->no_pat; index++)
            {
            pi = j->pi+index;
            if (pi->ni != null)
                {
                _unlock_dpmi_data (pi->ni, sizeof (NOTE_INFO) * j->no_chn * pi->no_pos);
                free (pi->ni);
                }
            }
        _unlock_dpmi_data (j->pi, sizeof (PATTERN_INFO) * j->no_pat);
        free (j->pi);
        }

    for (index=0; index < j->no_sample; index++)
        {
        if (j->s + index)
            {
            if (j->s[index].data)
                {
                _unlock_dpmi_data (j->s[index].data, j->s[index].len * (j->s[index].bits / 8) );
                free (j->s[index].data);
                }
            }
        }

    _unlock_dpmi_data (j->s, sizeof (SAMPLE) * j->no_sample);
    free (j->s);

    _unlock_dpmi_data (j, sizeof (JGMOD));
    free (j);
    j = null;
}
Beispiel #3
0
void remove_mod (void)
{
    int index;

    stop_mod();
    remove_int (mod_interrupt);

    for (index=0; index<MAX_ALLEG_VOICE; index++)
        {
        if (voice_table[index] >= 0)
            deallocate_voice (voice_table[index]);

        voice_table[index] = -1;
        }

    mod_init = FALSE;
}
void MYMOD::destroy()
{
    stop_mod();
    destroy_mod(tune);
    tune = NULL;
}
Beispiel #5
0
void play_mod (JGMOD *j, int loop)
{
    int index;
    int temp;

    if (j == null)
        {
        sprintf (jgmod_error, "Can't play a JGMOD pointer with null value");
        return;
        }

    if (of != null)     // make sure only one mod being played.
        stop_mod();

    mi.flag = j->flag;
    for (index=0 ;index<MAX_ALLEG_VOICE; index++)
        {
        ci[index].keyon = FALSE;
        ci[index].kick = FALSE;
        ci[index].instrument = 0;
        ci[index].note = 0;
        ci[index].sample = 0;
        ci[index].volume = 0;
        ci[index].period = 0;
        ci[index].transpose = 0;
        ci[index].temp_volume = 0;
        ci[index].temp_period = 0;
        ci[index].volfade = 32768;
        ci[index].instfade = 0;

        ci[index].pan_slide_common = 0;
        ci[index].pan_slide = 0;
        ci[index].pan_slide_left = 0;
        ci[index].pan_slide_right = 0;

        ci[index].pro_pitch_slide_on = FALSE;
        ci[index].pro_pitch_slide = 0;
        ci[index].pro_fine_pitch_slide = 0;
        ci[index].s3m_pitch_slide_on = FALSE;
        ci[index].s3m_pitch_slide = 0;
        ci[index].s3m_fine_pitch_slide = 0;
        ci[index].xm_pitch_slide_up_on = FALSE;
        ci[index].xm_pitch_slide_up = 0;
        ci[index].xm_pitch_slide_down_on = FALSE;
        ci[index].xm_pitch_slide_down = 0;
        ci[index].xm_fine_pitch_slide_up = 0;
        ci[index].xm_fine_pitch_slide_down = 0;

        ci[index].pro_volume_slide = 0;
        ci[index].s3m_volume_slide_on = FALSE;
        ci[index].s3m_fine_volume_slide = 0;
        ci[index].s3m_volume_slide = 0;
        ci[index].xm_volume_slide_on = FALSE;
        ci[index].xm_volume_slide = 0;
        ci[index].xm_fine_volume_slide_up = 0;
        ci[index].xm_fine_volume_slide_down = 0;

        ci[index].loop_on = FALSE;
        ci[index].loop_start = 0;
        ci[index].loop_times = 0;

        ci[index].tremolo_on = FALSE;
        ci[index].tremolo_waveform = 0;
        ci[index].tremolo_pointer = 0;
        ci[index].tremolo_speed = 0;
        ci[index].tremolo_depth = 0;
        ci[index].tremolo_shift = 6;

        ci[index].vibrato_on = FALSE;
        ci[index].vibrato_waveform = 0;
        ci[index].vibrato_pointer = 0;
        ci[index].vibrato_speed = 0;
        ci[index].vibrato_depth = 0;
        ci[index].vibrato_shift = 5;

        ci[index].slide2period_on = FALSE;
        ci[index].slide2period_spd = 0;
        ci[index].slide2period = 0;

        ci[index].arpeggio_on = TRUE;
        ci[index].arpeggio = 0;

        ci[index].tremor_on = 0;
        ci[index].tremor_count = 0;
        ci[index].tremor_set = 0;

        ci[index].delay_sample = 0;
        ci[index].cut_sample = 0;
        ci[index].glissando = FALSE;
        ci[index].retrig = 0;
        ci[index].s3m_retrig_on = FALSE;
        ci[index].s3m_retrig = 0;
        ci[index].s3m_retrig_slide = 0;

        ci[index].sample_offset_on = FALSE;
        ci[index].sample_offset = 0;

        ci[index].global_volume_slide_on = FALSE;
        ci[index].global_volume_slide = 0;

        ci[index].volenv.flg = 0;
        ci[index].volenv.pts = 0;
        ci[index].volenv.loopbeg = 0;
        ci[index].volenv.loopend = 0;
        ci[index].volenv.susbeg = 0;
        ci[index].volenv.susend = 0;
        ci[index].volenv.a = 0;
        ci[index].volenv.b = 0;
        ci[index].volenv.p = 0;
        ci[index].volenv.v = 64;

        ci[index].panenv.flg = 0;
        ci[index].panenv.pts = 0;
        ci[index].panenv.loopbeg = 0;
        ci[index].panenv.loopend = 0;
        ci[index].panenv.susbeg = 0;
        ci[index].panenv.susend = 0;
        ci[index].panenv.a = 0;
        ci[index].panenv.b = 0;
        ci[index].panenv.p = 0;
        ci[index].panenv.v = 32;

        for (temp=0; temp < 12; temp++)
            {
            ci[index].volenv.env[temp] = 0;
            ci[index].volenv.pos[temp] = 0;

            ci[index].panenv.env[temp] = 0;
            ci[index].panenv.pos[temp] = 0;
            }

        if (j->flag & XM_MODE)
            ci[index].c2spd = 0;
        else
            ci[index].c2spd = 8363;

        if (index < mi.max_chn)
            ci[index].pan = *(j->panning + index);
        }

    mi.no_chn = j->no_chn;
    mi.tick = -1;
    mi.pos = 0;
    mi.pat = *(j->pat_table);
    mi.trk = 0;

    mi.bpm = j->bpm;
    mi.tempo = j->tempo;
    mi.global_volume = j->global_volume;

    mi.new_pos = 0;
    mi.new_trk = 0;
    mi.pattern_delay = 0;
    mi.pause   = FALSE;
    mi.forbid  = FALSE;
    mi.is_playing = TRUE;

    if (loop == FALSE)
        mi.loop = FALSE;
    else
        mi.loop = TRUE;

    of = j;

    //remove_int (mod_interrupt);
    install_int_ex (mod_interrupt, BPM_TO_TIMER (24 * j->bpm * mi.speed_ratio / 100));
}END_OF_FUNCTION (play_mod)
Beispiel #6
0
 void destroy()
 {
   stop_mod();
   destroy_mod(tune);
   tune = NULL;
 }