Subversion Repositories eduke32

Rev

Rev 8769 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8769 Rev 8774
Line 72... Line 72...
72
}
72
}
73
73
74
static int sf2_stream_read(void *handle, void *ptr, unsigned int size) { return kread(*(buildvfs_kfd *)handle, ptr, size); };
74
static int sf2_stream_read(void *handle, void *ptr, unsigned int size) { return kread(*(buildvfs_kfd *)handle, ptr, size); };
75
static int sf2_stream_skip(void *handle, unsigned int size)            { return !klseek(*(buildvfs_kfd *)handle, size, SEEK_CUR); };
75
static int sf2_stream_skip(void *handle, unsigned int size)            { return !klseek(*(buildvfs_kfd *)handle, size, SEEK_CUR); };
76
76
77
static int SF2_Load(char const *const filename)
77
static int SF2_LoadBank(char const *const filename)
78
{
78
{
79
    buildvfs_kfd sf2_kfd    = kopen4loadfrommod(filename, 0);
79
    buildvfs_kfd sf2_kfd    = kopen4loadfrommod(filename, 0);
80
    tsf_stream   sf2_stream = { &sf2_kfd, &sf2_stream_read, &sf2_stream_skip };
80
    tsf_stream   sf2_stream = { &sf2_kfd, &sf2_stream_read, &sf2_stream_skip };
81
81
82
    if (sf2_kfd != buildvfs_kfd_invalid)
82
    if (sf2_kfd != buildvfs_kfd_invalid)
Line 90... Line 90...
90
            MV_Printf(": loaded \"%s\"", filename);
90
            MV_Printf(": loaded \"%s\"", filename);
91
            return SF2_Ok;
91
            return SF2_Ok;
92
        }
92
        }
93
    }
93
    }
94
94
95
    MV_Printf(": error loading \"%s\"!", filename);
95
    MV_Printf(": error loading \"%s\"!\n", filename);
96
    return SF2_Error;
96
    return SF2_Error;
97
}
97
}
98
98
99
int SF2Drv_MIDI_Init(midifuncs* const funcs)
99
int SF2Drv_MIDI_Init(midifuncs* const funcs)
100
{
100
{
Line 122... Line 122...
122
            MV_Printf(": no .sf2 data found!\n");
122
            MV_Printf(": no .sf2 data found!\n");
123
            return SF2_SetError(SF2_BankError);
123
            return SF2_SetError(SF2_BankError);
124
        }
124
        }
125
    }
125
    }
126
126
127
    int const loaded = SF2_Load(filename);
127
    int const loaded = SF2_LoadBank(filename);
128
128
129
    if (filename != SF2_BankFile)
129
    if (filename != SF2_BankFile)
130
        Xfree(filename);
130
        Xfree(filename);
131
131
132
    if (loaded != SF2_Ok || !sf2_synth)
132
    if (loaded != SF2_Ok || !sf2_synth)