Console Library 8.0.0
A header-only library that makes C++ simple
Loading...
Searching...
No Matches
melody.h
Go to the documentation of this file.
1
11
12/*
13Copyright (c) 2026 MrXie1109
14
15Permission is hereby granted, free of charge, to any person obtaining a copy
16of this software and associated documentation files (the "Software"), to deal
17in the Software without restriction, including without limitation the rights
18to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19copies of the Software, and to permit persons to whom the Software is
20furnished to do so, subject to the following conditions:
21
22The above copyright notice and this permission notice shall be included in all
23copies or substantial portions of the Software.
24
25THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31SOFTWARE.
32*/
33
34#pragma once
35
36#ifdef _WIN32
37#ifndef CONSOLE_IGNORE_ADVICE
38#pragma message( \
39 "Remember to link against winmm library (e.g., -lwinmm or winmm.lib)")
40#pragma message("Define 'CONSOLE_IGNORE_ADVICE' for ignore it")
41#endif
42#else
43#error "Unsupported platform - this library is for Windows only"
44#endif
45
46#define WIN32_LEAN_AND_MEAN // 可以排除大量不需要的 Windows 组件
47#define NOMINMAX 1 // 避免 min/max 宏污染
48#define NOSERVICE // 不需要 Windows 服务
49#define NOMCX // 不需要媒体中心扩展
50#define NOHELP // 不需要 WinHelp
51#define NOSOUND // 不需要波形音频
52#define NOCOMM // 不需要串口通信
53#define NOKANJI // 不需要日文字符支持
54#define NOCLIPBOARD // 不需要剪贴板
55#define NOCOLOR // 不需要颜色表
56#define NODRAWTEXT // 不需要 DrawText
57#define NOGDI // 不需要 GDI 图形接口
58#define NOUSER // 不需要 USER 模块(窗口管理)
59#define NOMENUS // 不需要菜单
60#define NOICONS // 不需要图标
61#define NOSYSCOMMANDS // 不需要系统命令
62#define NORASTEROPS // 不需要光栅操作
63#define NOSHOWWINDOW // 不需要 ShowWindow
64#define NOATOM // 不需要原子表
65#define NOCTLMGR // 不需要控件管理器
66#define NOMETAFILE // 不需要元文件
67#define NOOPENFILE // 不需要 OpenFile
68#define NOSCROLL // 不需要滚动条
69#define NOSERVICE // 不需要服务
70#define NOTEXTMETRIC // 不需要文本度量
71#define NOWH // 不需要 Windows 挂钩
72#define NOWINOFFSETS // 不需要窗口偏移量
73#define NOPROFILER // 不需要性能分析器
74#define NODEFERWINDOWPOS // 不需要 DeferWindowPos
75#include <mmsystem.h>
76#include <thread>
77#include <windows.h>
78
79namespace console {
85 enum class Instrument : unsigned char {
94 Celesta = 8,
96 MusicBox = 10,
98 Marimba = 12,
99 Xylophone = 13,
101 Dulcimer = 15,
126 Violin = 40,
127 Viola = 41,
128 Cello = 42,
133 Timpani = 47,
142 Trumpet = 56,
143 Trombone = 57,
144 Tuba = 58,
151 AltoSax = 65,
152 TenorSax = 66,
154 Oboe = 68,
156 Bassoon = 70,
157 Clarinet = 71,
158 Piccolo = 72,
159 Flute = 73,
160 Recorder = 74,
161 PanFlute = 75,
164 Whistle = 78,
165 Ocarina = 79,
175 Pad2Warm = 89,
180 Pad7Halo = 94,
182 Fx1Rain = 96,
188 Fx7Echoes = 102,
189 Fx8SciFi = 103,
190 Sitar = 104,
191 Banjo = 105,
192 Shamisen = 106,
193 Koto = 107,
194 Kalimba = 108,
195 Bagpipe = 109,
196 Fiddle = 110,
197 Shanai = 111,
199 Agogo = 113,
201 Woodblock = 115,
202 TaikoDrum = 116,
204 SynthDrum = 118,
208 Seashore = 122,
209 BirdTweet = 123,
212 Applause = 126,
213 Gunshot = 127
214 };
215
221 namespace pitches {
224 const int C0 = 12, D0 = 14, E0 = 16, F0 = 17, G0 = 19, A0 = 21, B0 = 23;
225 const int C1 = 24, D1 = 26, E1 = 28, F1 = 29, G1 = 31, A1 = 33, B1 = 35;
226 const int C2 = 36, D2 = 38, E2 = 40, F2 = 41, G2 = 43, A2 = 45, B2 = 47;
227 const int C3 = 48, D3 = 50, E3 = 52, F3 = 53, G3 = 55, A3 = 57, B3 = 59;
228 const int C4 = 60, D4 = 62, E4 = 64, F4 = 65, G4 = 67, A4 = 69, B4 = 71;
229 const int C5 = 72, D5 = 74, E5 = 76, F5 = 77, G5 = 79, A5 = 81, B5 = 83;
230 const int C6 = 84, D6 = 86, E6 = 88, F6 = 89, G6 = 91, A6 = 93, B6 = 95;
231 const int C7 = 96, D7 = 98, E7 = 100, F7 = 101, G7 = 103, A7 = 105,
232 B7 = 107;
233 const int C8 = 108, D8 = 110, E8 = 112, F8 = 113, G8 = 115, A8 = 117,
234 B8 = 119;
235 const int C9 = 120, D9 = 122, E9 = 124, F9 = 125, G9 = 127;
237
240 const int Cs0 = 13, Ds0 = 15, Fs0 = 18, Gs0 = 20, As0 = 22;
241 const int Cs1 = 25, Ds1 = 27, Fs1 = 30, Gs1 = 32, As1 = 34;
242 const int Cs2 = 37, Ds2 = 39, Fs2 = 42, Gs2 = 44, As2 = 46;
243 const int Cs3 = 49, Ds3 = 51, Fs3 = 54, Gs3 = 56, As3 = 58;
244 const int Cs4 = 61, Ds4 = 63, Fs4 = 66, Gs4 = 68, As4 = 70;
245 const int Cs5 = 73, Ds5 = 75, Fs5 = 78, Gs5 = 80, As5 = 82;
246 const int Cs6 = 85, Ds6 = 87, Fs6 = 90, Gs6 = 92, As6 = 94;
247 const int Cs7 = 97, Ds7 = 99, Fs7 = 102, Gs7 = 104, As7 = 106;
248 const int Cs8 = 109, Ds8 = 111, Fs8 = 114, Gs8 = 116, As8 = 118;
249 const int Cs9 = 121, Ds9 = 123, Fs9 = 126;
251
253 const int REST = -1;
254 }
255
260 struct Note {
261 signed char
263 double beats;
264 signed char volume;
265
272 Note(signed char p = 60, double b = 1, signed char v = -1) :
273 pitch(p), beats(b), volume(v) {}
274 };
275
287 class MIDI {
288 HMIDIOUT handle;
289 unsigned char bpm;
290 unsigned char volume;
292
293 public:
303 unsigned char bpm = 120,
304 unsigned char volume = 100,
305 unsigned deviceID = 0) :
307 HMIDIOUT h = nullptr;
308 if (midiOutOpen(&h, deviceID, 0, 0, CALLBACK_NULL)
309 == MMSYSERR_NOERROR) {
310 handle = h;
311 DWORD program_change
312 = 0xC0 | ((unsigned char)(instrument) << 8);
313 midiOutShortMsg(handle, program_change);
314 DWORD volume_change = 0xB0 | (0x07 << 8) | (volume << 16);
315 midiOutShortMsg(handle, volume_change);
316 } else
317 handle = nullptr;
318 }
319
321 MIDI(const MIDI &) = delete;
323 MIDI(MIDI &&midi) = delete;
325 const MIDI &operator=(const MIDI &) = delete;
327 const MIDI &operator=(MIDI &&) = delete;
328
333 ~MIDI() noexcept {
334 if (handle) midiOutClose(handle);
335 }
336
340 unsigned char get_bpm() const { return bpm; }
342 void set_bpm(unsigned char new_bpm) { bpm = new_bpm; }
343
351 void set_instrument(Instrument new_instrument) {
352 instrument = new_instrument;
353 if (!handle) return;
354 DWORD program_change
355 = 0xC0 | ((unsigned char)(new_instrument) << 8);
356 midiOutShortMsg(handle, program_change);
357 }
358
360 unsigned char get_volume() const { return volume; }
365 void set_volume(unsigned char vol) {
366 volume = vol;
367 if (!handle) return;
368 DWORD volume_change = 0xB0 | (0x07 << 8) | (vol << 16);
369 midiOutShortMsg(handle, volume_change);
370 }
371
372
380 void play(Note note) {
381 if (!handle) return;
382 if (note.pitch != -1) {
383 DWORD note_on
384 = 0x90 | (note.pitch << 8)
385 | ((note.volume == -1 ? volume : note.volume) << 16);
386 midiOutShortMsg(handle, note_on);
387 Sleep(60000 * note.beats / bpm);
388 DWORD note_off = 0x80 | (note.pitch << 8) | (64 << 16);
389 midiOutShortMsg(handle, note_off);
390 } else
391 Sleep(60000 * note.beats / bpm);
392 }
393
401 void nplay(Note note) {
402 std::thread([this, note]() { play(note); }).detach();
403 }
404
411 template <class Iter>
412 void play(Iter begin, Iter end) {
413 for (; begin != end; ++begin) play(*begin);
414 }
415
422 template <class Iter>
423 void nplay(Iter begin, Iter end) {
424 std::thread([=]() { play(begin, end); }).detach();
425 }
426
431 void note_on(Note note) {
432 if (!handle) return;
433 DWORD on = 0x90 | (note.pitch << 8)
434 | ((note.volume == -1 ? volume : note.volume) << 16);
435 midiOutShortMsg(handle, on);
436 }
437
442 void note_off(Note note) {
443 if (!handle) return;
444 DWORD off = 0x80 | (note.pitch << 8) | (64 << 16);
445 midiOutShortMsg(handle, off);
446 }
447 };
448}
unsigned char get_bpm() const
Definition melody.h:340
void nplay(Note note)
异步播放一个音符(非阻塞)。
Definition melody.h:401
MIDI(MIDI &&midi)=delete
禁止移动构造。
unsigned char volume
默认音量(0-127)
Definition melody.h:290
void set_bpm(unsigned char new_bpm)
设置 BPM。
Definition melody.h:342
void play(Note note)
同步播放一个音符(阻塞)。
Definition melody.h:380
void play(Iter begin, Iter end)
同步播放一个音符范围(阻塞)。
Definition melody.h:412
Instrument instrument
当前乐器
Definition melody.h:291
MIDI(Instrument instrument=Instrument::AcousticGrandPiano, unsigned char bpm=120, unsigned char volume=100, unsigned deviceID=0)
构造 MIDI 对象,打开默认 MIDI 设备并设置乐器、音量和 BPM。
Definition melody.h:302
void note_off(Note note)
结束某个音符的播放。
Definition melody.h:442
void nplay(Iter begin, Iter end)
异步步播放一个音符范围(非阻塞)。
Definition melody.h:423
Instrument get_instrument()
获取当前乐器。
Definition melody.h:345
HMIDIOUT handle
MIDI 输出设备句柄
Definition melody.h:288
unsigned char get_volume() const
获取默认音量。
Definition melody.h:360
const MIDI & operator=(const MIDI &)=delete
禁止拷贝赋值。
~MIDI() noexcept
析构函数,关闭 MIDI 设备。
Definition melody.h:333
void note_on(Note note)
开始播放某个音符。
Definition melody.h:431
unsigned char bpm
每分钟节拍数(beats per minute)
Definition melody.h:289
MIDI(const MIDI &)=delete
禁止拷贝构造。
void set_instrument(Instrument new_instrument)
切换乐器。
Definition melody.h:351
void set_volume(unsigned char vol)
设置默认音量。
Definition melody.h:365
const MIDI & operator=(MIDI &&)=delete
禁止移动赋值。
const int D2
Definition melody.h:226
const int Cs7
Definition melody.h:247
const int As8
Definition melody.h:248
const int C9
Definition melody.h:235
const int D4
Definition melody.h:228
const int B3
Definition melody.h:227
const int B7
Definition melody.h:232
const int C7
Definition melody.h:231
const int A4
Definition melody.h:228
const int Fs7
Definition melody.h:247
const int C3
Definition melody.h:227
const int E5
Definition melody.h:229
const int B5
Definition melody.h:229
const int Ds2
Definition melody.h:242
const int G8
Definition melody.h:233
const int Gs0
Definition melody.h:240
const int F3
Definition melody.h:227
const int Ds3
Definition melody.h:243
const int D6
Definition melody.h:230
const int G5
Definition melody.h:229
const int As6
Definition melody.h:246
const int D7
Definition melody.h:231
const int Ds4
Definition melody.h:244
const int D1
Definition melody.h:225
const int Gs8
Definition melody.h:248
const int F6
Definition melody.h:230
const int Gs2
Definition melody.h:242
const int F2
Definition melody.h:226
const int As1
Definition melody.h:241
const int Cs2
Definition melody.h:242
const int Cs4
Definition melody.h:244
const int E2
Definition melody.h:226
const int D9
Definition melody.h:235
const int A8
Definition melody.h:233
const int G7
Definition melody.h:231
const int Ds1
Definition melody.h:241
const int E7
Definition melody.h:231
const int As0
Definition melody.h:240
const int F1
Definition melody.h:225
const int C2
Definition melody.h:226
const int E1
Definition melody.h:225
const int Gs1
Definition melody.h:241
const int C1
Definition melody.h:225
const int F8
Definition melody.h:233
const int Gs7
Definition melody.h:247
const int Cs8
Definition melody.h:248
const int B8
Definition melody.h:234
const int Cs9
Definition melody.h:249
const int G3
Definition melody.h:227
const int E6
Definition melody.h:230
const int Fs9
Definition melody.h:249
const int G4
Definition melody.h:228
const int A6
Definition melody.h:230
const int Fs4
Definition melody.h:244
const int E4
Definition melody.h:228
const int Fs8
Definition melody.h:248
const int Fs6
Definition melody.h:246
const int A1
Definition melody.h:225
const int A0
Definition melody.h:224
const int As7
Definition melody.h:247
const int Ds8
Definition melody.h:248
const int F7
Definition melody.h:231
const int Gs4
Definition melody.h:244
const int A2
Definition melody.h:226
const int Gs6
Definition melody.h:246
const int Gs5
Definition melody.h:245
const int Ds6
Definition melody.h:246
const int C8
Definition melody.h:233
const int Cs3
Definition melody.h:243
const int Ds0
Definition melody.h:240
const int B1
Definition melody.h:225
const int As2
Definition melody.h:242
const int Cs6
Definition melody.h:246
const int F0
Definition melody.h:224
const int F5
Definition melody.h:229
const int G9
Definition melody.h:235
const int C6
Definition melody.h:230
const int Cs0
Definition melody.h:240
const int D3
Definition melody.h:227
const int B4
Definition melody.h:228
const int Cs5
Definition melody.h:245
const int Ds5
Definition melody.h:245
const int G1
Definition melody.h:225
const int B2
Definition melody.h:226
const int G0
Definition melody.h:224
const int D0
Definition melody.h:224
const int Fs5
Definition melody.h:245
const int D8
Definition melody.h:233
const int G6
Definition melody.h:230
const int As4
Definition melody.h:244
const int E0
Definition melody.h:224
const int B0
Definition melody.h:224
const int F4
Definition melody.h:228
const int As3
Definition melody.h:243
const int A7
Definition melody.h:231
const int As5
Definition melody.h:245
const int Cs1
Definition melody.h:241
const int Gs3
Definition melody.h:243
const int Ds9
Definition melody.h:249
const int C0
Definition melody.h:224
const int E9
Definition melody.h:235
const int A3
Definition melody.h:227
const int A5
Definition melody.h:229
const int D5
Definition melody.h:229
const int E3
Definition melody.h:227
const int E8
Definition melody.h:233
const int Fs3
Definition melody.h:243
const int Fs2
Definition melody.h:242
const int B6
Definition melody.h:230
const int F9
Definition melody.h:235
const int Fs0
Definition melody.h:240
const int REST
休止符(不发音,仅占用时值)
Definition melody.h:253
const int C5
Definition melody.h:229
const int C4
Definition melody.h:228
const int Ds7
Definition melody.h:247
const int Fs1
Definition melody.h:241
const int G2
Definition melody.h:226
本库所有组件所在的顶层命名空间。
Instrument
128 种 GM 标准乐器编号(0-127)。
Definition melody.h:85
@ OrchestralHarp
竖琴
Definition melody.h:132
@ Violin
小提琴
Definition melody.h:126
@ GuitarFretNoise
吉他擦弦声
Definition melody.h:206
@ Lead2Sawtooth
锯齿波领奏
Definition melody.h:167
@ Trombone
长号
Definition melody.h:143
@ GuitarHarmonics
吉他泛音
Definition melody.h:117
@ Celesta
钢片琴
Definition melody.h:94
@ Pad5Bowed
弓弦背景
Definition melody.h:178
@ AcousticGrandPiano
大钢琴 (默认)
Definition melody.h:86
@ StringEnsemble1
弦乐合奏 1
Definition melody.h:134
@ Trumpet
小号
Definition melody.h:142
@ Flute
长笛
Definition melody.h:159
@ TelephoneRing
电话铃
Definition melody.h:210
@ Cello
大提琴
Definition melody.h:128
@ Recorder
竖笛
Definition melody.h:160
@ PanFlute
排箫
Definition melody.h:161
@ Agogo
阿果果铃
Definition melody.h:199
@ HonkyTonkPiano
酒吧钢琴
Definition melody.h:89
@ Gunshot
枪声
Definition melody.h:213
@ ElectricBassPick
拨片电贝司
Definition melody.h:120
@ AcousticGuitarNylon
尼龙弦吉他
Definition melody.h:110
@ ChurchOrgan
教堂风琴
Definition melody.h:105
@ BlownBottle
吹瓶口
Definition melody.h:162
@ TenorSax
次中音萨克斯
Definition melody.h:152
@ SynthDrum
合成鼓
Definition melody.h:204
@ StringEnsemble2
弦乐合奏 2
Definition melody.h:135
@ Helicopter
直升机
Definition melody.h:211
@ SynthBrass2
合成铜管 2
Definition melody.h:149
@ Fx7Echoes
回声
Definition melody.h:188
@ Seashore
海浪
Definition melody.h:208
@ BrassSection
铜管组
Definition melody.h:147
@ Bassoon
巴松管
Definition melody.h:156
@ Lead3Calliope
汽笛风琴
Definition melody.h:168
@ RockOrgan
摇滚风琴
Definition melody.h:104
@ SlapBass1
击弦贝司 1
Definition melody.h:122
@ DrawbarOrgan
拉杆风琴
Definition melody.h:102
@ EnglishHorn
英国管
Definition melody.h:155
@ PercussiveOrgan
打击型风琴
Definition melody.h:103
@ Harpsichord
大键琴
Definition melody.h:92
@ Oboe
双簧管
Definition melody.h:154
@ ChoirAahs
合唱 "啊"
Definition melody.h:138
@ AcousticBass
原声贝司
Definition melody.h:118
@ Clavinet
击弦古钢琴
Definition melody.h:93
@ DistortionGuitar
失真吉他
Definition melody.h:116
@ Piccolo
短笛
Definition melody.h:158
@ BirdTweet
鸟鸣
Definition melody.h:209
@ OverdrivenGuitar
过载吉他
Definition melody.h:115
@ SynthStrings2
合成弦乐 2
Definition melody.h:137
@ TaikoDrum
太鼓
Definition melody.h:202
@ ElectricBassFinger
指拨电贝司
Definition melody.h:119
@ Woodblock
木鱼
Definition melody.h:201
@ Lead7Fifths
五度领奏
Definition melody.h:172
@ TubularBells
管钟
Definition melody.h:100
@ Fx8SciFi
科幻
Definition melody.h:189
@ MelodicTom
旋律通鼓
Definition melody.h:203
@ SopranoSax
高音萨克斯
Definition melody.h:150
@ Accordion
手风琴
Definition melody.h:107
@ Lead1Square
方波领奏
Definition melody.h:166
@ Glockenspiel
钟琴
Definition melody.h:95
@ TinkleBell
铃铛
Definition melody.h:198
@ Banjo
班卓琴
Definition melody.h:191
@ BrightAcousticPiano
明亮的钢琴
Definition melody.h:87
@ SynthBrass1
合成铜管 1
Definition melody.h:148
@ PizzicatoStrings
弦乐拨奏
Definition melody.h:131
@ Pad6Metallic
金属背景
Definition melody.h:179
@ Bagpipe
风笛
Definition melody.h:195
@ Clarinet
单簧管
Definition melody.h:157
@ Tuba
大号
Definition melody.h:144
@ ElectricGuitarJazz
爵士吉他
Definition melody.h:112
@ Kalimba
卡林巴
Definition melody.h:194
@ Pad7Halo
光环背景
Definition melody.h:180
@ Timpani
定音鼓
Definition melody.h:133
@ Ocarina
奥卡雷纳
Definition melody.h:165
@ ElectricPiano1
电钢琴 1
Definition melody.h:90
@ Lead8BassLead
贝司领奏
Definition melody.h:173
@ Fx3Crystal
水晶
Definition melody.h:184
@ Lead5Charang
炭精吉他
Definition melody.h:170
@ ElectricGuitarMuted
闷音吉他
Definition melody.h:114
@ SynthBass1
合成贝司 1
Definition melody.h:124
@ Pad8Sweep
扫弦背景
Definition melody.h:181
@ BreathNoise
呼吸声
Definition melody.h:207
@ Dulcimer
扬琴
Definition melody.h:101
@ Shakuhachi
尺八
Definition melody.h:163
@ ReedOrgan
簧风琴
Definition melody.h:106
@ AcousticGuitarSteel
钢弦吉他
Definition melody.h:111
@ Fiddle
民间提琴
Definition melody.h:196
@ Contrabass
低音提琴
Definition melody.h:129
@ MutedTrumpet
弱音小号
Definition melody.h:145
@ Fx4Atmosphere
大气
Definition melody.h:185
@ Fx1Rain
雨声
Definition melody.h:182
@ Pad2Warm
温暖背景
Definition melody.h:175
@ Vibraphone
颤音琴
Definition melody.h:97
@ Pad3Polysynth
复音合成背景
Definition melody.h:176
@ Sitar
西塔琴
Definition melody.h:190
@ Koto
古筝
Definition melody.h:193
@ AltoSax
中音萨克斯
Definition melody.h:151
@ SynthStrings1
合成弦乐 1
Definition melody.h:136
@ Shamisen
三味线
Definition melody.h:192
@ VoiceOohs
人声 "哦"
Definition melody.h:139
@ ElectricGrandPiano
电子大钢琴
Definition melody.h:88
@ Lead6Voice
人声领奏
Definition melody.h:171
@ Marimba
马林巴
Definition melody.h:98
@ ElectricGuitarClean
清音电吉他
Definition melody.h:113
@ Whistle
口哨
Definition melody.h:164
@ ReverseCymbal
反奏钹
Definition melody.h:205
@ Viola
中提琴
Definition melody.h:127
@ TremoloStrings
弦乐颤音
Definition melody.h:130
@ TangoAccordion
探戈手风琴
Definition melody.h:109
@ SteelDrums
钢鼓
Definition melody.h:200
@ MusicBox
八音盒
Definition melody.h:96
@ FretlessBass
无品贝司
Definition melody.h:121
@ SynthVoice
合成人声
Definition melody.h:140
@ Harmonica
口琴
Definition melody.h:108
@ OrchestraHit
乐队打击乐
Definition melody.h:141
@ Lead4Chiff
气声领奏
Definition melody.h:169
@ Fx5Brightness
明亮
Definition melody.h:186
@ Fx6Goblins
小妖
Definition melody.h:187
@ Xylophone
木琴
Definition melody.h:99
@ Pad4Choir
合唱背景
Definition melody.h:177
@ Applause
掌声
Definition melody.h:212
@ SynthBass2
合成贝司 2
Definition melody.h:125
@ Shanai
唢呐
Definition melody.h:197
@ Pad1NewAge
新世纪背景
Definition melody.h:174
@ SlapBass2
击弦贝司 2
Definition melody.h:123
@ ElectricPiano2
电钢琴 2
Definition melody.h:91
@ BaritoneSax
上低音萨克斯
Definition melody.h:153
@ Fx2Soundtrack
电影配乐
Definition melody.h:183
@ FrenchHorn
圆号
Definition melody.h:146
标准 MIDI 音高常量,包含中央 C4=60 的所有半音音高,以及休止符 REST。
表示一个音符,包含音高、时值和力度。
Definition melody.h:260
signed char volume
力度(0-127),-1 表示使用 MIDI 对象的默认音量
Definition melody.h:264
Note(signed char p=60, double b=1, signed char v=-1)
构造一个音符。
Definition melody.h:272
signed char pitch
MIDI 音高编号(0-127),或 pitches::REST 表示休止符
Definition melody.h:262
double beats
音符时值(以四分音符为单位,1 表示一拍)
Definition melody.h:263