Commit 6ea399c1 authored by Erik Faye-Lund's avatar Erik Faye-Lund
Browse files

fixed envelopes with sustain, added eastwing.xm, and added a dos-script to...

fixed envelopes with sustain, added eastwing.xm, and added a dos-script to rebuild the gbfs-stuff. the dos-build process needs a cleanup.

git-svn-id: https://pimpmobile.svn.sourceforge.net/svnroot/pimpmobile/trunk@116 3d5ecaf0-f903-0410-b953-c2c1a4d75763
parent 8d7fef0e
......@@ -32,11 +32,12 @@ OBJS = \
libgbfs.o
MODULES = \
eye.mod \
rhino.mod \
melkedemo2.mod \
hypermmx.xm \
../testbench/env_sustain.xm
# eye.mod \
# rhino.mod \
# melkedemo2.mod \
# hypermmx.xm \
# eastwing.xm \
BIN_MODULES = $(MODULES:=.bin)
......
converter eye.mod
gbfs data.gbfs sample_bank.bin eye.mod.bin
copy /B example.bin+data.gbfs example.gba
\ No newline at end of file
......@@ -4,11 +4,11 @@
#define CYCLES_PR_FRAME 280896
/* 32 is the maximum amount of channels in fasttracker2. a nice default. */
#define CHANNELS 8
#define CHANNELS 16
/* check the sample-rate calculator at http://www.pineight.com/gba/samplerates/ for more glitch-free samplerates */
/* 0x4000100 = 0xFFFF, 0x4000102 = 0x0083 */
#define SAMPLERATE (18157.16)
#define SAMPLERATE (18157.16 * 2)
/* only 130 bytes big, quite damn pleasing results */
#define AMIGA_DELTA_LUT_LOG_SIZE 7
......
......@@ -3,6 +3,22 @@
#include <stdio.h>
#if 0
int __pimp_envelope_find_node(const pimp_envelope *env, int tick)
{
ASSERT(NULL != env);
for (int i = 1; i < env->node_count - 1; ++i)
{
if (env->node_tick[i] <= tick)
{
return i - 1;
}
}
return 0;
}
#endif
#if 0
unsigned eval_vol_env(pimp_channel_state &chan)
{
......@@ -62,10 +78,11 @@ int __pimp_envelope_sample(pimp_envelope_state *state)
{
ASSERT(NULL != state);
// the magnitude of the envelope at tick N:
// first, find the last node at or before tick N - its position is M
// then, the magnitude of the envelope at tick N is given by
// magnitude = node_magnitude[M] + ((node_delta[M] * (N-M)) >> 8)
/* the magnitude of the envelope at tick N:
* first, find the last node at or before tick N - its position is M
* then, the magnitude of the envelope at tick N is given by
* magnitude = node_magnitude[M] + ((node_delta[M] * (N-M)) >> 8)
*/
s32 delta = state->env->node_delta[state->current_node];
u32 internal_tick = state->current_tick - state->env->node_tick[state->current_node];
......@@ -80,20 +97,24 @@ void __pimp_envelope_advance_tick(pimp_envelope_state *state, bool sustain)
{
ASSERT(NULL != state);
// advance a tick (TODO: move to separate function)
/* advance a tick */
state->current_tick++;
iprintf("%d\n", state->current_tick);
if (state->current_node < (state->env->node_count - 1))
/* check for sustain loop */
if ((state->env->flags & (1 << 1)) && (sustain == true))
{
// TODO: sustain
#if 0
if (chan.vol_env->flags & (1 << 1))
if (state->current_tick >= state->env->sustain_loop_end)
{
/* sustain loop */
chan.vol_env_tick = 0; // HACK: just used to make the BP06 demo tune play correctly
state->current_node = state->env->sustain_loop_start;
state->current_tick = state->env->node_tick[state->current_node];
}
else
#endif
}
/* check if we have passed the current node
* we don't need to clamp the envelope-pos to the end, since the last delta is zero
*/
if (state->current_node < (state->env->node_count - 1))
{
if (state->current_tick >= state->env->node_tick[state->current_node + 1])
{
state->current_node++;
......
......@@ -9,6 +9,8 @@ STATIC INLINE void *get_ptr(const unsigned int *offset)
return (char*)offset + *offset;
}
#define KEY_OFF 121
typedef struct
{
/* offset relative to sample-bank */
......
......@@ -17,6 +17,7 @@ typedef struct
// const pimp_envelope *vol_env;
pimp_envelope_state vol_env;
bool sustain;
s32 period;
s32 final_period;
......@@ -31,7 +32,6 @@ typedef struct
u8 effect;
u8 effect_param;
u8 volume_command;
u8 note_off;
// u32 vol_env_tick;
// s8 vol_env_node;
......
This diff is collapsed.
Markdown is supported
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