this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

only two types of noise #1232

nesbox 8dbeba66 b5d5c84b

+10 -9
+2 -6
src/core/sound.c
··· 127 127 data->phase = 1; 128 128 129 129 s32 period = freq2period(reg->freq); 130 - static const s32 Feedback[] = {0x12000, 0xd008, 0x6000, 0x3802, 0x1c80, 0xe08, 0x500, 0x240, 0x110, 0xb8, 0x60, 0x30, 0x14, 0xc, 0x6, 0x3}; 131 - 132 - static_assert(COUNT_OF(Feedback) == 16, "Feedback"); 133 - 134 - s32 fb = Feedback[tic_tool_peek4(reg->waveform.data, 0)]; 130 + s32 fb = *reg->waveform.data ? 0x14 : 0x12000; 135 131 136 132 for (; data->time < end_time; data->time += period) 137 133 { ··· 521 517 const tic_sound_register* reg = &core->state.sound_ringbuf[bufpos].registers[i]; 522 518 tic_sound_register_data* data = registers + i; 523 519 524 - FLAT4(reg->waveform.data) 520 + tic_tool_noise(&reg->waveform) 525 521 ? runNoise(blip, reg, data, EndTime, volume) 526 522 : runEnvelope(blip, reg, data, EndTime, volume); 527 523
+1 -1
src/studio/studio.c
··· 247 247 { 248 248 const tic_sound_register* reg = &tic->ram->registers[channel]; 249 249 250 - s32 val = FLAT4(reg->waveform.data) 250 + s32 val = tic_tool_noise(&reg->waveform) 251 251 ? (rand() & 1) * MAX_VOLUME 252 252 : tic_tool_peek4(reg->waveform.data, ((offset * reg->freq) >> 7) % WAVE_VALUES); 253 253
+5
src/tools.c
··· 200 200 return true; 201 201 } 202 202 203 + bool tic_tool_noise(const tic_waveform* wave) 204 + { 205 + return FLAT4(wave->data) && *wave->data % 0xff == 0; 206 + } 207 + 203 208 void tic_tool_str2buf(const char* str, s32 size, void* buf, bool flip) 204 209 { 205 210 char val[] = "0x00";
+2 -2
src/tools.h
··· 107 107 bool tic_tool_flat4(const void* buffer, s32 size); 108 108 #define FLAT4(BUFFER) (tic_tool_flat4((BUFFER), sizeof (BUFFER))) 109 109 110 + bool tic_tool_noise(const tic_waveform* wave); 110 111 u32 tic_nearest_color(const tic_rgb* palette, const tic_rgb* color, s32 count); 111 - 112 - char* tic_tool_metatag(const char* code, const char* tag, const char* comment); 112 + char* tic_tool_metatag(const char* code, const char* tag, const char* comment);