Merge branch 'accurate' into portable
This commit is contained in:
commit
72af19d056
2 changed files with 31 additions and 6 deletions
|
@ -69,6 +69,13 @@ void EndDirectSound(void)
|
||||||
AudioBackend_Deinit();
|
AudioBackend_Deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Below are two completely unused functions for loading .wav files as sound effects.
|
||||||
|
// Some say that sounds heard in CS Beta footage don't sound like PixTone...
|
||||||
|
|
||||||
|
// There's a bit of a problem with this code: it hardcodes the offsets of various bits
|
||||||
|
// of data in the WAV header - this makes the code only compatible with very specific
|
||||||
|
// .wav files. You can check the prototype OrgView EXEs for examples of those.
|
||||||
|
|
||||||
// サウンドの設定 (Sound settings)
|
// サウンドの設定 (Sound settings)
|
||||||
BOOL InitSoundObject(const char *resname, int no)
|
BOOL InitSoundObject(const char *resname, int no)
|
||||||
{
|
{
|
||||||
|
@ -96,7 +103,7 @@ BOOL InitSoundObject(const char *resname, int no)
|
||||||
if (channels != 1) // The mixer only supports mono right now
|
if (channels != 1) // The mixer only supports mono right now
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (bits_per_sample != 8) // The mixer only supports 8-bit samples (unsigned ones, at that)
|
if (bits_per_sample != 8) // The mixer only supports unsigned 8-bit samples
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// 二次バッファの生成 (Create secondary buffer)
|
// 二次バッファの生成 (Create secondary buffer)
|
||||||
|
@ -108,8 +115,6 @@ BOOL InitSoundObject(const char *resname, int no)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Completely unused function for loading a .wav file as a sound effect.
|
|
||||||
// Some say that sounds heard in CS Beta footage don't sound like PixTone...
|
|
||||||
BOOL LoadSoundObject(const char *file_name, int no)
|
BOOL LoadSoundObject(const char *file_name, int no)
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
|
@ -132,9 +137,17 @@ BOOL LoadSoundObject(const char *file_name, int no)
|
||||||
|
|
||||||
// Let's not throttle disk I/O, shall we...
|
// Let's not throttle disk I/O, shall we...
|
||||||
//for (i = 0; i < 58; i++)
|
//for (i = 0; i < 58; i++)
|
||||||
// fread(&check_box[i], sizeof(char), 1, fp);
|
// fread(&check_box[i], sizeof(char), 1, fp); // Holy hell, this is inefficient
|
||||||
fread(check_box, 1, 58, fp);
|
fread(check_box, 1, 58, fp);
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
// The original code forgets to close 'fp'
|
||||||
|
if (check_box[0] != 'R' || check_box[1] != 'I' || check_box[2] != 'F' || check_box[3] != 'F')
|
||||||
|
{
|
||||||
|
fclose(fp);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (check_box[0] != 'R')
|
if (check_box[0] != 'R')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (check_box[1] != 'I')
|
if (check_box[1] != 'I')
|
||||||
|
@ -143,14 +156,24 @@ BOOL LoadSoundObject(const char *file_name, int no)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (check_box[3] != 'F')
|
if (check_box[3] != 'F')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
unsigned char *wp;
|
unsigned char *wp;
|
||||||
wp = (unsigned char*)malloc(file_size); // ファイルのワークスペースを作る (Create a file workspace)
|
wp = (unsigned char*)malloc(file_size); // ファイルのワークスペースを作る (Create a file workspace)
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (wp == NULL)
|
||||||
|
{
|
||||||
|
fclose(fp);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
|
||||||
// Bloody hell, Pixel, come on...
|
// Bloody hell, Pixel, come on...
|
||||||
//for (i = 0; i < file_size; i++)
|
//for (i = 0; i < file_size; i++)
|
||||||
// fread((BYTE*)wp+i, sizeof(char), 1, fp);
|
// fread((BYTE*)wp+i, sizeof(char), 1, fp); // Pixel, stahp
|
||||||
fread(wp, 1, file_size, fp);
|
fread(wp, 1, file_size, fp);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -174,7 +197,7 @@ BOOL LoadSoundObject(const char *file_name, int no)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bits_per_sample != 8) // The mixer only supports 8-bit samples (unsigned ones, at that)
|
if (bits_per_sample != 8) // The mixer only supports 8-bit unsigned samples
|
||||||
{
|
{
|
||||||
free(wp);
|
free(wp);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -31,6 +31,8 @@ extern AudioBackend_Sound *lpSECONDARYBUFFER[SE_MAX];
|
||||||
|
|
||||||
BOOL InitDirectSound(void);
|
BOOL InitDirectSound(void);
|
||||||
void EndDirectSound(void);
|
void EndDirectSound(void);
|
||||||
|
BOOL InitSoundObject(const char *resname, int no);
|
||||||
|
BOOL LoadSoundObject(const char *file_name, int no);
|
||||||
void PlaySoundObject(int no, int mode);
|
void PlaySoundObject(int no, int mode);
|
||||||
void ChangeSoundFrequency(int no, unsigned long rate);
|
void ChangeSoundFrequency(int no, unsigned long rate);
|
||||||
void ChangeSoundVolume(int no, long volume);
|
void ChangeSoundVolume(int no, long volume);
|
||||||
|
|
Loading…
Add table
Reference in a new issue