Skip to content

Commit

Permalink
Don't call Load/FreeLibrary from DllMain
Browse files Browse the repository at this point in the history
Other thread related stuff has been altered as well.
The music player thread now persists after playback is stopped.
It is suspended until the next MCI_PLAY command, instead of a new
thread being made for each MCI_PLAY command.

This fixes a deadlock case when playback was stopped and played
several times in very short succession.
  • Loading branch information
bangstk committed Oct 27, 2015
1 parent 2407c5d commit 94fc13d
Show file tree
Hide file tree
Showing 4 changed files with 605 additions and 555 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ wav-winmm.rc.o: wav-winmm.rc.in
sed 's/__REV__/$(REV)/g' wav-winmm.rc.in | sed 's/__FILE__/wav-winmm/g' | mingw32-windres -O coff -o wav-winmm.rc.o

wav-winmm.dll: wav-winmm.c wav-winmm.rc.o wav-winmm.def player.c stubs.c
mingw32-gcc -std=gnu99 -Wl,--enable-stdcall-fixup -Ilibs/include -O2 -shared -s -o winmm.dll wav-winmm.c player.c stubs.c wav-winmm.def wav-winmm.rc.o -L. -lvorbisfile-3 -lwinmm -static-libgcc
mingw32-gcc -std=gnu99 -Wl,--enable-stdcall-fixup -Ilibs/include -O2 -shared -s -o wav-winmm.dll wav-winmm.c player.c stubs.c wav-winmm.def wav-winmm.rc.o -L. -lvorbisfile-3 -lwinmm -static-libgcc

clean:
rm -f winmm.dll wav-winmm.rc.o
rm -f wav-winmm.dll wav-winmm.rc.o
5 changes: 4 additions & 1 deletion player.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#ifndef PLAYER_H
#define PLAYER_H

void plr_stop();
void plr_volume(int vol);
int plr_pump();
int plr_length(const char *path);
int plr_play(const char *path);

void setWinmmDll(HINSTANCE inPtr);
#endif
Loading

0 comments on commit 94fc13d

Please sign in to comment.