Fixed sound effects under DOS.

This commit is contained in:
Alexander S. Aganichev 2000-03-01 18:17:45 +00:00
parent c451e3fb50
commit c3909b39c9
2 changed files with 5 additions and 8 deletions

View File

@ -227,8 +227,10 @@ int gsnd::open(const char* file) {
case 0x02: case 0x02:
free_buffer(); free_buffer();
#if defined(__DJGPP__) or (defined(__WATCOMC__) and defined(__386__)) #if defined(__DJGPP__) or (defined(__WATCOMC__) and defined(__386__))
if((data->buffer_segment = __dpmi_allocate_dos_memory((data->buffer_length >> 4) + 1, &buffer)) == -1) int seg = __dpmi_allocate_dos_memory((data->buffer_length >> 4) + 1, &buffer);
if(seg == -1)
return -1; return -1;
data->buffer_segment = seg & 0xffff;
data->buffer_offset = 0; data->buffer_offset = 0;
#else #else
buffer = (char*)farmalloc(data->buffer_length); buffer = (char*)farmalloc(data->buffer_length);
@ -471,7 +473,7 @@ int gsnd::is_playing() {
#if defined(__MSDOS__) #if defined(__MSDOS__)
if(file_open) if(file_open)
return (int)data->status; return data->status == 0 ? false : true;
return false; return false;
#elif defined(GUTLOS_FUNCS) #elif defined(GUTLOS_FUNCS)

View File

@ -64,16 +64,11 @@ struct gsapidata {
byte dma_channel; byte dma_channel;
word sample_rate; word sample_rate;
volatile word status; volatile word status;
#if defined(__DJGPP__) or (defined(__WATCOMC__) and defined(__386__))
int buffer_segment;
int buffer_offset;
#else
word buffer_segment; word buffer_segment;
word buffer_offset; word buffer_offset;
#endif
long buffer_length; long buffer_length;
char parameters[80]; char parameters[80];
}; } __attribute__((packed));
// ------------------------------------------------------------------ // ------------------------------------------------------------------