Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions code/ahandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ AHANDLE_CALLBACK_2 _AHandleCallbackFunc2;

/// private, call handler instead

long __cdecl Open_Audio_Handler(VQAHandleP *vqap, AhandleInitParams *params, long);
long __cdecl Close_Audio_Handler(VQAHandleP *vqap);
long __cdecl Start_Audio_Handler(VQAHandleP *vqap);
long __cdecl Stop_Audio_Handler(VQAHandleP *vqap);
long __cdecl Play_Audio_Handler(VQAHandleP *vqap);
long __cdecl Pause_Audio_Handler(VQAHandleP *vqap);
VQAErrorType __cdecl Open_Audio_Handler(VQAHandleP *vqap, AhandleInitParams *params, long);
VQAErrorType __cdecl Close_Audio_Handler(VQAHandleP *vqap);
VQAErrorType __cdecl Start_Audio_Handler(VQAHandleP *vqap);
VQAErrorType __cdecl Stop_Audio_Handler(VQAHandleP *vqap);
VQAErrorType __cdecl Play_Audio_Handler(VQAHandleP *vqap);
VQAErrorType __cdecl Pause_Audio_Handler(VQAHandleP *vqap);
long __cdecl Resume_Audio_Handler(VQAHandleP *vqap);
long __cdecl Load_Audio_Handler(VQAHandleP *vqap, void *buffer, long nbytes);
VQAErrorType __cdecl Load_Audio_Handler(VQAHandleP *vqap, void *buffer, long nbytes);
void CALLBACK AudioCallback(UINT uTimerID, UINT, DWORD dwUser, DWORD, DWORD);
_STATIC unsigned long Get_Playback_Position(VQAHandle *vqa, Ahandle *handle, VQAConfig *config);

Expand Down Expand Up @@ -188,7 +188,7 @@ long __cdecl Stream_Audio_Handler(VQAHandle *vqa, long action, void *buffer, lon
}


