Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
crowbx
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
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
Jacob Vosmaer
crowbx
Commits
959ecd1d
Commit
959ecd1d
authored
Sep 13, 2018
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pitch bend to poly mode
parent
4ca833a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
mono.c
mono.c
+6
-6
poly.c
poly.c
+14
-3
No files found.
mono.c
View file @
959ecd1d
...
...
@@ -15,7 +15,7 @@ static struct list notes = {
static
uint16_t
current_bend
;
void
set_pitch
(
uint8_t
n
);
void
mono_
set_pitch
(
uint8_t
n
);
const
uint8_t
detune_factor
[
NUM_VOICES
]
=
{
10
,
...
...
@@ -42,14 +42,14 @@ mono_note_on(uint8_t n)
l_push
(
&
notes
,
n
);
set_pitch
(
n
);
mono_
set_pitch
(
n
);
for
(
uint8_t
v
=
0
;
v
<
NUM_VOICES
;
v
++
)
{
gate_on
(
v
);
}
}
void
set_pitch
(
uint8_t
n
)
mono_
set_pitch
(
uint8_t
n
)
{
for
(
uint8_t
v
=
0
;
v
<
NUM_VOICES
;
v
++
)
{
dac_set_note2
(
v
,
n
,
(
detune_factor
[
v
]
*
detune_amount
)
/
128
,
current_bend
);
...
...
@@ -72,7 +72,7 @@ mono_note_off(uint8_t n)
return
;
}
set_pitch
(
l_first
(
&
notes
));
mono_
set_pitch
(
l_first
(
&
notes
));
}
#define CC_DETUNE 14
...
...
@@ -84,7 +84,7 @@ mono_control_change(uint8_t ctl, uint8_t val)
detune_amount
=
val
;
if
(
!
l_empty
(
&
notes
))
{
set_pitch
(
l_first
(
&
notes
));
mono_
set_pitch
(
l_first
(
&
notes
));
}
}
}
...
...
@@ -95,6 +95,6 @@ mono_pitch_bend(uint16_t bend)
current_bend
=
bend
;
if
(
!
l_empty
(
&
notes
))
{
set_pitch
(
l_first
(
&
notes
));
mono_
set_pitch
(
l_first
(
&
notes
));
}
}
poly.c
View file @
959ecd1d
...
...
@@ -3,13 +3,21 @@
#include "gate.h"
#include "voice.h"
static
uint8_t
notes
[
NUM_VOICES
];
static
uint16_t
current_bend
;
void
poly_init
(
void
)
{
voice_init
();
current_bend
=
BEND_CENTER
;
}
static
uint8_t
notes
[
NUM_VOICES
];
void
poly_set_pitch
(
uint8_t
v
,
uint8_t
note
)
{
dac_set_note2
(
v
,
note
,
0
,
current_bend
);
}
void
poly_note_on
(
uint8_t
note
)
...
...
@@ -20,7 +28,7 @@ poly_note_on(uint8_t note)
return
;
}
dac_set_note
(
v
,
note
);
poly_set_pitch
(
v
,
note
);
gate_on
(
v
);
notes
[
v
]
=
note
;
}
...
...
@@ -45,5 +53,8 @@ poly_control_change(uint8_t ctl, uint8_t val)
void
poly_pitch_bend
(
uint16_t
bend
)
{
// do nothing
current_bend
=
bend
;
for
(
uint8_t
v
=
0
;
v
<
NUM_VOICES
;
v
++
)
{
poly_set_pitch
(
v
,
notes
[
v
]);
}
}
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