From: Anton Baskanov baskanov@gmail.com
--- dlls/dmusic/instrument.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index 40c43277243..2b75a276feb 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -593,7 +593,7 @@ static HRESULT instrument_add_soundfont_region(struct instrument *This, struct s unity_note = generators->amount[SF_GEN_OVERRIDING_ROOT_KEY].value; if (unity_note == (WORD)-1) unity_note = sample->original_key; region->wave_sample.usUnityNote = unity_note - (SHORT)generators->amount[SF_GEN_COARSE_TUNE].value; - region->wave_sample.sFineTune = sample->correction + generators->amount[SF_GEN_FINE_TUNE].value; + region->wave_sample.sFineTune = sample->correction + (SHORT)generators->amount[SF_GEN_FINE_TUNE].value; region->wave_sample.lAttenuation = (LONG)round(attenuation * -65536.);
start_loop = generators->amount[SF_GEN_STARTLOOP_ADDRS_OFFSET].value;
From: Anton Baskanov baskanov@gmail.com
--- dlls/dmusic/instrument.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index 2b75a276feb..d028600a65c 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -666,6 +666,8 @@ HRESULT instrument_create_from_soundfont(struct soundfont *soundfont, UINT index This = impl_from_IDirectMusicInstrument(iface);
This->header.Locale.ulBank = (preset->bank & 0x7f) | ((preset->bank << 1) & 0x7f00); + if (preset->bank == 128) + This->header.Locale.ulBank = F_INSTRUMENT_DRUMS; This->header.Locale.ulInstrument = preset->preset; MultiByteToWideChar(CP_ACP, 0, preset->name, strlen(preset->name) + 1, desc->wszName, sizeof(desc->wszName));
From: Anton Baskanov baskanov@gmail.com
--- dlls/dmusic/instrument.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index d028600a65c..90b829402b7 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -574,6 +574,7 @@ static HRESULT instrument_add_soundfont_region(struct instrument *This, struct s region->header.RangeKey.usHigh = generators->amount[SF_GEN_KEY_RANGE].range.high; region->header.RangeVelocity.usLow = generators->amount[SF_GEN_VEL_RANGE].range.low; region->header.RangeVelocity.usHigh = generators->amount[SF_GEN_VEL_RANGE].range.high; + region->header.usKeyGroup = generators->amount[SF_GEN_EXCLUSIVE_CLASS].value;
region->wave_link.ulTableIndex = sample_index;
From: Anton Baskanov baskanov@gmail.com
Otherwise they won't have effect when a default generator is used. --- dlls/dmusic/instrument.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index 90b829402b7..4d3d4724604 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -551,7 +551,6 @@ static BOOL parse_soundfont_generators(struct soundfont *soundfont, UINT index,
default: generators->amount[gen->oper] = gen->amount; - if (preset_generators) generators->amount[gen->oper].value += preset_generators->amount[gen->oper].value; break; } } @@ -630,6 +629,7 @@ static HRESULT instrument_add_soundfont_instrument(struct instrument *This, stru struct sf_generators global_generators = SF_DEFAULT_GENERATORS; struct sf_instrument *instrument = soundfont->inst + index; UINT i = instrument->bag_ndx; + sf_generator oper; HRESULT hr = S_OK;
for (i = instrument->bag_ndx; SUCCEEDED(hr) && i < (instrument + 1)->bag_ndx; i++) @@ -645,6 +645,9 @@ static HRESULT instrument_add_soundfont_instrument(struct instrument *This, stru continue; }
+ for (oper = 0; oper < SF_GEN_END_OPER; ++oper) + generators.amount[oper].value += preset_generators->amount[oper].value; + hr = instrument_add_soundfont_region(This, soundfont, &generators); }
From: Anton Baskanov baskanov@gmail.com
--- dlls/dmusic/instrument.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index 4d3d4724604..f92e3afa976 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -510,11 +510,11 @@ static const struct sf_generators SF_DEFAULT_GENERATORS = } };
-static BOOL parse_soundfont_generators(struct soundfont *soundfont, UINT index, - struct sf_generators *preset_generators, struct sf_generators *generators) +static BOOL parse_soundfont_generators(struct soundfont *soundfont, UINT index, BOOL preset, + struct sf_generators *generators) { - struct sf_bag *bag = (preset_generators ? soundfont->ibag : soundfont->pbag) + index; - struct sf_gen *gen, *gens = preset_generators ? soundfont->igen : soundfont->pgen; + struct sf_bag *bag = (preset ? soundfont->pbag : soundfont->ibag) + index; + struct sf_gen *gen, *gens = preset ? soundfont->pgen : soundfont->igen;
for (gen = gens + bag->gen_ndx; gen < gens + (bag + 1)->gen_ndx; gen++) { @@ -533,18 +533,18 @@ static BOOL parse_soundfont_generators(struct soundfont *soundfont, UINT index, case SF_GEN_SAMPLE_MODES: case SF_GEN_EXCLUSIVE_CLASS: case SF_GEN_OVERRIDING_ROOT_KEY: - if (preset_generators) generators->amount[gen->oper] = gen->amount; + if (!preset) generators->amount[gen->oper] = gen->amount; else WARN("Ignoring invalid preset generator %s\n", debugstr_sf_gen(gen)); break;
case SF_GEN_INSTRUMENT: - if (!preset_generators) generators->amount[gen->oper] = gen->amount; + if (preset) generators->amount[gen->oper] = gen->amount; else WARN("Ignoring invalid instrument generator %s\n", debugstr_sf_gen(gen)); /* should always be the last generator */ return FALSE;
case SF_GEN_SAMPLE_ID: - if (preset_generators) generators->amount[gen->oper] = gen->amount; + if (!preset) generators->amount[gen->oper] = gen->amount; else WARN("Ignoring invalid preset generator %s\n", debugstr_sf_gen(gen)); /* should always be the last generator */ return FALSE; @@ -636,7 +636,7 @@ static HRESULT instrument_add_soundfont_instrument(struct instrument *This, stru { struct sf_generators generators = global_generators;
- if (parse_soundfont_generators(soundfont, i, preset_generators, &generators)) + if (parse_soundfont_generators(soundfont, i, FALSE, &generators)) { if (i > instrument->bag_ndx) WARN("Ignoring instrument zone without a sample id\n"); @@ -681,7 +681,7 @@ HRESULT instrument_create_from_soundfont(struct soundfont *soundfont, UINT index struct sf_generators generators = global_generators; UINT instrument;
- if (parse_soundfont_generators(soundfont, i, NULL, &generators)) + if (parse_soundfont_generators(soundfont, i, TRUE, &generators)) { if (i > preset->bag_ndx) WARN("Ignoring preset zone without an instrument\n");
This merge request was approved by Rémi Bernon.
This merge request was approved by Michael Stefaniuc.
Test failures are unrelated