-
Notifications
You must be signed in to change notification settings - Fork 100
/
sfc_play.h
58 lines (48 loc) · 1.11 KB
/
sfc_play.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
// License: MIT http://opensource.org/licenses/MIT
// Author: dustpg mailto:dustpg@gmail.com
#include <stdint.h>
/// <summary>
///
/// </summary>
struct sfc_square_channel_state_t {
// 方波 频率
float frequency;
// 方波 音量
uint16_t volume;
// 方波 占空比
uint16_t duty;
};
/// <summary>
///
/// </summary>
struct sfc_triangle_channel_state_t {
// 三角波 频率
float frequency;
};
/// <summary>
///
/// </summary>
struct sfc_noise_channel_state_t {
// 噪音 音量
uint16_t volume;
// 噪音 频率数据
uint16_t data;
};
/// <summary>
///
/// </summary>
typedef struct {
// 方波#1
struct sfc_square_channel_state_t square1;
// 方波#2
struct sfc_square_channel_state_t square2;
// 三角波
struct sfc_triangle_channel_state_t triangle;
// 噪音
struct sfc_noise_channel_state_t noise;
} sfc_channel_state_t;
// typedef
struct sfc_famicom;
typedef struct sfc_famicom sfc_famicom_t;
extern void sfc_play_audio_easy(const sfc_famicom_t*, sfc_channel_state_t*state);