Mercurial > codedump
diff win95kggui/src/win95kggui.c @ 75:dbf5ce219fe3
Switch from BASS to ft2play
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 25 Jun 2022 22:09:45 -0400 |
parents | 1508aee998df |
children | 677f84ada082 |
line wrap: on
line diff
--- a/win95kggui/src/win95kggui.c Sat Jun 25 07:25:46 2022 -0400 +++ b/win95kggui/src/win95kggui.c Sat Jun 25 22:09:45 2022 -0400 @@ -27,8 +27,12 @@ #include <commdlg.h> #include <math.h> #include <time.h> -#include <bass.h> +#include "../sub/ft2play/pmplay.h" #include <resource.h> +#include "bergsm.h" +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif #define _WIN32_WINNT 0x0400 #define ARRAYSIZE(a) \ sizeof(a)/sizeof(a[0]) @@ -42,10 +46,6 @@ #define KEY 3 int type; HWND hWndListBox, key_box; -HMUSIC music; - -extern char binary_src_bergsm_xm_start[]; -extern char binary_src_bergsm_xm_end[]; int get_sum(int n) { int sum; @@ -165,19 +165,32 @@ } break; case WM_CREATE: { - if (!BASS_Init(-1, 48000, 0, hWnd, NULL)) { + /* freq, buf, inter, ramp */ + if (!initMusic(44100, 1024, false, true)) { + printf("init music\n"); EndDialog(hWnd, 0); break; } AddControls(hWnd); EnumChildWindows(hWnd, (WNDENUMPROC)SetFont, (LPARAM)GetStockObject(DEFAULT_GUI_FONT)); - music = BASS_MusicLoad(true, &binary_src_bergsm_xm_start, 0, (unsigned int)(binary_src_bergsm_xm_end - binary_src_bergsm_xm_start), BASS_SAMPLE_LOOP | BASS_MUSIC_FT2PAN | BASS_MUSIC_NONINTER | BASS_SAMPLE_FLOAT, 1); - BASS_ChannelPlay(music, FALSE); + if (!loadMusicFromData(hdata, ARRAYSIZE(hdata))) { + printf("load music\n"); + EndDialog(hWnd, 0); + break; + } + if (!startMusic()) + { + printf("start music\n"); + freeMusic(); + EndDialog(hWnd, 0); + break; + } + startPlaying(); break; } case WM_DESTROY: - BASS_MusicFree(music); - BASS_Free(); + stopMusic(); + freeMusic(); PostQuitMessage(0); break; default: