Reformatted Organya.cpp
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
parent
3a80d8f4fb
commit
473bd43ca7
1 changed files with 55 additions and 45 deletions
|
@ -88,13 +88,15 @@ void OrganyaReleaseNote()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wave playing and loading
|
// Wave playing and loading
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
short wave_size;
|
short wave_size;
|
||||||
short oct_par;
|
short oct_par;
|
||||||
short oct_size;
|
short oct_size;
|
||||||
} OCTWAVE;
|
} OCTWAVE;
|
||||||
|
|
||||||
OCTWAVE oct_wave[8] = {
|
OCTWAVE oct_wave[8] =
|
||||||
|
{
|
||||||
{ 256, 1, 4 }, // 0 Oct
|
{ 256, 1, 4 }, // 0 Oct
|
||||||
{ 256, 2, 8 }, // 1 Oct
|
{ 256, 2, 8 }, // 1 Oct
|
||||||
{ 128, 4, 12 }, // 2 Oct
|
{ 128, 4, 12 }, // 2 Oct
|
||||||
|
@ -154,8 +156,10 @@ short freq_tbl[12] = { 262,277,294,311,330,349,370,392,415,440,466,494 };
|
||||||
|
|
||||||
void ChangeOrganFrequency(unsigned char key, signed char track, long a)
|
void ChangeOrganFrequency(unsigned char key, signed char track, long a)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 8; j++) {
|
for (int j = 0; j < 8; j++)
|
||||||
for (int i = 0; i < 2; i++) {
|
{
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
lpORGANBUFFER[track][j][i]->SetFrequency(((oct_wave[j].wave_size * freq_tbl[key]) * oct_wave[j].oct_par) / 8 + (a - 1000));
|
lpORGANBUFFER[track][j][i]->SetFrequency(((oct_wave[j].wave_size * freq_tbl[key]) * oct_wave[j].oct_par) / 8 + (a - 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,7 +458,8 @@ void LoadOrganya(const char *name)
|
||||||
info.repeat_x = READ_LE32(p);
|
info.repeat_x = READ_LE32(p);
|
||||||
info.end_x = READ_LE32(p);
|
info.end_x = READ_LE32(p);
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
info.tdata[i].freq = READ_LE16(p);
|
info.tdata[i].freq = READ_LE16(p);
|
||||||
info.tdata[i].wave_no = *p++;
|
info.tdata[i].wave_no = *p++;
|
||||||
const signed char pipi = *p++;
|
const signed char pipi = *p++;
|
||||||
|
@ -494,31 +499,36 @@ void LoadOrganya(const char *name)
|
||||||
|
|
||||||
// Set note properties
|
// Set note properties
|
||||||
np = info.tdata[j].note_p; // X position
|
np = info.tdata[j].note_p; // X position
|
||||||
for (int i = 0; i < info.tdata[j].note_num; i++) {
|
for (int i = 0; i < info.tdata[j].note_num; i++)
|
||||||
|
{
|
||||||
np->x = READ_LE32(p);
|
np->x = READ_LE32(p);
|
||||||
np++;
|
np++;
|
||||||
}
|
}
|
||||||
|
|
||||||
np = info.tdata[j].note_p; // Y position
|
np = info.tdata[j].note_p; // Y position
|
||||||
for (int i = 0; i < info.tdata[j].note_num; i++) {
|
for (int i = 0; i < info.tdata[j].note_num; i++)
|
||||||
|
{
|
||||||
np->y = *p++;
|
np->y = *p++;
|
||||||
np++;
|
np++;
|
||||||
}
|
}
|
||||||
|
|
||||||
np = info.tdata[j].note_p; // Length
|
np = info.tdata[j].note_p; // Length
|
||||||
for (int i = 0; i < info.tdata[j].note_num; i++) {
|
for (int i = 0; i < info.tdata[j].note_num; i++)
|
||||||
|
{
|
||||||
np->length = *p++;
|
np->length = *p++;
|
||||||
np++;
|
np++;
|
||||||
}
|
}
|
||||||
|
|
||||||
np = info.tdata[j].note_p; // Volume
|
np = info.tdata[j].note_p; // Volume
|
||||||
for (int i = 0; i < info.tdata[j].note_num; i++) {
|
for (int i = 0; i < info.tdata[j].note_num; i++)
|
||||||
|
{
|
||||||
np->volume = *p++;
|
np->volume = *p++;
|
||||||
np++;
|
np++;
|
||||||
}
|
}
|
||||||
|
|
||||||
np = info.tdata[j].note_p; // Pan
|
np = info.tdata[j].note_p; // Pan
|
||||||
for (int i = 0; i < info.tdata[j].note_num; i++) {
|
for (int i = 0; i < info.tdata[j].note_num; i++)
|
||||||
|
{
|
||||||
np->pan = *p++;
|
np->pan = *p++;
|
||||||
np++;
|
np++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue