no message
This commit is contained in:
parent
694a016334
commit
be7151386d
|
@ -363,8 +363,8 @@ static bool onConsoleLoadSectionCommand(Console* console, const char* param)
|
||||||
case 1: memcpy(&tic->cart.map, &cart->map, sizeof cart->map); break;
|
case 1: memcpy(&tic->cart.map, &cart->map, sizeof cart->map); break;
|
||||||
case 2: memcpy(&tic->cart.cover, &cart->cover, sizeof cart->cover); break;
|
case 2: memcpy(&tic->cart.cover, &cart->cover, sizeof cart->cover); break;
|
||||||
case 3: memcpy(&tic->cart.code, &cart->code, sizeof cart->code); break;
|
case 3: memcpy(&tic->cart.code, &cart->code, sizeof cart->code); break;
|
||||||
case 4: memcpy(&tic->cart.sound.sfx, &cart->sound.sfx, sizeof cart->sound.sfx); break;
|
case 4: memcpy(&tic->cart.sfx, &cart->sfx, sizeof cart->sfx); break;
|
||||||
case 5: memcpy(&tic->cart.sound.music, &cart->sound.music, sizeof cart->sound.music); break;
|
case 5: memcpy(&tic->cart.music, &cart->music, sizeof cart->music); break;
|
||||||
case 6: memcpy(&tic->cart.palette, &cart->palette, sizeof cart->palette); break;
|
case 6: memcpy(&tic->cart.palette, &cart->palette, sizeof cart->palette); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,10 +606,10 @@ static const BinarySection BinarySections[] =
|
||||||
{"TILES", TIC_BANK_SPRITES, offsetof(tic_cartridge, tiles), sizeof(tic_tile), true},
|
{"TILES", TIC_BANK_SPRITES, offsetof(tic_cartridge, tiles), sizeof(tic_tile), true},
|
||||||
{"SPRITES", TIC_BANK_SPRITES, offsetof(tic_cartridge, sprites), sizeof(tic_tile), true},
|
{"SPRITES", TIC_BANK_SPRITES, offsetof(tic_cartridge, sprites), sizeof(tic_tile), true},
|
||||||
{"MAP", TIC_MAP_HEIGHT, offsetof(tic_cartridge, map), TIC_MAP_WIDTH, true},
|
{"MAP", TIC_MAP_HEIGHT, offsetof(tic_cartridge, map), TIC_MAP_WIDTH, true},
|
||||||
{"WAVES", ENVELOPES_COUNT, offsetof(tic_cartridge,sound.sfx.waveform.envelopes), sizeof(tic_waveform), true},
|
{"WAVES", ENVELOPES_COUNT, offsetof(tic_cartridge, sfx.waveform.envelopes), sizeof(tic_waveform), true},
|
||||||
{"SFX", SFX_COUNT, offsetof(tic_cartridge, sound.sfx.data), sizeof(tic_sound_effect), true},
|
{"SFX", SFX_COUNT, offsetof(tic_cartridge, sfx.data), sizeof(tic_sound_effect), true},
|
||||||
{"PATTERNS", MUSIC_PATTERNS, offsetof(tic_cartridge, sound.music.patterns), sizeof(tic_track_pattern), true},
|
{"PATTERNS", MUSIC_PATTERNS, offsetof(tic_cartridge, music.patterns), sizeof(tic_track_pattern), true},
|
||||||
{"TRACKS", MUSIC_TRACKS, offsetof(tic_cartridge, sound.music.tracks), sizeof(tic_track), true},
|
{"TRACKS", MUSIC_TRACKS, offsetof(tic_cartridge, music.tracks), sizeof(tic_track), true},
|
||||||
};
|
};
|
||||||
|
|
||||||
static s32 saveProject(Console* console, void* buffer, const char* comment)
|
static s32 saveProject(Console* console, void* buffer, const char* comment)
|
||||||
|
@ -2141,10 +2141,10 @@ static void onConsoleRamCommand(Console* console, const char* param)
|
||||||
{offsetof(tic_ram, map), "MAP"},
|
{offsetof(tic_ram, map), "MAP"},
|
||||||
{offsetof(tic_ram, persistent), "PERSISTENT MEMORY"},
|
{offsetof(tic_ram, persistent), "PERSISTENT MEMORY"},
|
||||||
{offsetof(tic_ram, registers), "SOUND REGISTERS"},
|
{offsetof(tic_ram, registers), "SOUND REGISTERS"},
|
||||||
{offsetof(tic_ram, sound.sfx.waveform), "WAVEFORMS"},
|
{offsetof(tic_ram, sfx.waveform), "WAVEFORMS"},
|
||||||
{offsetof(tic_ram, sound.sfx.data), "SFX"},
|
{offsetof(tic_ram, sfx.data), "SFX"},
|
||||||
{offsetof(tic_ram, sound.music.patterns.data), "MUSIC PATTERNS"},
|
{offsetof(tic_ram, music.patterns.data), "MUSIC PATTERNS"},
|
||||||
{offsetof(tic_ram, sound.music.tracks.data), "MUSIC TRACKS"},
|
{offsetof(tic_ram, music.tracks.data), "MUSIC TRACKS"},
|
||||||
{offsetof(tic_ram, music_pos), "MUSIC POS"},
|
{offsetof(tic_ram, music_pos), "MUSIC POS"},
|
||||||
{TIC_RAM_SIZE, "..."},
|
{TIC_RAM_SIZE, "..."},
|
||||||
};
|
};
|
||||||
|
|
|
@ -257,7 +257,7 @@ static duk_ret_t duk_sfx(duk_context* duk)
|
||||||
{
|
{
|
||||||
if(index >= 0)
|
if(index >= 0)
|
||||||
{
|
{
|
||||||
tic_sound_effect* effect = memory->ram.sound.sfx.data + index;
|
tic_sound_effect* effect = memory->ram.sfx.data + index;
|
||||||
|
|
||||||
note = effect->note;
|
note = effect->note;
|
||||||
octave = effect->octave;
|
octave = effect->octave;
|
||||||
|
|
|
@ -680,7 +680,7 @@ static s32 lua_sfx(lua_State* lua)
|
||||||
{
|
{
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
tic_sound_effect* effect = memory->ram.sound.sfx.data + index;
|
tic_sound_effect* effect = memory->ram.sfx.data + index;
|
||||||
|
|
||||||
note = effect->note;
|
note = effect->note;
|
||||||
octave = effect->octave;
|
octave = effect->octave;
|
||||||
|
|
|
@ -109,7 +109,12 @@ typedef struct
|
||||||
|
|
||||||
blip_buffer_t* blip;
|
blip_buffer_t* blip;
|
||||||
s32 samplerate;
|
s32 samplerate;
|
||||||
const tic_sound* soundSrc;
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const tic_sfx* sfx;
|
||||||
|
const tic_music* music;
|
||||||
|
} sound;
|
||||||
|
|
||||||
tic_tick_data* data;
|
tic_tick_data* data;
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value,
|
||||||
|
|
||||||
static tic_track* getTrack(Music* music)
|
static tic_track* getTrack(Music* music)
|
||||||
{
|
{
|
||||||
return &music->tic->cart.sound.music.tracks.data[music->track];
|
return &music->tic->cart.music.tracks.data[music->track];
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 getRows(Music* music)
|
static s32 getRows(Music* music)
|
||||||
|
@ -368,7 +368,7 @@ static tic_track_pattern* getPattern(Music* music, s32 channel)
|
||||||
{
|
{
|
||||||
s32 patternId = tic_tool_get_pattern_id(getTrack(music), music->tracker.frame, channel);
|
s32 patternId = tic_tool_get_pattern_id(getTrack(music), music->tracker.frame, channel);
|
||||||
|
|
||||||
return patternId ? &music->tic->cart.sound.music.patterns.data[patternId - PATTERN_START] : NULL;
|
return patternId ? &music->tic->cart.music.patterns.data[patternId - PATTERN_START] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static tic_track_pattern* getChannelPattern(Music* music)
|
static tic_track_pattern* getChannelPattern(Music* music)
|
||||||
|
@ -1643,7 +1643,7 @@ void initMusic(Music* music, tic_mem* tic)
|
||||||
},
|
},
|
||||||
|
|
||||||
.tab = MUSIC_TRACKER_TAB,
|
.tab = MUSIC_TRACKER_TAB,
|
||||||
.history = history_create(&tic->cart.sound.music, sizeof tic->cart.sound.music),
|
.history = history_create(&tic->cart.music, sizeof(tic_music)),
|
||||||
.event = onStudioEvent,
|
.event = onStudioEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi
|
||||||
|
|
||||||
static tic_sound_effect* getEffect(Sfx* sfx)
|
static tic_sound_effect* getEffect(Sfx* sfx)
|
||||||
{
|
{
|
||||||
return sfx->tic->cart.sound.sfx.data + sfx->index;
|
return sfx->tic->cart.sfx.data + sfx->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setIndex(Sfx* sfx, s32 delta)
|
static void setIndex(Sfx* sfx, s32 delta)
|
||||||
|
@ -169,7 +169,7 @@ static void drawLoopPanel(Sfx* sfx, s32 x, s32 y)
|
||||||
|
|
||||||
static tic_waveform* getWaveformById(Sfx* sfx, s32 i)
|
static tic_waveform* getWaveformById(Sfx* sfx, s32 i)
|
||||||
{
|
{
|
||||||
return &sfx->tic->cart.sound.sfx.waveform.envelopes[i];
|
return &sfx->tic->cart.sfx.waveform.envelopes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static tic_waveform* getWaveform(Sfx* sfx)
|
static tic_waveform* getWaveform(Sfx* sfx)
|
||||||
|
@ -1058,8 +1058,8 @@ void initSfx(Sfx* sfx, tic_mem* tic)
|
||||||
.tab = SFX_ENVELOPES_TAB,
|
.tab = SFX_ENVELOPES_TAB,
|
||||||
.history =
|
.history =
|
||||||
{
|
{
|
||||||
.envelope = history_create(&tic->cart.sound.sfx.data, sizeof tic->cart.sound.sfx.data),
|
.envelope = history_create(&tic->cart.sfx.data, sizeof tic->cart.sfx.data),
|
||||||
.waveform = history_create(&tic->cart.sound.sfx.waveform, sizeof tic->cart.sound.sfx.waveform),
|
.waveform = history_create(&tic->cart.sfx.waveform, sizeof tic->cart.sfx.waveform),
|
||||||
},
|
},
|
||||||
.event = onStudioEvent,
|
.event = onStudioEvent,
|
||||||
};
|
};
|
||||||
|
|
16
src/studio.c
16
src/studio.c
|
@ -278,7 +278,7 @@ static struct
|
||||||
|
|
||||||
void playSystemSfx(s32 id)
|
void playSystemSfx(s32 id)
|
||||||
{
|
{
|
||||||
const tic_sound_effect* effect = &studio.tic->config.sound.sfx.data[id];
|
const tic_sound_effect* effect = &studio.tic->config.sfx.data[id];
|
||||||
studio.tic->api.sfx_ex(studio.tic, id, effect->note, effect->octave, -1, 0, MAX_VOLUME, 0);
|
studio.tic->api.sfx_ex(studio.tic, id, effect->note, effect->octave, -1, 0, MAX_VOLUME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2091,24 +2091,28 @@ static void renderStudio()
|
||||||
studio.mouse.state[i].click = false;
|
studio.mouse.state[i].click = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
const tic_sound* src = NULL;
|
const tic_sfx* sfx = NULL;
|
||||||
|
const tic_music* music = NULL;
|
||||||
|
|
||||||
switch(studio.mode)
|
switch(studio.mode)
|
||||||
{
|
{
|
||||||
case TIC_RUN_MODE:
|
case TIC_RUN_MODE:
|
||||||
src = &studio.tic->ram.sound;
|
sfx = &studio.tic->ram.sfx;
|
||||||
|
music = &studio.tic->ram.music;
|
||||||
break;
|
break;
|
||||||
case TIC_START_MODE:
|
case TIC_START_MODE:
|
||||||
case TIC_DIALOG_MODE:
|
case TIC_DIALOG_MODE:
|
||||||
case TIC_MENU_MODE:
|
case TIC_MENU_MODE:
|
||||||
case TIC_SURF_MODE:
|
case TIC_SURF_MODE:
|
||||||
src = &studio.tic->config.sound;
|
sfx = &studio.tic->config.sfx;
|
||||||
|
music = &studio.tic->config.music;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
src = &studio.tic->cart.sound;
|
sfx = &studio.tic->cart.sfx;
|
||||||
|
music = &studio.tic->cart.music;
|
||||||
}
|
}
|
||||||
|
|
||||||
studio.tic->api.tick_start(studio.tic, src);
|
studio.tic->api.tick_start(studio.tic, sfx, music);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(studio.mode)
|
switch(studio.mode)
|
||||||
|
|
39
src/tic.c
39
src/tic.c
|
@ -356,7 +356,7 @@ static void channelSfx(tic_mem* memory, s32 index, s32 note, s32 octave, s32 dur
|
||||||
if(index >= 0)
|
if(index >= 0)
|
||||||
{
|
{
|
||||||
struct {s8 speed:SFX_SPEED_BITS;} temp = {speed};
|
struct {s8 speed:SFX_SPEED_BITS;} temp = {speed};
|
||||||
c->speed = speed == temp.speed ? speed : machine->soundSrc->sfx.data[index].speed;
|
c->speed = speed == temp.speed ? speed : machine->sound.sfx->data[index].speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// start index of idealized piano
|
// start index of idealized piano
|
||||||
|
@ -401,7 +401,7 @@ static void setMusic(tic_machine* machine, s32 index, s32 frame, s32 row, bool l
|
||||||
memory->ram.music_pos.flag.loop = loop;
|
memory->ram.music_pos.flag.loop = loop;
|
||||||
machine->state.music.play = MusicPlay;
|
machine->state.music.play = MusicPlay;
|
||||||
|
|
||||||
const tic_track* track = &machine->soundSrc->music.tracks.data[index];
|
const tic_track* track = &machine->sound.music->tracks.data[index];
|
||||||
machine->state.music.ticks = row >= 0 ? row * (track->speed + DEFAULT_SPEED) * NOTES_PER_MUNUTE / (track->tempo + DEFAULT_TEMPO) / DEFAULT_SPEED : 0;
|
machine->state.music.ticks = row >= 0 ? row * (track->speed + DEFAULT_SPEED) * NOTES_PER_MUNUTE / (track->tempo + DEFAULT_TEMPO) / DEFAULT_SPEED : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1061,7 +1061,7 @@ static void sfx(tic_mem* memory, s32 index, s32 freq, Channel* channel, tic_soun
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tic_sound_effect* effect = &machine->soundSrc->sfx.data[index];
|
const tic_sound_effect* effect = &machine->sound.sfx->data[index];
|
||||||
s32 pos = ++channel->tick;
|
s32 pos = ++channel->tick;
|
||||||
|
|
||||||
s8 speed = channel->speed;
|
s8 speed = channel->speed;
|
||||||
|
@ -1089,7 +1089,7 @@ static void sfx(tic_mem* memory, s32 index, s32 freq, Channel* channel, tic_soun
|
||||||
reg->volume = volume;
|
reg->volume = volume;
|
||||||
|
|
||||||
u8 wave = effect->data[channel->pos.wave].wave;
|
u8 wave = effect->data[channel->pos.wave].wave;
|
||||||
const tic_waveform* waveform = &machine->soundSrc->sfx.waveform.envelopes[wave];
|
const tic_waveform* waveform = &machine->sound.sfx->waveform.envelopes[wave];
|
||||||
memcpy(reg->waveform.data, waveform->data, sizeof(tic_waveform));
|
memcpy(reg->waveform.data, waveform->data, sizeof(tic_waveform));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1100,7 +1100,7 @@ static void processMusic(tic_mem* memory)
|
||||||
|
|
||||||
if(machine->state.music.play == MusicStop) return;
|
if(machine->state.music.play == MusicStop) return;
|
||||||
|
|
||||||
const tic_track* track = &machine->soundSrc->music.tracks.data[memory->ram.music_pos.track];
|
const tic_track* track = &machine->sound.music->tracks.data[memory->ram.music_pos.track];
|
||||||
s32 row = machine->state.music.ticks++ * (track->tempo + DEFAULT_TEMPO) * DEFAULT_SPEED / (track->speed + DEFAULT_SPEED) / NOTES_PER_MUNUTE;
|
s32 row = machine->state.music.ticks++ * (track->tempo + DEFAULT_TEMPO) * DEFAULT_SPEED / (track->speed + DEFAULT_SPEED) / NOTES_PER_MUNUTE;
|
||||||
|
|
||||||
s32 rows = MUSIC_PATTERN_ROWS - track->rows;
|
s32 rows = MUSIC_PATTERN_ROWS - track->rows;
|
||||||
|
@ -1161,7 +1161,7 @@ static void processMusic(tic_mem* memory)
|
||||||
s32 patternId = tic_tool_get_pattern_id(track, memory->ram.music_pos.frame, channel);
|
s32 patternId = tic_tool_get_pattern_id(track, memory->ram.music_pos.frame, channel);
|
||||||
if (!patternId) continue;
|
if (!patternId) continue;
|
||||||
|
|
||||||
const tic_track_pattern* pattern = &machine->soundSrc->music.patterns.data[patternId - PATTERN_START];
|
const tic_track_pattern* pattern = &machine->sound.music->patterns.data[patternId - PATTERN_START];
|
||||||
|
|
||||||
s32 note = pattern->rows[memory->ram.music_pos.row].note;
|
s32 note = pattern->rows[memory->ram.music_pos.row].note;
|
||||||
|
|
||||||
|
@ -1196,11 +1196,12 @@ static bool isNoiseWaveform(const tic_waveform* wave)
|
||||||
return memcmp(&NoiseWave.data, &wave->data, sizeof(tic_waveform)) == 0;
|
return memcmp(&NoiseWave.data, &wave->data, sizeof(tic_waveform)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void api_tick_start(tic_mem* memory, const tic_sound* src)
|
static void api_tick_start(tic_mem* memory, const tic_sfx* sfxsrc, const tic_music* music)
|
||||||
{
|
{
|
||||||
tic_machine* machine = (tic_machine*)memory;
|
tic_machine* machine = (tic_machine*)memory;
|
||||||
|
|
||||||
machine->soundSrc = src;
|
machine->sound.sfx = sfxsrc;
|
||||||
|
machine->sound.music = music;
|
||||||
|
|
||||||
for (s32 i = 0; i < TIC_SOUND_CHANNELS; ++i )
|
for (s32 i = 0; i < TIC_SOUND_CHANNELS; ++i )
|
||||||
memset(&memory->ram.registers[i], 0, sizeof(tic_sound_register));
|
memset(&memory->ram.registers[i], 0, sizeof(tic_sound_register));
|
||||||
|
@ -1328,7 +1329,8 @@ static void cart2ram(tic_mem* memory)
|
||||||
memcpy(&memory->ram.sprites, &memory->cart.sprites, sizeof(tic_tiles));
|
memcpy(&memory->ram.sprites, &memory->cart.sprites, sizeof(tic_tiles));
|
||||||
memcpy(&memory->ram.map, &memory->cart.map, sizeof(tic_tiles));
|
memcpy(&memory->ram.map, &memory->cart.map, sizeof(tic_tiles));
|
||||||
|
|
||||||
memcpy(&memory->ram.sound, &memory->cart.sound, sizeof memory->ram.sound);
|
memcpy(&memory->ram.sfx, &memory->cart.sfx, sizeof(tic_sfx));
|
||||||
|
memcpy(&memory->ram.music, &memory->cart.music, sizeof(tic_music));
|
||||||
|
|
||||||
initCover(memory);
|
initCover(memory);
|
||||||
}
|
}
|
||||||
|
@ -1597,10 +1599,10 @@ static void api_load(tic_cartridge* cart, const u8* buffer, s32 size, bool palet
|
||||||
case CHUNK_SPRITES: LOAD_CHUNK(cart->sprites); break;
|
case CHUNK_SPRITES: LOAD_CHUNK(cart->sprites); break;
|
||||||
case CHUNK_MAP: LOAD_CHUNK(cart->map); break;
|
case CHUNK_MAP: LOAD_CHUNK(cart->map); break;
|
||||||
case CHUNK_CODE: LOAD_CHUNK(cart->code); break;
|
case CHUNK_CODE: LOAD_CHUNK(cart->code); break;
|
||||||
case CHUNK_SOUND: LOAD_CHUNK(cart->sound.sfx.data); break;
|
case CHUNK_SOUND: LOAD_CHUNK(cart->sfx.data); break;
|
||||||
case CHUNK_WAVEFORM: LOAD_CHUNK(cart->sound.sfx.waveform); break;
|
case CHUNK_WAVEFORM: LOAD_CHUNK(cart->sfx.waveform); break;
|
||||||
case CHUNK_MUSIC: LOAD_CHUNK(cart->sound.music.tracks.data); break;
|
case CHUNK_MUSIC: LOAD_CHUNK(cart->music.tracks.data); break;
|
||||||
case CHUNK_PATTERNS: LOAD_CHUNK(cart->sound.music.patterns.data); break;
|
case CHUNK_PATTERNS: LOAD_CHUNK(cart->music.patterns.data); break;
|
||||||
case CHUNK_PALETTE:
|
case CHUNK_PALETTE:
|
||||||
if(palette)
|
if(palette)
|
||||||
LOAD_CHUNK(cart->palette);
|
LOAD_CHUNK(cart->palette);
|
||||||
|
@ -1666,10 +1668,10 @@ static s32 api_save(const tic_cartridge* cart, u8* buffer)
|
||||||
buffer = SAVE_CHUNK(CHUNK_SPRITES, cart->sprites);
|
buffer = SAVE_CHUNK(CHUNK_SPRITES, cart->sprites);
|
||||||
buffer = SAVE_CHUNK(CHUNK_MAP, cart->map);
|
buffer = SAVE_CHUNK(CHUNK_MAP, cart->map);
|
||||||
buffer = SAVE_CHUNK(CHUNK_CODE, cart->code);
|
buffer = SAVE_CHUNK(CHUNK_CODE, cart->code);
|
||||||
buffer = SAVE_CHUNK(CHUNK_SOUND, cart->sound.sfx.data);
|
buffer = SAVE_CHUNK(CHUNK_SOUND, cart->sfx.data);
|
||||||
buffer = SAVE_CHUNK(CHUNK_WAVEFORM, cart->sound.sfx.waveform);
|
buffer = SAVE_CHUNK(CHUNK_WAVEFORM, cart->sfx.waveform);
|
||||||
buffer = SAVE_CHUNK(CHUNK_PATTERNS, cart->sound.music.patterns.data);
|
buffer = SAVE_CHUNK(CHUNK_PATTERNS, cart->music.patterns.data);
|
||||||
buffer = SAVE_CHUNK(CHUNK_MUSIC, cart->sound.music.tracks.data);
|
buffer = SAVE_CHUNK(CHUNK_MUSIC, cart->music.tracks.data);
|
||||||
buffer = SAVE_CHUNK(CHUNK_PALETTE, cart->palette);
|
buffer = SAVE_CHUNK(CHUNK_PALETTE, cart->palette);
|
||||||
|
|
||||||
buffer = saveFixedChunk(buffer, CHUNK_COVER, cart->cover.data, cart->cover.size);
|
buffer = saveFixedChunk(buffer, CHUNK_COVER, cart->cover.data, cart->cover.size);
|
||||||
|
@ -1813,7 +1815,8 @@ tic_mem* tic_create(s32 samplerate)
|
||||||
if(machine != (tic_machine*)&machine->memory)
|
if(machine != (tic_machine*)&machine->memory)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
machine->soundSrc = &machine->memory.ram.sound;
|
machine->sound.sfx = &machine->memory.ram.sfx;
|
||||||
|
machine->sound.music = &machine->memory.ram.music;
|
||||||
|
|
||||||
initApi(&machine->memory.api);
|
initApi(&machine->memory.api);
|
||||||
|
|
||||||
|
|
16
src/tic.h
16
src/tic.h
|
@ -321,11 +321,11 @@ typedef union
|
||||||
u8 data[TIC_PALETTE_SIZE * sizeof(tic_rgb)];
|
u8 data[TIC_PALETTE_SIZE * sizeof(tic_rgb)];
|
||||||
} tic_palette;
|
} tic_palette;
|
||||||
|
|
||||||
typedef struct
|
// typedef struct
|
||||||
{
|
// {
|
||||||
tic_sfx sfx;
|
// tic_sfx sfx;
|
||||||
tic_music music;
|
// tic_music music;
|
||||||
} tic_sound;
|
// } tic_sound;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -350,7 +350,8 @@ typedef struct
|
||||||
tic_tiles tiles;
|
tic_tiles tiles;
|
||||||
tic_tiles sprites;
|
tic_tiles sprites;
|
||||||
tic_map map;
|
tic_map map;
|
||||||
tic_sound sound;
|
tic_sfx sfx;
|
||||||
|
tic_music music;
|
||||||
};
|
};
|
||||||
|
|
||||||
tic_bank banks[TIC_BANKS];
|
tic_bank banks[TIC_BANKS];
|
||||||
|
@ -430,7 +431,8 @@ typedef union
|
||||||
tic_map map;
|
tic_map map;
|
||||||
tic_persistent persistent;
|
tic_persistent persistent;
|
||||||
tic_sound_register registers[TIC_SOUND_CHANNELS];
|
tic_sound_register registers[TIC_SOUND_CHANNELS];
|
||||||
tic_sound sound;
|
tic_sfx sfx;
|
||||||
|
tic_music music;
|
||||||
tic_music_pos music_pos;
|
tic_music_pos music_pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ TIC80_API void tic80_tick(tic80* tic, tic80_input input)
|
||||||
|
|
||||||
tic80->memory->ram.vram.input.gamepad.data = input.data;
|
tic80->memory->ram.vram.input.gamepad.data = input.data;
|
||||||
|
|
||||||
tic80->memory->api.tick_start(tic80->memory, &tic80->memory->ram.sound);
|
tic80->memory->api.tick_start(tic80->memory, &tic80->memory->ram.sfx, &tic80->memory->ram.music);
|
||||||
tic80->memory->api.tick(tic80->memory, &tic80->tickData);
|
tic80->memory->api.tick(tic80->memory, &tic80->tickData);
|
||||||
tic80->memory->api.tick_end(tic80->memory);
|
tic80->memory->api.tick_end(tic80->memory);
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ typedef struct
|
||||||
void (*load) (tic_cartridge* rom, const u8* buffer, s32 size, bool palette);
|
void (*load) (tic_cartridge* rom, const u8* buffer, s32 size, bool palette);
|
||||||
s32 (*save) (const tic_cartridge* rom, u8* buffer);
|
s32 (*save) (const tic_cartridge* rom, u8* buffer);
|
||||||
|
|
||||||
void (*tick_start) (tic_mem* memory, const tic_sound* src);
|
void (*tick_start) (tic_mem* memory, const tic_sfx* sfx, const tic_music* music);
|
||||||
void (*tick_end) (tic_mem* memory);
|
void (*tick_end) (tic_mem* memory);
|
||||||
void (*blit) (tic_mem* tic, tic_scanline scanline, tic_overlap overlap, void* data);
|
void (*blit) (tic_mem* tic, tic_scanline scanline, tic_overlap overlap, void* data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue