40 #if (HARDWARE != SIMULATION)
57 gSoundInstance= _Instance;
83 SndFile = open(SOUND_DEVICE_NAME,O_RDWR | O_SYNC);
87 pSoundTmp = (SOUND*)mmap(0,
sizeof(
UWORD), PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, SndFile, 0);
89 if(pSoundTmp == MAP_FAILED)
95 SoundInstance.
pSound = pSoundTmp;
107 RESULT Result = FAIL;
116 RESULT Result = FAIL;
120 SoundData[0] = BREAK;
160 if(SoundInstance.
Index < 0)
161 SoundInstance.
Index = 0;
171 VpDiff = SoundInstance.
Step >> 3;
173 if(Delta & 4) VpDiff += SoundInstance.
Step;
174 if(Delta & 2) VpDiff += SoundInstance.
Step >> 1;
175 if(Delta & 1) VpDiff += SoundInstance.
Step >> 2;
178 SoundInstance.
ValPrev -= VpDiff;
180 SoundInstance.
ValPrev += VpDiff;
182 if(SoundInstance.
ValPrev > 255)
206 RESULT Result = FAIL;
230 if (BytesWritten > 1)
272 BytesRead = read(SoundInstance.
hSoundFile,AdPcmData,BytesToRead);
274 for(i = 0; i < BytesRead; i++)
308 if (BytesWritten > 1)
370 if ((*SoundInstance.
pSound).Status == OK)
398 RESULT Result = FAIL;
453 char PathName[MAX_FILENAME_SIZE];
467 case TONE: (*SoundInstance.
pSound).Status = BUSY;
565 SoundData[2] = (
UBYTE)(Frequency);
566 SoundData[3] = (
UBYTE)(Frequency >> 8);
567 SoundData[4] = (
UBYTE)(Duration);
568 SoundData[5] = (
UBYTE)(Duration >> 8);
585 case REPEAT: Loop =
TRUE;
601 (*SoundInstance.
pSound).Status = BUSY;
668 if(pFileName !=
NULL)
673 if (pFileName[0] !=
'.')
676 sprintf(SoundInstance.
PathBuffer,
"%s%s.rsf", (
char*)PathName, (
char*)pFileName);
680 sprintf(SoundInstance.
PathBuffer,
"%s.rsf", (
char*)pFileName);
727 default: BytesToWrite = 0;
775 if ((*SoundInstance.
pSound).Status == BUSY)
804 if ((*SoundInstance.
pSound).Status == BUSY)
void SetDispatchStatus(DSPSTAT DspStat)
Set object (dispatch) status.
const SWORD StepSizeTable[STEP_SIZE_TABLE_ENTRIES]
void cSoundInitAdPcm(void)
void cSoundEntry(void)
opSOUND byte code
SWORD DATA16
VM Type for 2 byte signed value.
void LogErrorNumber(ERR Err)
void SetObjectIp(IP Ip)
Set current instruction pointer.
void setSoundInstance(SOUND_GLOBALS *_Instance)
void * PrimParPointer(void)
Get next encoded parameter from byte code stream.
IP GetObjectIp(void)
Get current instruction pointer.
OBJID CallingObjectId(void)
Get calling object id.
SOUND_GLOBALS * gSoundInstance
IMGDATA * IP
Instruction pointer type.
void GetResourcePath(char *pString, DATA8 MaxLength)
#define SOUND_FILE_BUFFER_SIZE
void cSoundTest(void)
opSOUND_TEST byte code
#define SOUND_ADPCM_INIT_VALPREV
void cSoundReady(void)
opSOUND_READY byte code
unsigned char UBYTE
Basic Type used to symbolise 8 bit unsigned values.
SOUND_GLOBALS * getSoundInstance()
char PathBuffer[MAX_FILENAME_SIZE]
#define SOUND_ADPCM_CHUNK
unsigned short UWORD
Basic Type used to symbolise 16 bit unsigned values.
UBYTE cSoundGetAdPcmValue(UBYTE Delta)
signed short SWORD
Basic Type used to symbolise 16 bit signed values.
#define FILEFORMAT_ADPCM_SOUND
const SWORD IndexTable[INDEX_TABLE_ENTRIES]
#define STEP_SIZE_TABLE_ENTRIES
#define SOUND_ADPCM_INIT_INDEX
SBYTE DATA8
VM Type for 1 byte signed value.
UBYTE SoundData[SOUND_FILE_BUFFER_SIZE+1]
RESULT cSoundUpdate(void)
int SoundDriverDescriptor
Break because of waiting for completion.
Dispatcher running (looping)