long __cdecl Open_Audio_Handler(VQAHandleP *vqap, AhandleInitParams *params, long b)
VQAErrorType __cdecl Open_Audio_Handler(VQAHandleP *vqap, AhandleInitParams *params, long b)
{
DSCAPS dscaps;

Expand Down Expand Up @@ -297,7 +297,7 @@ long __cdecl Open_Audio_Handler(VQAHandleP *vqap, AhandleInitParams *params, lon
}


long __cdecl Close_Audio_Handler(VQAHandleP *vqap)
VQAErrorType __cdecl Close_Audio_Handler(VQAHandleP *vqap)
{
DebugString("Closing VQ audio handler\n");

Expand Down Expand Up @@ -346,7 +346,7 @@ long __cdecl Close_Audio_Handler(VQAHandleP *vqap)
}


long __cdecl Start_Audio_Handler(VQAHandleP *vqap)
VQAErrorType __cdecl Start_Audio_Handler(VQAHandleP *vqap)
{
/* Dereference commonly used data members for quicker access. */
VQAConfig *config = &vqap->Config;
Expand Down Expand Up @@ -421,7 +421,7 @@ long __cdecl Start_Audio_Handler(VQAHandleP *vqap)
}


long __cdecl Load_Audio_Handler(VQAHandleP *vqap, void *buffer, long nbytes)
VQAErrorType __cdecl Load_Audio_Handler(VQAHandleP *vqap, void *buffer, long nbytes)
{
Ahandle *handle = &_handles[vqap->AudioHandleIndex];

Expand All @@ -448,7 +448,7 @@ long __cdecl Load_Audio_Handler(VQAHandleP *vqap, void *buffer, long nbytes)
}


long __cdecl Pause_Audio_Handler(VQAHandleP *vqap)
VQAErrorType __cdecl Pause_Audio_Handler(VQAHandleP *vqap)
{
Ahandle *handle = &_handles[vqap->AudioHandleIndex];

Expand All @@ -465,19 +465,19 @@ long __cdecl Pause_Audio_Handler(VQAHandleP *vqap)
}


long __cdecl Play_Audio_Handler(VQAHandleP *vqap)
VQAErrorType __cdecl Play_Audio_Handler(VQAHandleP *vqap)
{
Ahandle *handle = &_handles[vqap->AudioHandleIndex];

long rc;
VQAErrorType rc;
if (!handle->Used || handle->SecondaryBufferPtr == NULL) {
return(VQAERR_AUDIO);
}

EnterCriticalSection(&handle->CriticalSection);

rc = handle->SecondaryBufferPtr->Play(0, 0, DSBPLAY_LOOPING);
if (rc == S_OK) {
HRESULT const return_code = handle->SecondaryBufferPtr->Play(0, 0, DSBPLAY_LOOPING);
if (return_code == S_OK) {
handle->PauseAdjust = Simple_Timer_Callback_Audio_Handler(NULL) - handle->LastTimerTick;
DebugString("Ahandle: PauseAdjust %ld\n", handle->PauseAdjust);
handle->Flags &= ~AHANDLEF_IS_PAUSED;
Expand All @@ -491,7 +491,7 @@ long __cdecl Play_Audio_Handler(VQAHandleP *vqap)
}


long __cdecl Stop_Audio_Handler(VQAHandleP *vqap)
VQAErrorType __cdecl Stop_Audio_Handler(VQAHandleP *vqap)
{
Ahandle *handle = &_handles[vqap->AudioHandleIndex];

Expand Down
10 changes: 5 additions & 5 deletions code/vqalib/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,9 @@ static void StartAddr(void)
*
****************************************************************************/

long VQA_OpenAudio(VQAHandleP *vqap)
VQAErrorType VQA_OpenAudio(VQAHandleP *vqap)
{
VQAAudio *audio;
long rc;

/* Dereference data memebers for quicker access. */
audio = &vqap->Audio;
Expand All @@ -134,16 +133,17 @@ long VQA_OpenAudio(VQAHandleP *vqap)
params.Callback1 = VQA_AudioFillCallback;
params.Callback2 = VQA_AudioDoneCallback;

rc = vqap->Config.AudioHandler((VQAHandle *)vqap, VQAAUDIO_OPEN, &params, sizeof(params));
if (rc >= VQAERR_OK || rc == VQAERR_NONE) {
auto const opened = vqap->Config.AudioHandler((VQAHandle *)vqap, VQAAUDIO_OPEN, &params, sizeof(params));

if (opened >= VQAERR_OK || opened == VQAERR_NONE) {

/* Lock the memory occupied by this module. */
if ((audio->Flags & VQAAUDF_MODLOCKED) == 0) {
audio->Flags |= VQAAUDF_MODLOCKED;
}
return(VQAERR_NONE);
}
return(rc);
return((VQAErrorType)opened);
}


Expand Down
6 changes: 3 additions & 3 deletions code/vqalib/buffer_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <string.h>
#include "vqamem.h"

extern long VQA_Set_DrawBuffer(VQAHandle *vqa, unsigned char *buffer, unsigned long width, unsigned long height, long xpos, long ypos);
extern VQAErrorType VQA_Set_DrawBuffer(VQAHandle *vqa, unsigned char *buffer, unsigned long width, unsigned long height, long xpos, long ypos);


_STATIC void VQA_BufferPerpareLoop(VQAHandleP *vqap, long * needs_start_cb, long * needs_end_cb);
Expand Down Expand Up @@ -58,7 +58,7 @@ _STATIC void VQA_BufferPerpareLoop(VQAHandleP *vqap, long * needs_start_cb, long
*
****************************************************************************/

STATIC long AllocBuffers(VQAHandleP *vqap)
STATIC VQAErrorType AllocBuffers(VQAHandleP *vqap)
{
long needs_start_cb;
long needs_end_cb;
Expand Down Expand Up @@ -706,7 +706,7 @@ STATIC void FreeBuffers(VQAHandleP *vqap)
}


long VQA_Configure_Buffer(VQAHandleP *vqap)
VQAErrorType VQA_Configure_Buffer(VQAHandleP *vqap)
{
unsigned char *buf;
int w;
Expand Down
36 changes: 18 additions & 18 deletions code/vqalib/drawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@
#include "video.h"

//forward declarations
_STATIC long Select_Frame(VQAHandleP *vqap);
_STATIC VQAErrorType Select_Frame(VQAHandleP *vqap);
_STATIC void Prepare_Frame(VQAHandleP *vqap);

long DrawFrame_MCGABuf(VQAHandle *vqa);
long PageFlip_MCGABuf(VQAHandle *vqa);
long DrawFrame_MCGA(VQAHandle *vqa);
long PageFlip_MCGA(VQAHandle *vqa);
VQAErrorType DrawFrame_MCGABuf(VQAHandle *vqa);
VQAErrorType PageFlip_MCGABuf(VQAHandle *vqa);
VQAErrorType DrawFrame_MCGA(VQAHandle *vqa);
VQAErrorType PageFlip_MCGA(VQAHandle *vqa);

void __cdecl UnVQ_Nop(unsigned char *codebook, unsigned char *pointers, unsigned char *buffer, unsigned long blocksperrow, unsigned long numrows, unsigned long bufwidth);
long PageFlip_Nop(VQAHandle *vqa);
VQAErrorType PageFlip_Nop(VQAHandle *vqa);

void VQA_SetTimer(VQAHandleP *vqap, long time);
void VQA_StepTimer(VQAHandleP *vqap, long step);
unsigned long VQA_GetTime(VQAHandleP *vqap);
_STATIC long VQA_SetCurrentFrameAsLast(VQAHandleP *vqap);
_STATIC VQAErrorType VQA_SetCurrentFrameAsLast(VQAHandleP *vqap);
_STATIC void VQA_SetPreviousFrameNode(VQAHandleP *vqap);
_STATIC long VQA_CalcFramesSinceDrawn(VQAHandleP *vqap);

Expand All @@ -102,7 +102,7 @@ void VQA_DispatchFrameChunks(VQAHandleP *vqap, long frame);
/// no frame has been drawn yet.
/// </summary>
/// <returns>Returns with VQAERR_NONE.</returns>
long VQA_ResetLastFrameNum(VQAHandle *vqa)
VQAErrorType VQA_ResetLastFrameNum(VQAHandle *vqa)
{
VQAHandleP *vqap;
VQADrawer *drawer;
Expand Down Expand Up @@ -138,7 +138,7 @@ long VQA_ResetLastFrameNum(VQAHandle *vqa)
*
****************************************************************************/

long VQA_Configure_Drawer(VQAHandleP *vqap)
VQAErrorType VQA_Configure_Drawer(VQAHandleP *vqap)
{
VQAConfig *config;
VQAHeader *header;
Expand Down Expand Up @@ -265,7 +265,7 @@ long VQA_Configure_Drawer(VQAHandleP *vqap)
*
****************************************************************************/

STATIC long Select_Frame(VQAHandleP *vqap)
STATIC VQAErrorType Select_Frame(VQAHandleP *vqap)
{
VQADrawer *drawer;
VQAConfig *config;
Expand Down Expand Up @@ -668,7 +668,7 @@ long VQA_CalcFramesSinceDrawn(VQAHandleP *vqap)
/// notion of playback progress once a frame has been committed.
/// </summary>
/// <returns>Returns with VQAERR_NONE.</returns>
long VQA_SetCurrentFrameAsLast(VQAHandleP *vqap)
VQAErrorType VQA_SetCurrentFrameAsLast(VQAHandleP *vqap)
{
VQADrawer * drawer;

Expand Down Expand Up @@ -893,12 +893,12 @@ void VQA_UnVQFrame(VQAHandleP *vqap, VQAFrameNode *frame)
*
****************************************************************************/

long DrawFrame_MCGA(VQAHandle *vqa)
VQAErrorType DrawFrame_MCGA(VQAHandle *vqa)
{
VQAHandleP *vqap;
VQADrawer *drawer;
VQAFrameNode *curframe;
long rc;
VQAErrorType rc;

/* Dereference commonly used data members for quicker access */
vqap = (VQAHandleP *)vqa;
Expand Down Expand Up @@ -952,7 +952,7 @@ long DrawFrame_MCGA(VQAHandle *vqa)
*
****************************************************************************/

STATIC long PageFlip_MCGA(VQAHandle *vqa)
STATIC VQAErrorType PageFlip_MCGA(VQAHandle *vqa)
{
VQAHandleP *vqap;
VQADrawer *drawer;
Expand Down Expand Up @@ -1053,9 +1053,9 @@ STATIC long PageFlip_MCGA(VQAHandle *vqa)
*
****************************************************************************/

STATIC long DrawFrame_MCGABuf(VQAHandle *vqa)
STATIC VQAErrorType DrawFrame_MCGABuf(VQAHandle *vqa)
{
long rc;
VQAErrorType rc;
VQAHandleP *vqap;
VQADrawer *drawer;
VQAFrameNode *curframe;
Expand Down Expand Up @@ -1111,7 +1111,7 @@ STATIC long DrawFrame_MCGABuf(VQAHandle *vqa)
*
****************************************************************************/

STATIC long PageFlip_MCGABuf(VQAHandle *vqa)
STATIC VQAErrorType PageFlip_MCGABuf(VQAHandle *vqa)
{
VQAHandleP *vqap;
VQADrawer *drawer;
Expand Down Expand Up @@ -1237,7 +1237,7 @@ STATIC void __cdecl UnVQ_Nop(unsigned char *codebook, unsigned char *pointers,
*
****************************************************************************/

STATIC long PageFlip_Nop(VQAHandle *vqa)
STATIC VQAErrorType PageFlip_Nop(VQAHandle *vqa)
{
//shut up compiler warnings
vqa = vqa;
Expand Down
Loading