Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 8756 → Rev 8757

/source/audiolib/src/driver_adlib.cpp
1,5 → 1,7
/*
Copyright (C) 1994-1995 Apogee Software, Ltd.
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
Copyright (C) EDuke32 developers and contributors
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
41,7 → 43,6
 
enum
{
AdLibErr_Warning = -2,
AdLibErr_Error = -1,
AdLibErr_Ok = 0,
};
55,25 → 56,12
 
const char *AdLibDrv_ErrorString(int const ErrorNumber)
{
const char *ErrorString;
switch( ErrorNumber )
switch (ErrorNumber)
{
case AdLibErr_Warning :
case AdLibErr_Error :
ErrorString = AdLibDrv_ErrorString( ErrorCode );
break;
 
case AdLibErr_Ok :
ErrorString = "AdLib ok.";
break;
default:
ErrorString = "Unknown AdLib error.";
break;
case AdLibErr_Error: return AdLibDrv_ErrorString(ErrorCode);
case AdLibErr_Ok: return "AdLib ok.";
default: return "Unknown AdLib error.";
}
return ErrorString;
}
 
int AdLibDrv_MIDI_Init(midifuncs * const funcs)
122,9 → 110,8
void AdLibDrv_MIDI_Service(void)
{
int16_t * buffer16 = (int16_t *)MV_MusicBuffer;
int32_t const samples = MV_MIXBUFFERSIZE;
 
for (int32_t i = 0; i < samples; i++)
for (int i = 0; i < MV_MIXBUFFERSIZE; i++)
{
Bit16s buf[2];
while (MV_MIDIRenderTimer >= MV_MixRate)
527,9 → 514,6
 
static void AL_CalcPitchInfo(void)
{
// int finetune;
// double detune;
 
for (int note = 0; note <= MAX_NOTE; note++)
{
NoteMod12[note] = note % 12;
536,14 → 520,15
NoteDiv12[note] = note / 12;
}
 
// for( finetune = 1; finetune <= FINETUNE_MAX; finetune++ )
// {
// detune = pow( 2, ( double )finetune / ( 12.0 * FINETUNE_RANGE ) );
// for( note = 0; note < 12; note++ )
// {
// NotePitch[ finetune ][ note ] = ( ( double )NotePitch[ 0 ][ note ] * detune );
// }
// }
#if 0
for (int finetune = 1; finetune <= FINETUNE_MAX; finetune++)
{
double detune = pow(2, (double)finetune / (12.0 * FINETUNE_RANGE));
 
for (int note = 0; note < 12; note++)
NotePitch[finetune][note] = ((double)NotePitch[0][note] * detune);
}
#endif
}
 
 
760,10 → 745,7
}
 
 
static void AL_SetVolume(int volume)
{
AL_Volume = clamp(volume, 0, MIDI_MaxVolume);
}
static void AL_SetVolume(int volume) { AL_Volume = clamp(volume, 0, MIDI_MaxVolume); }
 
 
static void AL_Shutdown(void)
/source/audiolib/src/driver_directsound.cpp
1,5 → 1,6
/*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
Copyright (C) EDuke32 developers and contributors
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
333,92 → 334,29
Playing = 0;
}
 
void DirectSoundDrv_PCM_Lock(void)
{
mutex_lock(&mutex);
}
void DirectSoundDrv_PCM_Lock(void) { mutex_lock(&mutex); }
void DirectSoundDrv_PCM_Unlock(void) { mutex_unlock(&mutex); }
int DirectSoundDrv_GetError(void) { return ErrorCode; }
 
void DirectSoundDrv_PCM_Unlock(void)
{
mutex_unlock(&mutex);
}
 
int DirectSoundDrv_GetError(void)
{
return ErrorCode;
}
 
const char *DirectSoundDrv_ErrorString(int ErrorNumber)
{
const char *ErrorString;
 
switch (ErrorNumber)
{
case DSErr_Warning:
case DSErr_Error:
ErrorString = DirectSoundDrv_ErrorString(ErrorCode);
break;
 
case DSErr_Ok:
ErrorString = "DirectSound ok.";
break;
 
case DSErr_Uninitialised:
ErrorString = "DirectSound uninitialised.";
break;
 
case DSErr_DirectSoundCreate:
ErrorString = "DirectSound error: DirectSoundCreate failed.";
break;
 
case DSErr_SetCooperativeLevel:
ErrorString = "DirectSound error: SetCooperativeLevel failed.";
break;
 
case DSErr_CreateSoundBuffer:
ErrorString = "DirectSound error: primary CreateSoundBuffer failed.";
break;
 
case DSErr_CreateSoundBufferSecondary:
ErrorString = "DirectSound error: secondary CreateSoundBuffer failed.";
break;
 
case DSErr_SetFormat:
ErrorString = "DirectSound error: primary buffer SetFormat failed.";
break;
 
case DSErr_SetFormatSecondary:
ErrorString = "DirectSound error: secondary buffer SetFormat failed.";
break;
 
case DSErr_Notify:
ErrorString = "DirectSound error: failed querying secondary buffer for notify interface.";
break;
 
case DSErr_NotifyEvents:
ErrorString = "DirectSound error: failed creating notify events.";
break;
 
case DSErr_SetNotificationPositions:
ErrorString = "DirectSound error: failed setting notification positions.";
break;
 
case DSErr_Play:
ErrorString = "DirectSound error: primary buffer Play failed.";
break;
 
case DSErr_PlaySecondary:
ErrorString = "DirectSound error: secondary buffer Play failed.";
break;
 
case DSErr_CreateThread:
ErrorString = "DirectSound error: failed creating mix thread.";
break;
 
default:
ErrorString = "Unknown DirectSound error code.";
break;
case DSErr_Error: return DirectSoundDrv_ErrorString(ErrorCode);
case DSErr_Ok: return "DirectSound ok.";
case DSErr_Uninitialised: return "DirectSound uninitialized.";
case DSErr_DirectSoundCreate: return "DirectSound error: DirectSoundCreate failed.";
case DSErr_SetCooperativeLevel: return "DirectSound error: SetCooperativeLevel failed.";
case DSErr_CreateSoundBuffer: return "DirectSound error: primary CreateSoundBuffer failed.";
case DSErr_CreateSoundBufferSecondary: return "DirectSound error: secondary CreateSoundBuffer failed.";
case DSErr_SetFormat: return "DirectSound error: primary buffer SetFormat failed.";
case DSErr_SetFormatSecondary: return "DirectSound error: secondary buffer SetFormat failed.";
case DSErr_Notify: return "DirectSound error: failed querying secondary buffer for notify interface.";
case DSErr_NotifyEvents: return "DirectSound error: failed creating notify events.";
case DSErr_SetNotificationPositions: return "DirectSound error: failed setting notification positions.";
case DSErr_Play: return "DirectSound error: primary buffer Play failed.";
case DSErr_PlaySecondary: return "DirectSound error: secondary buffer Play failed.";
case DSErr_CreateThread: return "DirectSound error: failed creating mix thread.";
default: return "Unknown DirectSound error code.";
}
 
return ErrorString;
}
/source/audiolib/src/driver_directsound.h
22,7 → 22,6
 
enum
{
DSErr_Warning = -2,
DSErr_Error = -1,
DSErr_Ok = 0,
DSErr_Uninitialised,
/source/audiolib/src/driver_sdl.cpp
1,5 → 1,6
/*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
Copyright (C) EDuke32 developers and contributors
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
37,7 → 38,6
 
enum
{
SDLErr_Warning = -2,
SDLErr_Error = -1,
SDLErr_Ok = 0,
SDLErr_Uninitialised,
105,37 → 105,15
 
const char *SDLDrv_ErrorString(int ErrorNumber)
{
const char *ErrorString;
 
switch (ErrorNumber)
{
case SDLErr_Warning:
case SDLErr_Error:
ErrorString = SDLDrv_ErrorString(ErrorCode);
break;
 
case SDLErr_Ok:
ErrorString = "SDL Audio ok.";
break;
 
case SDLErr_Uninitialised:
ErrorString = "SDL Audio uninitialised.";
break;
 
case SDLErr_InitSubSystem:
ErrorString = "SDL Audio: error in Init or InitSubSystem.";
break;
 
case SDLErr_OpenAudio:
ErrorString = "SDL Audio: error in OpenAudio.";
break;
 
default:
ErrorString = "Unknown SDL Audio error code.";
break;
case SDLErr_Error: return SDLDrv_ErrorString(ErrorCode);
case SDLErr_Ok: return "SDL Audio ok.";
case SDLErr_Uninitialised: return "SDL Audio uninitialized.";
case SDLErr_InitSubSystem: return "SDL Audio: error in Init or InitSubSystem.";
case SDLErr_OpenAudio: return "SDL Audio: error in OpenAudio.";
default: return "Unknown SDL Audio error code.";
}
 
return ErrorString;
}
 
#if SDL_MAJOR_VERSION >= 2
168,7 → 146,6
 
Uint32 inited;
int err = 0;
SDL_AudioSpec spec, actual;
 
if (Initialised)
SDLDrv_PCM_Shutdown();
210,6 → 187,8
chunksize = droidinfo.audio_buffer_size;
#endif
 
SDL_AudioSpec spec = {};
 
spec.freq = *mixrate;
spec.format = AUDIO_S16SYS;
spec.channels = *numchannels;
217,7 → 196,7
spec.callback = fillData;
spec.userdata = nullptr;
 
Bmemset(&actual, 0, sizeof(actual));
SDL_AudioSpec actual = {};
 
#if (SDL_MAJOR_VERSION == 1)
err = !SDL_OpenAudio(&spec, &actual);
/source/audiolib/src/driver_winmm.cpp
1,6 → 1,7
/*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
Copyright (C) EDuke32 developers and contributors
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
38,7 → 39,6
 
enum
{
WinMMErr_Warning = -2,
WinMMErr_Error = -1,
WinMMErr_Ok = 0,
WinMMErr_Uninitialised,
88,52 → 88,20
return ErrorCode;
}
 
const char *WinMMDrv_ErrorString( int ErrorNumber )
const char *WinMMDrv_ErrorString(int ErrorNumber)
{
const char *ErrorString;
switch( ErrorNumber )
switch (ErrorNumber)
{
case WinMMErr_Warning :
case WinMMErr_Error :
ErrorString = WinMMDrv_ErrorString( ErrorCode );
break;
case WinMMErr_Ok :
ErrorString = "WinMM ok.";
break;
case WinMMErr_Uninitialised:
ErrorString = "WinMM uninitialised.";
break;
case WinMMErr_MIDIStreamOpen:
ErrorString = "MIDI error: failed opening stream.";
break;
 
case WinMMErr_MIDIStreamRestart:
ErrorString = "MIDI error: failed starting stream.";
break;
 
case WinMMErr_MIDICreateEvent:
ErrorString = "MIDI error: failed creating play thread quit event.";
break;
 
case WinMMErr_MIDIPlayThread:
ErrorString = "MIDI error: failed creating play thread.";
break;
 
case WinMMErr_MIDICreateMutex:
ErrorString = "MIDI error: failed creating play mutex.";
break;
 
default:
ErrorString = "Unknown WinMM error code.";
break;
case WinMMErr_Error: return WinMMDrv_ErrorString(ErrorCode);
case WinMMErr_Ok: return "WinMM ok.";
case WinMMErr_Uninitialised: return "WinMM uninitialized.";
case WinMMErr_MIDIStreamOpen: return "MIDI error: failed opening stream.";
case WinMMErr_MIDIStreamRestart: return "MIDI error: failed starting stream.";
case WinMMErr_MIDICreateEvent: return "MIDI error: failed creating play thread quit event.";
case WinMMErr_MIDIPlayThread: return "MIDI error: failed creating play thread.";
case WinMMErr_MIDICreateMutex: return "MIDI error: failed creating play mutex.";
default: return "Unknown WinMM error code.";
}
return ErrorString;
 
}
 
 
143,28 → 111,29
va_list va;
const char * errtxt = "?";
switch (rv) {
case MMSYSERR_NOERROR: errtxt = "MMSYSERR_NOERROR"; break;
case MMSYSERR_BADDEVICEID: errtxt = "MMSYSERR_BADDEVICEID"; break;
case MMSYSERR_NOTENABLED: errtxt = "MMSYSERR_NOTENABLED"; break;
case MMSYSERR_ALLOCATED: errtxt = "MMSYSERR_ALLOCATED"; break;
case MMSYSERR_INVALHANDLE: errtxt = "MMSYSERR_INVALHANDLE"; break;
case MMSYSERR_NODRIVER: errtxt = "MMSYSERR_NODRIVER"; break;
case MMSYSERR_NOMEM: errtxt = "MMSYSERR_NOMEM"; break;
switch (rv)
{
case MMSYSERR_NOERROR: errtxt = "MMSYSERR_NOERROR"; break;
case MMSYSERR_BADDEVICEID: errtxt = "MMSYSERR_BADDEVICEID"; break;
case MMSYSERR_NOTENABLED: errtxt = "MMSYSERR_NOTENABLED"; break;
case MMSYSERR_ALLOCATED: errtxt = "MMSYSERR_ALLOCATED"; break;
case MMSYSERR_INVALHANDLE: errtxt = "MMSYSERR_INVALHANDLE"; break;
case MMSYSERR_NODRIVER: errtxt = "MMSYSERR_NODRIVER"; break;
case MMSYSERR_NOMEM: errtxt = "MMSYSERR_NOMEM"; break;
case MMSYSERR_NOTSUPPORTED: errtxt = "MMSYSERR_NOTSUPPORTED"; break;
case MMSYSERR_BADERRNUM: errtxt = "MMSYSERR_BADERRNUM"; break;
case MMSYSERR_INVALFLAG: errtxt = "MMSYSERR_INVALFLAG"; break;
case MMSYSERR_INVALPARAM: errtxt = "MMSYSERR_INVALPARAM"; break;
case MMSYSERR_HANDLEBUSY: errtxt = "MMSYSERR_HANDLEBUSY"; break;
case MMSYSERR_BADERRNUM: errtxt = "MMSYSERR_BADERRNUM"; break;
case MMSYSERR_INVALFLAG: errtxt = "MMSYSERR_INVALFLAG"; break;
case MMSYSERR_INVALPARAM: errtxt = "MMSYSERR_INVALPARAM"; break;
case MMSYSERR_HANDLEBUSY: errtxt = "MMSYSERR_HANDLEBUSY"; break;
case MMSYSERR_INVALIDALIAS: errtxt = "MMSYSERR_INVALIDALIAS"; break;
case MMSYSERR_BADDB: errtxt = "MMSYSERR_BADDB"; break;
case MMSYSERR_KEYNOTFOUND: errtxt = "MMSYSERR_KEYNOTFOUND"; break;
case MMSYSERR_READERROR: errtxt = "MMSYSERR_READERROR"; break;
case MMSYSERR_WRITEERROR: errtxt = "MMSYSERR_WRITEERROR"; break;
case MMSYSERR_DELETEERROR: errtxt = "MMSYSERR_DELETEERROR"; break;
case MMSYSERR_VALNOTFOUND: errtxt = "MMSYSERR_VALNOTFOUND"; break;
case MMSYSERR_NODRIVERCB: errtxt = "MMSYSERR_NODRIVERCB"; break;
default: break;
case MMSYSERR_BADDB: errtxt = "MMSYSERR_BADDB"; break;
case MMSYSERR_KEYNOTFOUND: errtxt = "MMSYSERR_KEYNOTFOUND"; break;
case MMSYSERR_READERROR: errtxt = "MMSYSERR_READERROR"; break;
case MMSYSERR_WRITEERROR: errtxt = "MMSYSERR_WRITEERROR"; break;
case MMSYSERR_DELETEERROR: errtxt = "MMSYSERR_DELETEERROR"; break;
case MMSYSERR_VALNOTFOUND: errtxt = "MMSYSERR_VALNOTFOUND"; break;
case MMSYSERR_NODRIVERCB: errtxt = "MMSYSERR_NODRIVERCB"; break;
default: break;
}
va_start(va, fmt);
840,9 → 809,5
}
}
 
void WinMMDrv_MIDI_Unlock(void)
{
ReleaseMutex(midiMutex);
}
 
void WinMMDrv_MIDI_Unlock(void) { ReleaseMutex(midiMutex); }
void WinMMDrv_MIDI_Service(void) { MIDI_ServiceRoutine(); }
/source/audiolib/src/drivers.cpp
1,6 → 1,7
/*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
Copyright (C) EDuke32 developers and contributors
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2