Commit 12ffdf89 authored by Erik Faye-Lund's avatar Erik Faye-Lund
Browse files

ASM06 fixes.

git-svn-id: https://pimpmobile.svn.sourceforge.net/svnroot/pimpmobile/trunk@121 3d5ecaf0-f903-0410-b953-c2c1a4d75763
parent 6c68dd6f
...@@ -43,6 +43,7 @@ void pimp_frame(); /* call once each frame. doesn't need to be called in preciou ...@@ -43,6 +43,7 @@ void pimp_frame(); /* call once each frame. doesn't need to be called in preciou
/* get information about playback */ /* get information about playback */
int pimp_get_row(); int pimp_get_row();
int pimp_get_order(); int pimp_get_order();
void pimp_set_pos(int row, int order);
/* callback system (for music sync) */ /* callback system (for music sync) */
typedef void (*pimp_callback)(int, int); typedef void (*pimp_callback)(int, int);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#define CYCLES_PR_FRAME 280896 #define CYCLES_PR_FRAME 280896
/* 32 is the maximum amount of channels in fasttracker2. a nice default. */ /* 32 is the maximum amount of channels in fasttracker2. a nice default. */
#define CHANNELS 32 #define CHANNELS 8
/* check the sample-rate calculator at http://www.pineight.com/gba/samplerates/ for more glitch-free samplerates */ /* check the sample-rate calculator at http://www.pineight.com/gba/samplerates/ for more glitch-free samplerates */
/* 0x4000100 = 0xFFFF, 0x4000102 = 0x0083 */ /* 0x4000100 = 0xFFFF, 0x4000102 = 0x0083 */
......
...@@ -51,17 +51,17 @@ extern "C" void pimp_set_callback(pimp_callback in_callback) ...@@ -51,17 +51,17 @@ extern "C" void pimp_set_callback(pimp_callback in_callback)
extern "C" void pimp_set_pos(int row, int order) extern "C" void pimp_set_pos(int row, int order)
{ {
// __pimp_module_set_pos(row, order); __pimp_mod_context_set_pos(&__pimp_ctx, row, order);
} }
extern "C" int pimp_get_row() extern "C" int pimp_get_row()
{ {
return __pimp_ctx.curr_row; return __pimp_mod_context_get_row(&__pimp_ctx);
} }
extern "C" int pimp_get_order() extern "C" int pimp_get_order()
{ {
return __pimp_ctx.curr_order; return __pimp_mod_context_get_order(&__pimp_ctx);
} }
extern "C" void pimp_frame() extern "C" void pimp_frame()
......
...@@ -11,9 +11,8 @@ void __pimp_mod_context_init(pimp_mod_context *ctx, const pimp_module *mod, cons ...@@ -11,9 +11,8 @@ void __pimp_mod_context_init(pimp_mod_context *ctx, const pimp_module *mod, cons
/* setup default player-state */ /* setup default player-state */
ctx->tick_len = 0; ctx->tick_len = 0;
ctx->curr_tick_len = 0; ctx->curr_tick_len = 0;
ctx->report_row = ctx->curr_row = 0;
ctx->curr_row = 0; ctx->report_order = ctx->curr_order = 0;
ctx->curr_order = 0;
ctx->curr_pattern = 0; ctx->curr_pattern = 0;
ctx->curr_tick = 0; ctx->curr_tick = 0;
...@@ -40,6 +39,16 @@ void __pimp_mod_context_init(pimp_mod_context *ctx, const pimp_module *mod, cons ...@@ -40,6 +39,16 @@ void __pimp_mod_context_init(pimp_mod_context *ctx, const pimp_module *mod, cons
__pimp_mixer_reset(ctx->mixer); __pimp_mixer_reset(ctx->mixer);
} }
void __pimp_mod_context_set_pos(pimp_mod_context *ctx, int row, int order)
{
ASSERT(ctx != NULL);
ctx->curr_tick = 0;
ctx->curr_row = row;
ctx->curr_order = order;
ctx->curr_pattern = __pimp_module_get_pattern(ctx->mod, __pimp_module_get_order(ctx->mod, ctx->curr_order));
}
void __pimp_mod_context_set_bpm(pimp_mod_context *ctx, int bpm) void __pimp_mod_context_set_bpm(pimp_mod_context *ctx, int bpm)
{ {
ASSERT(ctx != NULL); ASSERT(ctx != NULL);
......
...@@ -40,8 +40,14 @@ typedef struct ...@@ -40,8 +40,14 @@ typedef struct
{ {
u32 tick_len; u32 tick_len;
u32 curr_tick_len; u32 curr_tick_len;
u32 curr_row; u32 curr_row;
u32 curr_order; u32 curr_order;
/* used to delay row / order getters. usefull for demo-synching */
u32 report_row;
u32 report_order;
u32 curr_bpm; u32 curr_bpm;
u32 curr_tempo; u32 curr_tempo;
u32 curr_tick; u32 curr_tick;
...@@ -61,4 +67,25 @@ void __pimp_mod_context_set_pos(pimp_mod_context *ctx, int row, int order); ...@@ -61,4 +67,25 @@ void __pimp_mod_context_set_pos(pimp_mod_context *ctx, int row, int order);
void __pimp_mod_context_set_bpm(pimp_mod_context *ctx, int bpm); void __pimp_mod_context_set_bpm(pimp_mod_context *ctx, int bpm);
void __pimp_mod_context_set_tempo(pimp_mod_context *ctx, int tempo); void __pimp_mod_context_set_tempo(pimp_mod_context *ctx, int tempo);
static inline int __pimp_mod_context_get_row(pimp_mod_context *ctx)
{
return ctx->report_row;
}
static inline int __pimp_mod_context_get_order(pimp_mod_context *ctx)
{
return ctx->report_order;
}
static inline int __pimp_mod_context_get_bpm(pimp_mod_context *ctx)
{
return ctx->curr_bpm;
}
static inline int __pimp_mod_context_get_tempo(pimp_mod_context *ctx)
{
return ctx->curr_tempo;
}
#endif /* PIMP_MOD_CONTEXT_H */ #endif /* PIMP_MOD_CONTEXT_H */
...@@ -75,6 +75,9 @@ STATIC void __pimp_mod_context_update_row(pimp_mod_context *ctx) ...@@ -75,6 +75,9 @@ STATIC void __pimp_mod_context_update_row(pimp_mod_context *ctx)
{ {
ASSERT(ctx != 0); ASSERT(ctx != 0);
ctx->report_row = ctx->curr_row;
ctx->report_order = ctx->curr_order;
for (u32 c = 0; c < ctx->mod->channel_count; ++c) for (u32 c = 0; c < ctx->mod->channel_count; ++c)
{ {
pimp_channel_state *chan = &ctx->channels[c]; pimp_channel_state *chan = &ctx->channels[c];
...@@ -310,9 +313,11 @@ $f0-$ff Tone porta ...@@ -310,9 +313,11 @@ $f0-$ff Tone porta
break; break;
case EFF_BREAK_ROW: case EFF_BREAK_ROW:
ctx->curr_order++; __pimp_mod_context_set_pos(
ctx->curr_row = (chan->effect_param >> 4) * 10 + (chan->effect_param & 0xF) - 1; ctx,
ctx->curr_pattern = __pimp_module_get_pattern(ctx->mod, __pimp_module_get_order(ctx->mod, ctx->curr_order)); (chan->effect_param >> 4) * 10 + (chan->effect_param & 0xF) - 1, // row
ctx->curr_order + 1 // order
);
break; break;
case EFF_MULTI_FX: case EFF_MULTI_FX:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment