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

now the amiga-periods are right

renamed mod-dumps to xxx.[mod|xm|s3m].bin

git-svn-id: https://pimpmobile.svn.sourceforge.net/svnroot/pimpmobile/trunk@62 3d5ecaf0-f903-0410-b953-c2c1a4d75763
parent c7a42737
...@@ -52,8 +52,8 @@ bin/example.gba: lib/libpimpmobile.a ...@@ -52,8 +52,8 @@ bin/example.gba: lib/libpimpmobile.a
clean: clean:
$(RM) bin/* $(OBJS) $(OBJS:.o=.d) lib/libpimpmobile.a *~ src/*~ include/*~ $(RM) bin/* $(OBJS) $(OBJS:.o=.d) lib/libpimpmobile.a *~ src/*~ include/*~
make -C example clean
make -C converter clean make -C converter clean
make -C example clean
run: run:
make -C example run make -C example run
...@@ -64,8 +64,8 @@ debug: ...@@ -64,8 +64,8 @@ debug:
bin/converter: bin/converter:
make -C converter make -C converter
bin/lut_gen: lut_gen.cpp src/config.h bin/lut_gen: lut_gen.cpp src/math.cpp src/config.h
g++ lut_gen.cpp -o bin/lut_gen g++ lut_gen.cpp src/math.cpp -o bin/lut_gen
lib/libpimpmobile.a: $(OBJS) lib/libpimpmobile.a: $(OBJS)
......
...@@ -61,6 +61,7 @@ void convert_sample(sample_header_t *samp) ...@@ -61,6 +61,7 @@ void convert_sample(sample_header_t *samp)
// dither and downsample // dither and downsample
if (samp->format == SAMPLE_UNSIGNED_16BIT || samp->format == SAMPLE_SIGNED_16BIT) if (samp->format == SAMPLE_UNSIGNED_16BIT || samp->format == SAMPLE_SIGNED_16BIT)
{ {
printf("doin' some wack converting\n");
new_sample = int(float(new_sample) + normal_noise() * (2.0 / 3) * (1 << 7)) >> 8; new_sample = int(float(new_sample) + normal_noise() * (2.0 / 3) * (1 << 7)) >> 8;
if (new_sample > 127) new_sample = 127; if (new_sample > 127) new_sample = 127;
if (new_sample < -128) new_sample = -128; if (new_sample < -128) new_sample = -128;
...@@ -172,9 +173,11 @@ int main(int argc, char *argv[]) ...@@ -172,9 +173,11 @@ int main(int argc, char *argv[])
dump_samples(mod); // find any duplicate samples, and merge them dump_samples(mod); // find any duplicate samples, and merge them
// print_patterns(mod); // print_patterns(mod);
#if 0
size_t period_pos = filename.rfind(".") + 1; size_t period_pos = filename.rfind(".") + 1;
filename.replace(period_pos, filename.size() - period_pos, "bin"); filename.replace(period_pos, filename.size() - period_pos, "bin");
#endif
filename.append(".bin");
dump_module(mod, filename.c_str()); dump_module(mod, filename.c_str());
} }
write_sample_dump("sample_bank.bin"); // dump all samples to file write_sample_dump("sample_bank.bin"); // dump all samples to file
......
...@@ -153,7 +153,7 @@ module_t *load_module_mod(FILE *fp) ...@@ -153,7 +153,7 @@ module_t *load_module_mod(FILE *fp)
instr.duplicate_check_action = DCA_CUT; instr.duplicate_check_action = DCA_CUT;
instr.pitch_pan_separation = 0; instr.pitch_pan_separation = 0;
instr.pitch_pan_center = 0; instr.pitch_pan_center = 0;
memset(instr.sample_map, 1, 120); memset(instr.sample_map, 0, 120);
strcpy(samp.name, (const char*)buf); strcpy(samp.name, (const char*)buf);
samp.waveform = NULL; samp.waveform = NULL;
...@@ -218,6 +218,9 @@ module_t *load_module_mod(FILE *fp) ...@@ -218,6 +218,9 @@ module_t *load_module_mod(FILE *fp)
fseek(fp, 128 - mod->order.size(), SEEK_CUR); // discard unused orders fseek(fp, 128 - mod->order.size(), SEEK_CUR); // discard unused orders
fseek(fp, 4, SEEK_CUR); // discard mod-signature fseek(fp, 4, SEEK_CUR); // discard mod-signature
/* load patterns and track the min and max note. this is used to detect if the module has notes outside traditional mod-limits */
int min_note = 99999;
int max_note = -99999;
for (unsigned p = 0; p < mod->patterns.size(); ++p) for (unsigned p = 0; p < mod->patterns.size(); ++p)
{ {
pattern_header_t &pat = mod->patterns[p]; pattern_header_t &pat = mod->patterns[p];
...@@ -234,10 +237,17 @@ module_t *load_module_mod(FILE *fp) ...@@ -234,10 +237,17 @@ module_t *load_module_mod(FILE *fp)
pe.note = return_nearest_note(((buf[0] & 0x0F) << 8) + buf[1]); // - 12; pe.note = return_nearest_note(((buf[0] & 0x0F) << 8) + buf[1]); // - 12;
pe.effect_byte = buf[2] & 0xF; pe.effect_byte = buf[2] & 0xF;
pe.effect_parameter = buf[3]; pe.effect_parameter = buf[3];
if (pe.note > max_note) max_note = pe.note;
if (pe.note < min_note) min_note = pe.note;
} }
} }
} }
// whops: hardcode xm-range.
mod->period_low_clamp = 1;
mod->period_high_clamp = 32767;
for (unsigned i = 0; i < 31; ++i) for (unsigned i = 0; i < 31; ++i)
{ {
instrument_t &instr = mod->instruments[i]; instrument_t &instr = mod->instruments[i];
......
...@@ -320,7 +320,7 @@ void dump_module(module_t *mod, const char *filename) ...@@ -320,7 +320,7 @@ void dump_module(module_t *mod, const char *filename)
for (int i = 0; i < mod->instruments.size(); ++i) for (int i = 0; i < mod->instruments.size(); ++i)
{ {
instrument_t &instr = mod->instruments[i]; instrument_t &instr = mod->instruments[i];
printf("instrument: %s\n", instr.name); // printf("instrument: %s\n", instr.name);
align(4); align(4);
if (&instr.samples[0] != 0) pointer_map.insert(make_pair(&instr.samples[0], pos)); if (&instr.samples[0] != 0) pointer_map.insert(make_pair(&instr.samples[0], pos));
......
...@@ -32,7 +32,11 @@ OBJS = \ ...@@ -32,7 +32,11 @@ OBJS = \
data.o data.o
MODULES = \ MODULES = \
eye.mod rhino.mod \
melkedemo2.mod
# eye.mod
BIN_MODULES = $(MODULES:=.bin)
TARGET = ../bin/example.gba TARGET = ../bin/example.gba
CONVERTER = ../bin/converter CONVERTER = ../bin/converter
...@@ -52,7 +56,7 @@ endif ...@@ -52,7 +56,7 @@ endif
all: $(TARGET) all: $(TARGET)
clean: clean:
$(RM) $(TARGET) $(TARGET:.gba=.elf) $(OBJS) $(OBJS:.o=.d) $(MODULES:.mod=.bin) *~ $(RM) $(TARGET) $(TARGET:.gba=.elf) $(OBJS) $(OBJS:.o=.d) $(BIN_MODULES) *~
run: $(TARGET) run: $(TARGET)
$(GBAEMU) $(TARGET) $(GBAEMU) $(TARGET)
...@@ -61,17 +65,17 @@ debug: $(TARGET:.gba=.elf) ...@@ -61,17 +65,17 @@ debug: $(TARGET:.gba=.elf)
$(DEVKITPRO)/insight/bin/arm-elf-insight.exe & $(DEVKITPRO)/insight/bin/arm-elf-insight.exe &
$(DEVKITPRO)/vba/VisualBoyAdvance-SDL.exe -Gtcp:55555 example.elf $(DEVKITPRO)/vba/VisualBoyAdvance-SDL.exe -Gtcp:55555 example.elf
data.o: sample_bank.bin melkedemo2.bin
$(CONVERTER):: $(CONVERTER)::
make -C ../converter make -C ../converter
$(PIMPMOBILE)/lib/libpimpmobile.a:: $(PIMPMOBILE)/lib/libpimpmobile.a::
make -C .. lib/libpimpmobile.a make -C .. lib/libpimpmobile.a
data.o: sample_bank.bin eye.bin
$(TARGET:.gba=.elf): $(OBJS) $(PIMPMOBILE)/lib/libpimpmobile.a $(TARGET:.gba=.elf): $(OBJS) $(PIMPMOBILE)/lib/libpimpmobile.a
$(MODULES:.mod=.bin) sample_bank.bin : $(MODULES) $(CONVERTER) $(BIN_MODULES) sample_bank.bin : $(MODULES) $(CONVERTER)
$(CONVERTER) $(MODULES) $(CONVERTER) $(MODULES)
%.elf: %.elf:
......
...@@ -11,4 +11,4 @@ datafile sample_bank, sample_bank.bin ...@@ -11,4 +11,4 @@ datafile sample_bank, sample_bank.bin
.global sample_bank_end .global sample_bank_end
sample_bank_end: sample_bank_end:
datafile module, eye.bin datafile module, rhino.bin
No preview for this file type
No preview for this file type
...@@ -14,6 +14,14 @@ ...@@ -14,6 +14,14 @@
#include "src/config.h" // get the current config #include "src/config.h" // get the current config
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;
#include "src/math.h"
void error(const char *reason) void error(const char *reason)
{ {
fprintf(stderr, "error %s\n", reason); fprintf(stderr, "error %s\n", reason);
...@@ -57,6 +65,21 @@ void print_lut(FILE *fp, T *lut, size_t size) ...@@ -57,6 +65,21 @@ void print_lut(FILE *fp, T *lut, size_t size)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
for (unsigned o = 0; o < 1; ++o)
{
for (unsigned n = 0; n < 2; ++n)
{
for (int fine_tune = -8; fine_tune < 8; ++fine_tune)
{
printf("%d, ", get_amiga_period(n + o * 12, fine_tune) / 4);
// printf("%f\n", delta1);
}
}
printf("\n");
}
return 0;
/* todo: use some flags and stuff to decide what to dump and to what filename */ /* todo: use some flags and stuff to decide what to dump and to what filename */
if (1) if (1)
{ {
......
...@@ -2,7 +2,7 @@ const u16 amiga_period_lut[] = ...@@ -2,7 +2,7 @@ const u16 amiga_period_lut[] =
{ {
// this is for negative fine-tunes... // this is for negative fine-tunes...
907,900,894,887,881,875,868,862, // B-0 907,900,894,887,881,875,868,862, // B-0
856,850,844,838,832,826,820,814, // C-1 856,850,844,838,832,826,820,814, // C-1
808,802,796,791,785,779,774,768, // C#1 808,802,796,791,785,779,774,768, // C#1
762,757,752,746,741,736,730,725, // D-1 762,757,752,746,741,736,730,725, // D-1
...@@ -40,8 +40,8 @@ const u16 amiga_period_lut[] = ...@@ -40,8 +40,8 @@ const u16 amiga_period_lut[] =
135,134,133,132,131,130,129,128, // G#3 135,134,133,132,131,130,129,128, // G#3
127,126,125,125,124,123,122,121, // A-3 127,126,125,125,124,123,122,121, // A-3
120,119,118,118,117,116,115,114, // A#3 120,119,118,118,117,116,115,114, // A#3
113,113,112,111,110,109,109,108, // B-3 // 113,113,112,111,110,109,109,108, // B-3
// this is for positive fine-tunes // this is for positive fine-tunes
107,106,105,104,104,103,102,102, // C-4 // 107,106,105,104,104,103,102,102, // C-4
}; };
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#define CHANNELS 32 #define CHANNELS 32
/* 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 */
#define SAMPLERATE 18157 #define SAMPLERATE (18157)
/* only 130 bytes big, quite damn pleasing results */ /* only 130 bytes big, quite damn pleasing results */
#define AMIGA_DELTA_LUT_LOG_SIZE 7 #define AMIGA_DELTA_LUT_LOG_SIZE 7
......
...@@ -43,6 +43,7 @@ typedef struct ...@@ -43,6 +43,7 @@ typedef struct
s32 period; s32 period;
s32 final_period; /* signed so we can check for underfow */ s32 final_period; /* signed so we can check for underfow */
s32 porta_speed; s32 porta_speed;
s32 porta_target;
u8 note; u8 note;
u8 effect; u8 effect;
...@@ -51,14 +52,28 @@ typedef struct ...@@ -51,14 +52,28 @@ typedef struct
typedef enum typedef enum
{ {
EFF_NONE = 0x00, EFF_NONE = 0x00,
EFF_PORTA_UP = 0x01, EFF_PORTA_UP = 0x01,
EFF_PORTA_DOWN = 0x02, EFF_PORTA_DOWN = 0x02,
EFF_PORTA_NOTE = 0x03, EFF_PORTA_NOTE = 0x03,
EFF_VIBRATO = 0x04, EFF_VIBRATO = 0x04,
EFF_SAMPLE_OFFSET = 0x09,
EFF_VOLUME_SLIDE = 0x0A,
EFF_SET_VOLUME = 0x0C,
EFF_MULTI_FX = 0x0E,
EFF_TEMPO = 0x0F,
/* todo: fill in the rest */ /* todo: fill in the rest */
} pimp_effect_t; } pimp_effect_t;
typedef enum
{
EFF_FINE_VOLUME_SLIDE_UP = 0xA,
EFF_FINE_VOLUME_SLIDE_DOWN = 0xB,
EFF_NOTE_DELAY = 0xD,
/* todo: fill in the rest */
} pimp_multi_effect_t;
/* packed, because it's all bytes. no member-alignment or anything needed */ /* packed, because it's all bytes. no member-alignment or anything needed */
typedef struct __attribute__((packed)) typedef struct __attribute__((packed))
{ {
......
#include <gba_base.h> // #include <gba_base.h>
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;
#include "math.h" #include "math.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
...@@ -57,27 +64,36 @@ unsigned get_linear_delta(unsigned period) ...@@ -57,27 +64,36 @@ unsigned get_linear_delta(unsigned period)
#include "amiga_period_lut.h" #include "amiga_period_lut.h"
unsigned get_amiga_period(int note, int fine_tune) unsigned get_amiga_period(int note, int fine_tune)
{ {
fine_tune /= 8; // todo: interpolate instead?
assert(fine_tune >= -8); assert(fine_tune >= -8);
assert(fine_tune < 8); assert(fine_tune <= 8);
int mod_note = note - (12 * 5); // we extended our note-range with two octaves. (wtf is this 3 octave bias?) /* bias up one octave to prevent from negative values */
int index = mod_note * 8 + fine_tune + 8; unsigned index = 12 * 8 + note * 8 + fine_tune;
// iprintf("%d\n", index);
// index -= 8; /* HUH?! */
if (index < 0) /* */
if (index < (12 * 8 * 5))
{ {
return 0; iprintf("UNDA\n");
unsigned octave = index / (12 * 8);
unsigned octave_index = index % (12 * 8);
return (((u32)amiga_period_lut[octave_index]) * 4) << (5 - octave);
} }
if (index > ARRAY_SIZE(amiga_period_lut)) if (index > ARRAY_SIZE(amiga_period_lut) + 12 * 8 * 5)
{ {
/* hack. */ iprintf("OVA\n");
return amiga_period_lut[ARRAY_SIZE(amiga_period_lut) - 1]; unsigned octave = index / (12 * 8);
unsigned octave_index = index % (12 * 8);
return (((u32)amiga_period_lut[octave_index]) * 4) >> (octave - 5);
} }
// TODO: handle entries outside of the mod-note range // TODO: handle entries outside of the mod-note range
// clamping will be handled on the period later anyway // clamping will be handled on the period later anyway
return amiga_period_lut[index]; return ((u32)amiga_period_lut[index - (12 * 8 * 5)]) * 4;
} }
#include "amiga_delta_lut.h" #include "amiga_delta_lut.h"
...@@ -99,6 +115,7 @@ unsigned get_amiga_delta(unsigned period) ...@@ -99,6 +115,7 @@ unsigned get_amiga_delta(unsigned period)
// BEHOLD: the expression of the devil 2.0 // BEHOLD: the expression of the devil 2.0
// this compiles to one arm-instruction // this compiles to one arm-instruction
delta = ((long long)delta * unsigned(((1.0 / SAMPLERATE) * (1 << 6)) * (1LL << 32)) + (1ULL << 31)) >> 32; delta = ((long long)delta * unsigned(((1.0 / SAMPLERATE) * (1 << 6)) * (1LL << 32)) + (1ULL << 31)) >> 32;
return delta; return delta;
} }
#endif /* NO_AMIGA_PERIODS */ #endif /* NO_AMIGA_PERIODS */
......
...@@ -163,7 +163,8 @@ static inline void mix_channel(channel_t &chan, s32 *target, size_t samples) ...@@ -163,7 +163,8 @@ static inline void mix_channel(channel_t &chan, s32 *target, size_t samples)
samples--; samples--;
event_cursor -= event_delta; event_cursor -= event_delta;
} while (event_cursor > 0); }
while (event_cursor > 0);
assert(samples >= 0); assert(samples >= 0);
...@@ -215,7 +216,7 @@ void mixer::mix(s8 *target, size_t samples) ...@@ -215,7 +216,7 @@ void mixer::mix(s8 *target, size_t samples)
for (u32 c = 0; c < CHANNELS; ++c) for (u32 c = 0; c < CHANNELS; ++c)
{ {
channel_t &chan = (channel_t &)channels[c]; channel_t &chan = (channel_t &)channels[c];
if (0 != chan.sample_data) mix_channel(chan, sound_mix_buffer, samples); if (0 != chan.sample_data && 0 != chan.sample_cursor_delta) mix_channel(chan, sound_mix_buffer, samples);
} }
dc_offs >>= 8; dc_offs >>= 8;
DEBUG_COLOR(0, 31, 0); DEBUG_COLOR(0, 31, 0);
......
...@@ -23,7 +23,7 @@ namespace mixer ...@@ -23,7 +23,7 @@ namespace mixer
const u8 *sample_data; const u8 *sample_data;
u32 sample_cursor; u32 sample_cursor;
s32 sample_cursor_delta; s32 sample_cursor_delta;
u32 volume; s32 volume;
} channel_t; } channel_t;
extern volatile channel_t channels[CHANNELS]; extern volatile channel_t channels[CHANNELS];
......
...@@ -151,7 +151,7 @@ static u32 mix_bresenham(s32 *target, u32 samples, const u8 *sample_data, u32 vo ...@@ -151,7 +151,7 @@ static u32 mix_bresenham(s32 *target, u32 samples, const u8 *sample_data, u32 vo
: "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "sp", "cc" : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "sp", "cc"
); );
return ((sample_data - old_sample_data) << 12) + (sample_cursor >> 20); return ((sample_data - old_sample_data - 1) << 12) + (sample_cursor >> 20);
} }
u32 mixer::mix_samples(s32 *target, u32 samples, const u8 *sample_data, u32 vol, u32 sample_cursor, s32 sample_cursor_delta) u32 mixer::mix_samples(s32 *target, u32 samples, const u8 *sample_data, u32 vol, u32 sample_cursor, s32 sample_cursor_delta)
...@@ -170,6 +170,8 @@ u32 mixer::mix_samples(s32 *target, u32 samples, const u8 *sample_data, u32 vol, ...@@ -170,6 +170,8 @@ u32 mixer::mix_samples(s32 *target, u32 samples, const u8 *sample_data, u32 vol,
if (samples == 0) return sample_cursor; if (samples == 0) return sample_cursor;
// return mix_simple(target, samples, sample_data, vol, sample_cursor, sample_cursor_delta);
/* decide what innerloop to take */ /* decide what innerloop to take */
if (sample_cursor_delta > 0 && sample_cursor_delta < u32((1 << 12) * 0.95)) if (sample_cursor_delta > 0 && sample_cursor_delta < u32((1 << 12) * 0.95))
{ {
......
...@@ -33,15 +33,14 @@ static u32 sound_buffer_index = 0; ...@@ -33,15 +33,14 @@ static u32 sound_buffer_index = 0;
/* should be part of a kind of player-context ? */ /* should be part of a kind of player-context ? */
static pimp_channel_state_t channels[CHANNELS]; static pimp_channel_state_t channels[CHANNELS];
u32 tick_len = (SOUND_BUFFER_SIZE << 8); static u32 tick_len = (SOUND_BUFFER_SIZE << 8);
static u32 curr_tick_len = 0;
u32 curr_tick_len = 0; static u32 curr_row = 0;
u32 curr_row = 0; static u32 curr_order = 0;
u32 curr_order = 0; static u32 curr_bpm = 125;
u32 curr_bpm = 125; static u32 curr_tempo = 5;
u32 curr_tempo = 5; static u32 curr_tick = 0;
u32 curr_tick = 0; static pimp_pattern_t *curr_pattern = 0;
pimp_pattern_t *curr_pattern = 0;
const unsigned char *pimp_sample_bank; const unsigned char *pimp_sample_bank;
const pimp_module_t *mod; const pimp_module_t *mod;
...@@ -99,7 +98,7 @@ void print_pattern_entry(const pimp_pattern_entry_t &pe) ...@@ -99,7 +98,7 @@ void print_pattern_entry(const pimp_pattern_entry_t &pe)
"-#-#--#-#-#-"[n], o); "-#-#--#-#-#-"[n], o);
} }
else iprintf("--- "); else iprintf("--- ");
iprintf("%02X ", pe.instrument); // iprintf("%02X ", pe.instrument);
// iprintf("%02X %02X %X%02X\t", pe.instrument, pe.volume_command, pe.effect_byte, pe.effect_parameter); // iprintf("%02X %02X %X%02X\t", pe.instrument, pe.volume_command, pe.effect_byte, pe.effect_parameter);
} }
...@@ -111,12 +110,12 @@ void print_pattern(const pimp_module_t *mod, pimp_pattern_t *pat) ...@@ -111,12 +110,12 @@ void print_pattern(const pimp_module_t *mod, pimp_pattern_t *pat)
for (unsigned i = 0; i < 5; ++i) for (unsigned i = 0; i < 5; ++i)
{ {
for (unsigned j = 0; j < mod->channel_count; ++j) for (unsigned j = 0; j < 4; ++j)
{ {
pimp_pattern_entry_t &pe = pd[i * mod->channel_count + j]; pimp_pattern_entry_t &pe = pd[i * mod->channel_count + j];
print_pattern_entry(pe); print_pattern_entry(pe);
} }
printf("\n"); iprintf("\n");
} }
} }
...@@ -135,7 +134,7 @@ extern "C" void pimp_init(const void *module, const void *sample_bank) ...@@ -135,7 +134,7 @@ extern "C" void pimp_init(const void *module, const void *sample_bank)
set_bpm(mod->bpm); set_bpm(mod->bpm);
curr_tempo = mod->tempo; curr_tempo = mod->tempo;
#if 0
/* iprintf("\n\nperiod range: %d - %d\n", mod->period_low_clamp, mod->period_high_clamp); /* iprintf("\n\nperiod range: %d - %d\n", mod->period_low_clamp, mod->period_high_clamp);
iprintf("orders: %d\nrepeat position: %d\n", mod->order_count, mod->order_repeat); iprintf("orders: %d\nrepeat position: %d\n", mod->order_count, mod->order_repeat);
iprintf("global volume: %d\ntempo: %d\nbpm: %d\n", mod->volume, mod->tempo, mod->bpm); */ iprintf("global volume: %d\ntempo: %d\nbpm: %d\n", mod->volume, mod->tempo, mod->bpm); */
...@@ -168,7 +167,8 @@ extern "C" void pimp_init(const void *module, const void *sample_bank) ...@@ -168,7 +167,8 @@ extern "C" void pimp_init(const void *module, const void *sample_bank)
iprintf("%d ", instr->sample_count); iprintf("%d ", instr->sample_count);
iprintf("%d\n", instr->sample_map[3]); iprintf("%d\n", instr->sample_map[3]);
} }
#endif
u32 zero = 0; u32 zero = 0;
CpuFastSet(&zero, &sound_buffers[0][0], DMA_SRC_FIXED | ((SOUND_BUFFER_SIZE / 4) * 2)); CpuFastSet(&zero, &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; REG_SOUNDCNT_H = SNDA_VOL_100 | SNDA_L_ENABLE | SNDA_R_ENABLE | SNDA_RESET_FIFO;
...@@ -177,17 +177,6 @@ extern "C" void pimp_init(const void *module, const void *sample_bank) ...@@ -177,17 +177,6 @@ extern "C" void pimp_init(const void *module, const void *sample_bank)
/* setup timer-shit */ /* setup timer-shit */
REG_TM0CNT_L = (1 << 16) - ((1 << 24) / SAMPLERATE); REG_TM0CNT_L = (1 << 16) - ((1 << 24) / SAMPLERATE);
REG_TM0CNT_H = TIMER_START; REG_TM0CNT_H = TIMER_START;
/*
for (u32 c = 0; c < 1; ++c)
{
pimp_channel_state_t &chan = channels[c];
volatile mixer::channel_t &mc = mixer::channels[c];
chan.period = 1000;
chan.effect = EFF_PORTA_UP;
chan.porta_speed = 2;
}
*/
} }