mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@647 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5d1abf26a8
commit
43a7dc4d33
5 changed files with 150 additions and 150 deletions
|
@ -97,6 +97,13 @@ typedef enum
|
|||
KeepPlaying
|
||||
} playbackstatus;
|
||||
|
||||
typedef struct sounddef
|
||||
{
|
||||
unsigned pos;
|
||||
char *ptrsnd;
|
||||
unsigned size;
|
||||
OggVorbis_File oggStream;
|
||||
} sounddef;
|
||||
|
||||
typedef struct VoiceNode
|
||||
{
|
||||
|
|
|
@ -1758,12 +1758,15 @@ int MV_SetMixMode(int numchannels, int samplebits)
|
|||
// OGG file
|
||||
// ---------------------------------------------------------------------
|
||||
ov_callbacks cb;
|
||||
|
||||
size_t ReadOgg(void *ptr, size_t size1, size_t nmemb, void *datasource)
|
||||
{
|
||||
sounddef *d=(sounddef *)datasource;
|
||||
size1*=nmemb;
|
||||
if (d->pos>=d->size)return 0;
|
||||
if (d->pos+size1>=d->size)size1=d->size-d->pos;
|
||||
if (d->pos>=d->size)
|
||||
return 0;
|
||||
if (d->pos+size1>=d->size)
|
||||
size1=d->size-d->pos;
|
||||
Bmemcpy(ptr,(d->ptrsnd+d->pos),size1);
|
||||
d->pos+=size1;
|
||||
return size1;
|
||||
|
@ -1774,12 +1777,19 @@ int SeekOgg(void *datasource,ogg_int64_t offset,int whence)
|
|||
sounddef *d=(sounddef *)datasource;
|
||||
switch (whence)
|
||||
{
|
||||
case SEEK_SET: whence=offset;break;
|
||||
case SEEK_CUR: whence=d->pos+offset;break;
|
||||
case SEEK_END: whence=d->size-offset-1;break;
|
||||
case SEEK_SET:
|
||||
whence=offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
whence=d->pos+offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
whence=d->size-offset-1;
|
||||
break;
|
||||
default: return -1;
|
||||
}
|
||||
if (whence>=(int)d->size||whence<0)return -1;
|
||||
if (whence>=(int)d->size||whence<0)
|
||||
return -1;
|
||||
d->pos=whence;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2436,7 +2446,7 @@ int MV_PlayLoopedOGG(char *ptr, int loopstart, int loopend, int pitchoffset, int
|
|||
|
||||
while ((ogg_int64_t)(vorbisInfo->rate)/(1<<voice->downsample)*PITCH_GetScale(pitchoffset)/0x1000000/0x100)
|
||||
voice->downsample++;
|
||||
length=ov_pcm_total(&voice->OGGstream.oggStream,0);
|
||||
length=ov_pcm_total(&voice->OGGstream.oggStream,-1);
|
||||
// if (!length)length=0xffffff;
|
||||
if (length == OV_EINVAL)
|
||||
{
|
||||
|
@ -2474,7 +2484,8 @@ int MV_PlayLoopedOGG(char *ptr, int loopstart, int loopend, int pitchoffset, int
|
|||
}
|
||||
|
||||
MV_SetVoicePitch(voice, vorbisInfo->rate>>voice->downsample, pitchoffset);
|
||||
if (vorbisInfo->channels==2)voice->downsample++;
|
||||
if (vorbisInfo->channels==2)
|
||||
voice->downsample++;
|
||||
MV_SetVoiceVolume(voice, vol, left, right);
|
||||
MV_PlayVoice(voice);
|
||||
|
||||
|
|
|
@ -16,13 +16,5 @@ void AL_Pause();
|
|||
void AL_Continue();
|
||||
void AL_SetMusicVolume(int volume);
|
||||
|
||||
typedef struct sounddef
|
||||
{
|
||||
unsigned pos;
|
||||
char *ptrsnd;
|
||||
unsigned size;
|
||||
OggVorbis_File oggStream;
|
||||
}sounddef;
|
||||
|
||||
int openal_disabled;
|
||||
#endif
|
||||
|
|
|
@ -174,7 +174,7 @@ char *MUSIC_ErrorString(int ErrorNumber)
|
|||
int MUSIC_Init(int SoundCard, int Address)
|
||||
{
|
||||
// Use an external MIDI player if the user has specified to do so
|
||||
char *command = getenv("EDUKE32_MIDI_CMD");
|
||||
char *command = getenv("EDUKE32_MUSIC_CMD");
|
||||
external_midi = (command != NULL && command[0] != 0);
|
||||
if(external_midi)
|
||||
Mix_SetMusicCMD(command);
|
||||
|
@ -297,11 +297,6 @@ int MUSIC_StopSong(void)
|
|||
// Duke3D-specific. --ryan.
|
||||
void PlayMusic(char *_filename)
|
||||
{
|
||||
//char filename[MAX_PATH];
|
||||
//strcpy(filename, _filename);
|
||||
//FixFilePath(filename);
|
||||
|
||||
char filename[BMAX_PATH];
|
||||
int handle;
|
||||
int size;
|
||||
int rc;
|
||||
|
|
|
@ -196,14 +196,16 @@ void intomenusounds(void)
|
|||
void playmusic(const char *fn)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
int fp;
|
||||
int l;
|
||||
int fp, l;
|
||||
#else
|
||||
extern void PlayMusic(char *_filename);
|
||||
#endif
|
||||
|
||||
if (fn == NULL) return;
|
||||
|
||||
if (ud.config.MusicToggle == 0) return;
|
||||
if (ud.config.MusicDevice < 0) return;
|
||||
|
||||
#if defined(_WIN32)
|
||||
fp = kopen4load((char *)fn,0);
|
||||
|
||||
if (fp == -1) return;
|
||||
|
@ -220,16 +222,9 @@ void playmusic(const char *fn)
|
|||
kclose(fp);
|
||||
MUSIC_PlaySong((unsigned char *)MusicPtr, MUSIC_LoopSong);
|
||||
#else
|
||||
void PlayMusic(char *_filename, int loopflag);
|
||||
|
||||
if (fn == NULL) return;
|
||||
|
||||
if (ud.config.MusicToggle == 0) return;
|
||||
if (ud.config.MusicDevice < 0) return;
|
||||
|
||||
// FIXME: I need this to get the music volume initialized (not sure why) -- Jim Bentler
|
||||
MUSIC_SetVolume(ud.config.MusicVolume);
|
||||
PlayMusic((char *)fn, MUSIC_LoopSong);
|
||||
PlayMusic((char *)fn);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue