Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
pimpmobile
Commits
3b6d55eb
Commit
3b6d55eb
authored
Sep 20, 2016
by
Erik Faye-Lund
Browse files
pimp-config: change parameterization of herts to periods
parent
1d0a1cab
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/pimp_config.h
View file @
3b6d55eb
...
...
@@ -9,10 +9,20 @@
/* 32 is the maximum amount of channels in fasttracker2. a nice default. */
#define PIMP_CHANNEL_COUNT 32
/* check the sample-rate calculator at http://www.pineight.com/gba/samplerates/ for more glitch-free samplerates */
/* 0x4000100 = 0xFFFF, 0x4000102 = 0x0083 */
#define PIMP_GBA_SAMPLERATE (18157.16)
/* #define PIMP_SAMPLERATE (31536.12) */
/* check the sample-rate calculator at http://www.pineight.com/gba/samplerates/ for more glitch-free periods */
#if 0
#define PIMP_GBA_PERIOD (532) /* 31536.12 */
#define PIMP_GBA_PERIOD (627) /* 26757.92 */
#define PIMP_GBA_PERIOD (798) /* 21024.08 */
#define PIMP_GBA_PERIOD (836) /* 20068.44 */
#endif
#define PIMP_GBA_PERIOD (924)
/* 18157.16 */
#if 0
#define PIMP_GBA_PERIOD (1254) /* 13378.96 */
#define PIMP_GBA_PERIOD (1463) /* 11467.68 */
#define PIMP_GBA_PERIOD (1596) /* 10512.04 */
#endif
/* enable / disable assert */
/* #define DEBUG_PRINT_ENABLE */
...
...
src/pimp_gba.c
View file @
3b6d55eb
...
...
@@ -58,21 +58,21 @@ static struct pimp_mixer pimp_gba_mixer IWRAM_DATA;
static
struct
pimp_mod_context
pimp_gba_ctx
EWRAM_DATA
;
/* setup some constants */
static
const
float
samplerate
=
(
float
)(
1
<<
24
)
/
PIMP_GBA_PERIOD
;
#define CYCLES_PR_FRAME 280896
#define CYCLES_PR_SAMPLE ((int)((1 << 24) / ((float)PIMP_GBA_SAMPLERATE)))
#define SOUND_BUFFER_SIZE ((int)((float)CYCLES_PR_FRAME / CYCLES_PR_SAMPLE))
#define SOUND_BUFFER_SIZE (CYCLES_PR_FRAME / PIMP_GBA_PERIOD)
/* mix and playback-buffers */
static
s8
pimp_gba_sound_buffers
[
2
][
SOUND_BUFFER_SIZE
]
IWRAM_DATA
;
static
s8
pimp_gba_sound_buffers
[
2
][
SOUND_BUFFER_SIZE
];
static
u32
pimp_gba_sound_buffer_index
=
0
;
static
s32
pimp_gba_mix_buffer
[
SOUND_BUFFER_SIZE
]
IWRAM_DATA
;
static
s32
pimp_gba_mix_buffer
[
SOUND_BUFFER_SIZE
];
void
pimp_gba_init
(
const
struct
pimp_module
*
module
,
const
void
*
sample_bank
)
{
u32
zero
=
0
;
pimp_gba_mixer
.
mix_buffer
=
pimp_gba_mix_buffer
;
pimp_mod_context_init
(
&
pimp_gba_ctx
,
(
const
pimp_module
*
)
module
,
(
const
u8
*
)
sample_bank
,
&
pimp_gba_mixer
,
PIMP_GBA_SAMPLERATE
);
pimp_mod_context_init
(
&
pimp_gba_ctx
,
(
const
pimp_module
*
)
module
,
(
const
u8
*
)
sample_bank
,
&
pimp_gba_mixer
,
samplerate
);
/* call BIOS-function CpuFastSet() to clear buffer */
CpuFastSet
(
&
zero
,
&
pimp_gba_sound_buffers
[
0
][
0
],
DMA_SRC_FIXED
|
((
SOUND_BUFFER_SIZE
/
4
)
*
2
));
REG_SOUNDCNT_H
=
SNDA_VOL_100
|
SNDA_L_ENABLE
|
SNDA_R_ENABLE
|
SNDA_RESET_FIFO
;
...
...
@@ -81,7 +81,7 @@ void pimp_gba_init(const struct pimp_module *module, const void *sample_bank)
DEBUG_PRINT
(
DEBUG_LEVEL_INFO
,
(
"samples pr frame: 0x%x
\n
sound buffer size: %d
\n
"
,
SAMPLES_PR_FRAME
,
SOUND_BUFFER_SIZE
));
/* setup timer */
REG_TM0CNT_L
=
(
1
<<
16
)
-
CYCLES_PR_SAMPLE
;
REG_TM0CNT_L
=
(
1
<<
16
)
-
PIMP_GBA_PERIOD
;
REG_TM0CNT_H
=
TIMER_START
;
}
...
...
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