Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/audio/effects.h
7857 views
1
#ifndef AUDIO_EFFECTS_H
2
#define AUDIO_EFFECTS_H
3
4
#include <PR/ultratypes.h>
5
6
#include "internal.h"
7
#include "platform_info.h"
8
9
#define ADSR_STATE_DISABLED 0
10
#define ADSR_STATE_INITIAL 1
11
#define ADSR_STATE_START_LOOP 2
12
#define ADSR_STATE_LOOP 3
13
#define ADSR_STATE_FADE 4
14
#define ADSR_STATE_HANG 5
15
#define ADSR_STATE_DECAY 6
16
#define ADSR_STATE_RELEASE 7
17
#define ADSR_STATE_SUSTAIN 8
18
19
#define ADSR_ACTION_RELEASE 0x10
20
#define ADSR_ACTION_DECAY 0x20
21
#define ADSR_ACTION_HANG 0x40
22
23
#define ADSR_DISABLE 0
24
#define ADSR_HANG -1
25
#define ADSR_GOTO -2
26
#define ADSR_RESTART -3
27
28
// Envelopes are always stored as big endian, to match sequence files which are
29
// byte blobs and can embed envelopes. Hence this byteswapping macro.
30
#if IS_BIG_ENDIAN
31
#define BSWAP16(x) (x)
32
#else
33
#define BSWAP16(x) (((x) & 0xff) << 8 | (((x) >> 8) & 0xff))
34
#endif
35
36
void sequence_player_process_sound(struct SequencePlayer *seqPlayer, float seqVol);
37
void note_vibrato_update(struct Note *note);
38
void note_vibrato_init(struct Note *note);
39
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, s16 *volOut);
40
#if defined(VERSION_EU) || defined(VERSION_SH)
41
f32 adsr_update(struct AdsrState *adsr);
42
#else
43
s32 adsr_update(struct AdsrState *adsr);
44
#endif
45
46
#endif // AUDIO_EFFECTS_H
47
48