Skip to content

Commit

Permalink
bring source up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
MnHebi authored Mar 4, 2023
1 parent 850a5bc commit aa0e5e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
28 changes: 6 additions & 22 deletions wgmus.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ DWORD CALLBACK WasapiProc(void *buffer, DWORD length, void *user)
notify = 0;
changeNotify = 0;
dprintf(" BASS finished playback\r\n");
BASS_StreamFree(dec);
playing = 0;
SendMessageA((HWND)0xffff, MM_MCINOTIFY, MCI_NOTIFY_SUCCESSFUL, 0x0000000);
dprintf(" BASS Error: %d\r\n", bassError);
Expand Down Expand Up @@ -435,6 +436,7 @@ int bass_stop()
dprintf(" BASS Error: %d\r\n", bassError);
if (bassError != 0)
{
BASS_StreamFree(dec);
BASS_WASAPI_Free();
return 0;
}
Expand Down Expand Up @@ -502,32 +504,12 @@ int bass_clear()
BASS_Mixer_StreamAddChannel(str, dec, 0);
BASS_WASAPI_Start();
}
BASS_WASAPI_Start();
dprintf(" Track for bass_clear is: %d\r\n", currentTrack);
dprintf(" BASS_ChannelStop + StreamFree + ChannelPlay\r\n");
}
return 0;
}

int bass_queue(const char *path)
{
if (noFiles == 0)
{
if (PlaybackMode == 0)
{
BASS_CD_StreamSetTrack(str, currentTrack);
BASS_WASAPI_Start();
}
else
if (PlaybackMode == 1)
{
BASS_StreamPutFileData(str, tracks[currentTrack].path, BASS_FILEDATA_END);
BASS_WASAPI_Start();
}
}
return 0;
}

int bass_forceplay(const char *path)
{
if (noFiles == 0)
Expand All @@ -552,7 +534,7 @@ int bass_forceplay(const char *path)
BASS_WASAPI_Start();
timesPlayed++;
}

else
if (PlaybackMode == 1)
{
PlaybackFinished = 0;
Expand All @@ -573,15 +555,17 @@ int bass_play(const char *path)
if (PlaybackMode == 0)
{
PlaybackFinished = 0;
BASS_StreamFree(dec);
dec = BASS_CD_StreamCreate(0, currentTrack, BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT);
BASS_Mixer_StreamAddChannel(str, dec, 0);
BASS_WASAPI_Start();
timesPlayed++;
}

else
if (PlaybackMode == 1)
{
PlaybackFinished = 0;
BASS_StreamFree(dec);
dec = BASS_StreamCreateFile(FALSE, tracks[currentTrack].path, 0, 0, BASS_SAMPLE_FLOAT | BASS_STREAM_DECODE | BASS_STREAM_PRESCAN);
BASS_Mixer_StreamAddChannel(str, dec, 0);
BASS_WASAPI_Start();
Expand Down
1 change: 0 additions & 1 deletion wgmus.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ int bass_pause();
int bass_stop();
int bass_resume();
int bass_clear();
int bass_queue(const char *path);
int bass_forceplay(const char *path);
int bass_play(const char *path);

0 comments on commit aa0e5e0

Please sign in to comment.