Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f58bdd86
Commit
f58bdd86
authored
Nov 15, 2023
by
Anton Baskanov
Committed by
Alexandre Julliard
Nov 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmsynth: Factor out instrument and region search.
parent
3fd64a72
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
18 deletions
+41
-18
synth.c
dlls/dmsynth/synth.c
+41
-18
No files found.
dlls/dmsynth/synth.c
View file @
f58bdd86
...
@@ -1411,6 +1411,35 @@ static int synth_preset_get_num(fluid_preset_t *fluid_preset)
...
@@ -1411,6 +1411,35 @@ static int synth_preset_get_num(fluid_preset_t *fluid_preset)
return
preset
->
patch
;
return
preset
->
patch
;
}
}
static
void
find_region
(
struct
synth
*
synth
,
int
bank
,
int
patch
,
int
key
,
int
vel
,
struct
instrument
**
out_instrument
,
struct
region
**
out_region
)
{
struct
instrument
*
instrument
;
struct
region
*
region
;
*
out_instrument
=
NULL
;
*
out_region
=
NULL
;
LIST_FOR_EACH_ENTRY
(
instrument
,
&
synth
->
instruments
,
struct
instrument
,
entry
)
{
if
(
bank
==
128
&&
instrument
->
patch
==
(
0x80000000
|
patch
))
break
;
else
if
(
instrument
->
patch
==
((
bank
<<
8
)
|
patch
))
break
;
}
if
(
&
instrument
->
entry
==
&
synth
->
instruments
)
return
;
*
out_instrument
=
instrument
;
LIST_FOR_EACH_ENTRY
(
region
,
&
instrument
->
regions
,
struct
region
,
entry
)
{
if
(
key
<
region
->
key_range
.
usLow
||
key
>
region
->
key_range
.
usHigh
)
continue
;
if
(
vel
<
region
->
vel_range
.
usLow
||
vel
>
region
->
vel_range
.
usHigh
)
continue
;
*
out_region
=
region
;
break
;
}
}
static
BOOL
gen_from_connection
(
const
CONNECTION
*
conn
,
UINT
*
gen
)
static
BOOL
gen_from_connection
(
const
CONNECTION
*
conn
,
UINT
*
gen
)
{
{
switch
(
conn
->
usDestination
)
switch
(
conn
->
usDestination
)
...
@@ -1773,35 +1802,33 @@ static int synth_preset_noteon(fluid_preset_t *fluid_preset, fluid_synth_t *flui
...
@@ -1773,35 +1802,33 @@ static int synth_preset_noteon(fluid_preset_t *fluid_preset, fluid_synth_t *flui
{
{
struct
preset
*
preset
=
fluid_preset_get_data
(
fluid_preset
);
struct
preset
*
preset
=
fluid_preset_get_data
(
fluid_preset
);
struct
synth
*
synth
=
preset
->
synth
;
struct
synth
*
synth
=
preset
->
synth
;
struct
articulation
*
articulation
;
struct
instrument
*
instrument
;
struct
instrument
*
instrument
;
fluid_voice_t
*
fluid_voice
;
fluid_voice_t
*
fluid_voice
;
struct
region
*
region
;
struct
region
*
region
;
struct
voice
*
voice
;
struct
wave
*
wave
;
TRACE
(
"(%p, %p, %u, %u, %u)
\n
"
,
fluid_preset
,
fluid_synth
,
chan
,
key
,
vel
);
TRACE
(
"(%p, %p, %u, %u, %u)
\n
"
,
fluid_preset
,
fluid_synth
,
chan
,
key
,
vel
);
EnterCriticalSection
(
&
synth
->
cs
);
EnterCriticalSection
(
&
synth
->
cs
);
LIST_FOR_EACH_ENTRY
(
instrument
,
&
synth
->
instruments
,
struct
instrument
,
entry
)
find_region
(
synth
,
preset
->
bank
,
preset
->
patch
,
key
,
vel
,
&
instrument
,
&
region
);
{
if
(
preset
->
bank
==
128
&&
instrument
->
patch
==
(
0x80000000
|
preset
->
patch
))
break
;
else
if
(
instrument
->
patch
==
((
preset
->
bank
<<
8
)
|
preset
->
patch
))
break
;
}
if
(
&
instrument
->
entry
==
&
synth
->
instruments
)
if
(
!
instrument
)
{
{
WARN
(
"Could not find instrument with patch %#x
\n
"
,
preset
->
patch
);
WARN
(
"Could not find instrument with patch %#x
\n
"
,
preset
->
patch
);
LeaveCriticalSection
(
&
synth
->
cs
);
LeaveCriticalSection
(
&
synth
->
cs
);
return
FLUID_FAILED
;
return
FLUID_FAILED
;
}
}
if
(
!
region
)
LIST_FOR_EACH_ENTRY
(
region
,
&
instrument
->
regions
,
struct
region
,
entry
)
{
{
struct
articulation
*
articulation
;
WARN
(
"Failed to find instrument matching note / velocity
\n
"
);
struct
wave
*
wave
=
region
->
wave
;
LeaveCriticalSection
(
&
synth
->
cs
);
struct
voice
*
voice
;
return
FLUID_FAILED
;
}
if
(
key
<
region
->
key_range
.
usLow
||
key
>
region
->
key_range
.
usHigh
)
continue
;
wave
=
region
->
wave
;
if
(
vel
<
region
->
vel_range
.
usLow
||
vel
>
region
->
vel_range
.
usHigh
)
continue
;
if
(
!
(
fluid_voice
=
fluid_synth_alloc_voice
(
synth
->
fluid_synth
,
wave
->
fluid_sample
,
chan
,
key
,
vel
)))
if
(
!
(
fluid_voice
=
fluid_synth_alloc_voice
(
synth
->
fluid_synth
,
wave
->
fluid_sample
,
chan
,
key
,
vel
)))
{
{
...
@@ -1858,14 +1885,10 @@ static int synth_preset_noteon(fluid_preset_t *fluid_preset, fluid_synth_t *flui
...
@@ -1858,14 +1885,10 @@ static int synth_preset_noteon(fluid_preset_t *fluid_preset, fluid_synth_t *flui
LIST_FOR_EACH_ENTRY
(
articulation
,
&
region
->
articulations
,
struct
articulation
,
entry
)
LIST_FOR_EACH_ENTRY
(
articulation
,
&
region
->
articulations
,
struct
articulation
,
entry
)
add_voice_connections
(
fluid_voice
,
&
articulation
->
list
,
articulation
->
connections
);
add_voice_connections
(
fluid_voice
,
&
articulation
->
list
,
articulation
->
connections
);
fluid_synth_start_voice
(
synth
->
fluid_synth
,
fluid_voice
);
fluid_synth_start_voice
(
synth
->
fluid_synth
,
fluid_voice
);
LeaveCriticalSection
(
&
synth
->
cs
);
return
FLUID_OK
;
}
LeaveCriticalSection
(
&
synth
->
cs
);
LeaveCriticalSection
(
&
synth
->
cs
);
WARN
(
"Failed to find instrument matching note / velocity
\n
"
);
return
FLUID_OK
;
return
FLUID_FAILED
;
}
}
static
void
synth_preset_free
(
fluid_preset_t
*
fluid_preset
)
static
void
synth_preset_free
(
fluid_preset_t
*
fluid_preset
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment