-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoffline.cpp
More file actions
executable file
·105 lines (74 loc) · 3.07 KB
/
Copy pathoffline.cpp
File metadata and controls
executable file
·105 lines (74 loc) · 3.07 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//
// Created by admin on 2022/2/24.
//
#include "offline.h"
namespace mgnr {
void offline::rebuildNoteLen() {}
void offline::drawNote_begin() {}
void offline::drawNote(int fx, int fy, int tx, int ty, int volume,
const stringPool::stringPtr &info,
bool selected, bool onlydisplay) {}
void offline::drawNote_end() {}
void offline::drawDescriptions(float p, const stringPool::stringPtr &title,
const std::string &content) {}
void offline::drawDescriptionsPadd() {}
void offline::drawCaption(float p, const std::string &str) {}
void offline::callAddDescription(int tick) {}
void offline::callEditDescription(int tick, const stringPool::stringPtr &title,
const std::string &content) {}
void offline::drawTableRaw(int from, int to, int left, int right, int t) {}
void offline::drawTimeCol(float p) {}
void offline::drawSectionCol(float p, int n) {}
void offline::drawTempo(float p, double t) {}
void offline::drawTempoPadd() {}
void offline::drawScroll() {}
void offline::scrollBuilder_onGetNoteArea() {}
void offline::scrollBuilder_onGetAllNotePos(note *) {}
void offline::scrollBuilder_onSwap() {}
void offline::callJavaNoteOn(const char *info, int channel, int tone, int vol) {}
void offline::callJavaNoteOff(const char *info, int channel, int tone) {}
void offline::onLoadName(const stringPool::stringPtr &name) {}
void offline::onSelectedChange(int len) {}
void offline::onNoteOn(note *n, int c) {
if (!n->info.empty()) {
if (n->info[0] == '@')
return;
}
tsf_channel_note_on(soundfont, c, n->tone, n->volume / 128.0);
}
void offline::onNoteOff(note *n, int c) {
if (!n->info.empty()) {
if (n->info[0] == '@')
return;
}
tsf_channel_note_off(soundfont, c, n->tone);
}
void offline::onSetChannelIns(int c, int ins) {
tsf_channel_set_presetnumber(soundfont, c, ins);
}
int offline::getTime() {
return (int) nowTime;
}
offline::offline(const char *sf, int sampleRate) {
soundfont = tsf_load_filename(sf);
this->sampleRate = sampleRate;
tsf_set_output(soundfont, TSF_MONO, sampleRate, 0.8);
tsf_channel_set_bank_preset(soundfont, 9, 128, 0);
}
offline::~offline() {
tsf_close(soundfont);
}
bool offline::renderStep(float *buffer) {
nowTime = nowTime_point * 1000 / sampleRate;
//::__android_log_print(ANDROID_LOG_INFO,
// "offline_render",
// "nowTime:%f nowTime_point:%d", nowTime, nowTime_point);
if (!playingStatus) {
playStart();
}
playStep();
tsf_render_float(soundfont, buffer, 64, 0);
nowTime_point += 64;
return noteTimeMax > lookAtX;
}
}