fx_man.c

来自「An interactive water fountain. A realis」· C语言 代码 · 共 1,163 行 · 第 1/2 页

C
1,163
字号
int32_t FX_SetFrequency(    int32_t handle,    int32_t frequency){    int32_t status;    status = MV_SetFrequency(handle, frequency);    if (status == MV_Error)    {        FX_SetErrorCode(FX_MultiVocError);        status = FX_Warning;    }    return(status);}/*---------------------------------------------------------------------   Function: FX_PlayVOC   Begin playback of sound data with the given volume and priority.---------------------------------------------------------------------*/int32_t FX_PlayVOC(    char *ptr,    int32_t pitchoffset,    int32_t vol,    int32_t left,    int32_t right,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayVOC(ptr, pitchoffset, vol, left, right,                        priority, callbackval);    if (handle < MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}/*---------------------------------------------------------------------   Function: FX_PlayLoopedVOC   Begin playback of sound data with the given volume and priority.---------------------------------------------------------------------*/int32_t FX_PlayLoopedVOC(    char *ptr,    int32_t loopstart,    int32_t loopend,    int32_t pitchoffset,    int32_t vol,    int32_t left,    int32_t right,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayLoopedVOC(ptr, loopstart, loopend, pitchoffset,                              vol, left, right, priority, callbackval);    if (handle < MV_Ok)    {        Bsprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error));        initprintf(tempbuf);        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}/*---------------------------------------------------------------------   Function: FX_PlayWAV   Begin playback of sound data with the given volume and priority.---------------------------------------------------------------------*/int32_t FX_PlayWAV(    char *ptr,    int32_t pitchoffset,    int32_t vol,    int32_t left,    int32_t right,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayWAV(ptr, pitchoffset, vol, left, right,                        priority, callbackval);    if (handle < MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}/*---------------------------------------------------------------------   Function: FX_PlayOGG   Begin playback of sound data with the given volume and priority.---------------------------------------------------------------------*/int32_t FX_PlayOGG(    char *ptr,    int32_t pitchoffset,    int32_t vol,    int32_t left,    int32_t right,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayOGG(ptr, pitchoffset, vol, left, right,                        priority, callbackval);    if (handle < MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}/*---------------------------------------------------------------------   Function: FX_PlayWAV   Begin playback of sound data with the given volume and priority.---------------------------------------------------------------------*/int32_t FX_PlayLoopedWAV(    char *ptr,    int32_t loopstart,    int32_t loopend,    int32_t pitchoffset,    int32_t vol,    int32_t left,    int32_t right,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayLoopedWAV(ptr, loopstart, loopend,                              pitchoffset, vol, left, right, priority, callbackval);    if (handle < MV_Ok)    {        Bsprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error));        initprintf(tempbuf);        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}int32_t FX_PlayLoopedOGG(    char *ptr,    int32_t loopstart,    int32_t loopend,    int32_t pitchoffset,    int32_t vol,    int32_t left,    int32_t right,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayLoopedOGG(ptr, loopstart, loopend,                              pitchoffset, vol, left, right, priority, callbackval);    if (handle < MV_Ok)    {        Bsprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error));        initprintf(tempbuf);        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}/*---------------------------------------------------------------------   Function: FX_PlayVOC3D   Begin playback of sound data at specified angle and distance   from listener.---------------------------------------------------------------------*/int32_t FX_PlayVOC3D(    char *ptr,    int32_t pitchoffset,    int32_t angle,    int32_t distance,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayVOC3D(ptr, pitchoffset, angle, distance,                          priority, callbackval);    if (handle < MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}int32_t FX_PlayOGG3D(    char *ptr,    int32_t pitchoffset,    int32_t angle,    int32_t distance,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayOGG3D(ptr, pitchoffset, angle, distance,                          priority, callbackval);    if (handle < MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}/*---------------------------------------------------------------------   Function: FX_PlayWAV3D   Begin playback of sound data at specified angle and distance   from listener.---------------------------------------------------------------------*/int32_t FX_PlayWAV3D(    char *ptr,    int32_t pitchoffset,    int32_t angle,    int32_t distance,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayWAV3D(ptr, pitchoffset, angle, distance,                          priority, callbackval);    if (handle < MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}/*---------------------------------------------------------------------   Function: FX_PlayRaw   Begin playback of raw sound data with the given volume and priority.---------------------------------------------------------------------*/int32_t FX_PlayRaw(    char *ptr,    uint32_t length,    unsigned rate,    int32_t pitchoffset,    int32_t vol,    int32_t left,    int32_t right,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayRaw(ptr, length, rate, pitchoffset,                        vol, left, right, priority, callbackval);    if (handle < MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}/*---------------------------------------------------------------------   Function: FX_PlayLoopedRaw   Begin playback of raw sound data with the given volume and priority.---------------------------------------------------------------------*/int32_t FX_PlayLoopedRaw(    char *ptr,    uint32_t length,    char *loopstart,    char *loopend,    unsigned rate,    int32_t pitchoffset,    int32_t vol,    int32_t left,    int32_t right,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_PlayLoopedRaw(ptr, length, loopstart, loopend,                              rate, pitchoffset, vol, left, right, priority, callbackval);    if (handle < MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}/*---------------------------------------------------------------------   Function: FX_Pan3D   Set the angle and distance from the listener of the voice associated   with the specified handle.---------------------------------------------------------------------*/int32_t FX_Pan3D(    int32_t handle,    int32_t angle,    int32_t distance){    int32_t status;    status = MV_Pan3D(handle, angle, distance);    if (status != MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        status = FX_Warning;    }    return(status);}/*---------------------------------------------------------------------   Function: FX_SoundActive   Tests if the specified sound is currently playing.---------------------------------------------------------------------*/int32_t FX_SoundActive(    int32_t handle){    return(MV_VoicePlaying(handle));}/*---------------------------------------------------------------------   Function: FX_SoundsPlaying   Reports the number of voices playing.---------------------------------------------------------------------*/int32_t FX_SoundsPlaying(    void){    return(MV_VoicesPlaying());}/*---------------------------------------------------------------------   Function: FX_StopSound   Halts playback of a specific voice---------------------------------------------------------------------*/int32_t FX_StopSound(    int32_t handle){    int32_t status;    status = MV_Kill(handle);    if (status != MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        return(FX_Warning);    }    return(FX_Ok);}/*---------------------------------------------------------------------   Function: FX_StopAllSounds   Halts playback of all sounds.---------------------------------------------------------------------*/int32_t FX_StopAllSounds(    void){    int32_t status;    status = MV_KillAllVoices();    if (status != MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        return(FX_Warning);    }    return(FX_Ok);}/*---------------------------------------------------------------------   Function: FX_StartDemandFeedPlayback   Plays a digitized sound from a user controlled buffering system.---------------------------------------------------------------------*/int32_t FX_StartDemandFeedPlayback(    void(*function)(char **ptr, uint32_t *length),    int32_t rate,    int32_t pitchoffset,    int32_t vol,    int32_t left,    int32_t right,    int32_t priority,    uint32_t callbackval){    int32_t handle;    handle = MV_StartDemandFeedPlayback(function, rate,                                        pitchoffset, vol, left, right, priority, callbackval);    if (handle < MV_Ok)    {        FX_SetErrorCode(FX_MultiVocError);        handle = FX_Warning;    }    return(handle);}#if 0/*---------------------------------------------------------------------   Function: FX_StartRecording   Starts the sound recording engine.---------------------------------------------------------------------*/int32_t FX_StartRecording(    int32_t MixRate,    void(*function)(char *ptr, int32_t length)){    int32_t status;    switch (FX_SoundDevice)    {    case SoundBlaster :        status = MV_StartRecording(MixRate, function);        if (status != MV_Ok)        {            FX_SetErrorCode(FX_MultiVocError);            status = FX_Warning;        }        else        {            status = FX_Ok;        }        break;    default :        FX_SetErrorCode(FX_InvalidCard);        status = FX_Warning;        break;    }    return(status);}#endif#if 0/*---------------------------------------------------------------------   Function: FX_StopRecord   Stops the sound record engine.---------------------------------------------------------------------*/void FX_StopRecord(    void){    // Stop sound playback    switch (FX_SoundDevice)    {    case SoundBlaster :        MV_StopRecord();        break;    }}#endifextern void MUSIC_Update(void);void AudioUpdate(void) { MUSIC_Update(); }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?