mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 04:54:27 -04:00
Move su_load_gmdls into the responsibility of the intro to call, anticipating multicore rendering so it is called once before all the cores are spun up.
This commit is contained in:
@ -339,9 +339,6 @@ SECT_TEXT(surender)
|
|||||||
|
|
||||||
EXPORT MANGLE_FUNC(su_render,PTRSIZE) ; Stack: ptr
|
EXPORT MANGLE_FUNC(su_render,PTRSIZE) ; Stack: ptr
|
||||||
render_prologue
|
render_prologue
|
||||||
%ifdef INCLUDE_GMDLS
|
|
||||||
call su_gmdls_load
|
|
||||||
%endif
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
%ifdef INCLUDE_MULTIVOICE_TRACKS
|
%ifdef INCLUDE_MULTIVOICE_TRACKS
|
||||||
push VOICETRACK_BITMASK
|
push VOICETRACK_BITMASK
|
||||||
|
@ -7,21 +7,21 @@ extern _ReadFile@20 ; requires windows
|
|||||||
|
|
||||||
SECT_TEXT(sugmdls)
|
SECT_TEXT(sugmdls)
|
||||||
|
|
||||||
su_gmdls_load:
|
EXPORT MANGLE_FUNC(su_load_gmdls,0)
|
||||||
mov edi, MANGLE_DATA(su_sample_table)
|
mov edx, MANGLE_DATA(su_sample_table)
|
||||||
mov esi, su_gmdls_path1
|
mov ecx, su_gmdls_path1
|
||||||
su_gmdls_pathloop:
|
su_gmdls_pathloop:
|
||||||
push 0 ; OF_READ
|
push 0 ; OF_READ
|
||||||
push edi ; &ofstruct, blatantly reuse the sample table
|
push edx ; &ofstruct, blatantly reuse the sample table
|
||||||
push esi ; path
|
push ecx ; path
|
||||||
call _OpenFile@12 ; eax = OpenFile(path,&ofstruct,OF_READ)
|
call _OpenFile@12 ; eax = OpenFile(path,&ofstruct,OF_READ)
|
||||||
add esi, su_gmdls_path2 - su_gmdls_path1 ; if we ever get to third, then crash
|
add ecx, su_gmdls_path2 - su_gmdls_path1 ; if we ever get to third, then crash
|
||||||
cmp eax, -1 ; eax == INVALID?
|
cmp eax, -1 ; eax == INVALID?
|
||||||
je su_gmdls_pathloop
|
je su_gmdls_pathloop
|
||||||
push 0 ; NULL
|
push 0 ; NULL
|
||||||
push edi ; &bytes_read, reusing sample table again; it does not matter that the first four bytes are trashed
|
push edx ; &bytes_read, reusing sample table again; it does not matter that the first four bytes are trashed
|
||||||
push SAMPLE_TABLE_SIZE ; number of bytes to read
|
push SAMPLE_TABLE_SIZE ; number of bytes to read
|
||||||
push edi ; here we actually pass the sample table to readfile
|
push edx ; here we actually pass the sample table to readfile
|
||||||
push eax ; handle to file
|
push eax ; handle to file
|
||||||
call _ReadFile@20 ; Readfile(handle,&su_sample_table,SAMPLE_TABLE_SIZE,&bytes_read,NULL)
|
call _ReadFile@20 ; Readfile(handle,&su_sample_table,SAMPLE_TABLE_SIZE,&bytes_read,NULL)
|
||||||
ret
|
ret
|
||||||
|
@ -6,24 +6,26 @@ extern OpenFile ; requires windows
|
|||||||
extern ReadFile ; requires windows
|
extern ReadFile ; requires windows
|
||||||
|
|
||||||
SECT_TEXT(sugmdls)
|
SECT_TEXT(sugmdls)
|
||||||
|
|
||||||
|
EXPORT MANGLE_FUNC(su_load_gmdls,0)
|
||||||
; Win64 ABI: RCX, RDX, R8, and R9
|
; Win64 ABI: RCX, RDX, R8, and R9
|
||||||
su_gmdls_load:
|
|
||||||
sub rsp, 40 ; Win64 ABI requires "shadow space" + space for one parameter.
|
sub rsp, 40 ; Win64 ABI requires "shadow space" + space for one parameter.
|
||||||
mov rdi, PTRWORD MANGLE_DATA(su_sample_table)
|
mov rdx, PTRWORD MANGLE_DATA(su_sample_table)
|
||||||
mov rsi, PTRWORD su_gmdls_path1
|
mov rcx, PTRWORD su_gmdls_path1
|
||||||
su_gmdls_pathloop:
|
su_gmdls_pathloop:
|
||||||
xor r8,r8 ; OF_READ
|
xor r8,r8 ; OF_READ
|
||||||
mov rdx, rdi ; &ofstruct, blatantly reuse the sample table
|
push rdx ; &ofstruct, blatantly reuse the sample table
|
||||||
mov rcx, rsi ; path
|
push rcx
|
||||||
call OpenFile ; eax = OpenFile(path,&ofstruct,OF_READ)
|
call OpenFile ; eax = OpenFile(path,&ofstruct,OF_READ)
|
||||||
add rsi, su_gmdls_path2 - su_gmdls_path1 ; if we ever get to third, then crash
|
pop rcx
|
||||||
movsxd rcx,eax
|
add rcx, su_gmdls_path2 - su_gmdls_path1 ; if we ever get to third, then crash
|
||||||
cmp rcx, -1 ; ecx == INVALID?
|
pop rdx
|
||||||
|
cmp eax, -1 ; ecx == INVALID?
|
||||||
je su_gmdls_pathloop
|
je su_gmdls_pathloop
|
||||||
|
movsxd rcx, eax
|
||||||
mov qword [rsp+32],0
|
mov qword [rsp+32],0
|
||||||
mov r9, rdi
|
mov r9, rdx
|
||||||
mov r8d, SAMPLE_TABLE_SIZE ; number of bytes to read
|
mov r8d, SAMPLE_TABLE_SIZE ; number of bytes to read
|
||||||
mov rdx, rdi
|
|
||||||
call ReadFile ; Readfile(handle,&su_sample_table,SAMPLE_TABLE_SIZE,&bytes_read,NULL)
|
call ReadFile ; Readfile(handle,&su_sample_table,SAMPLE_TABLE_SIZE,&bytes_read,NULL)
|
||||||
add rsp, 40 ; shadow space, as required by Win64 ABI
|
add rsp, 40 ; shadow space, as required by Win64 ABI
|
||||||
ret
|
ret
|
||||||
|
@ -93,7 +93,9 @@ regression_test(test_oscillat_gate ENVELOPE)
|
|||||||
regression_test(test_oscillat_stereo ENVELOPE)
|
regression_test(test_oscillat_stereo ENVELOPE)
|
||||||
if(WIN32) # The samples are currently only GMDLs based, and thus require Windows.
|
if(WIN32) # The samples are currently only GMDLs based, and thus require Windows.
|
||||||
regression_test(test_oscillat_sample ENVELOPE)
|
regression_test(test_oscillat_sample ENVELOPE)
|
||||||
|
target_compile_definitions(test_oscillat_sample PUBLIC INCLUDE_GMDLS)
|
||||||
regression_test(test_oscillat_sample_stereo ENVELOPE)
|
regression_test(test_oscillat_sample_stereo ENVELOPE)
|
||||||
|
target_compile_definitions(test_oscillat_sample_stereo PUBLIC INCLUDE_GMDLS)
|
||||||
endif()
|
endif()
|
||||||
regression_test(test_oscillat_unison ENVELOPE)
|
regression_test(test_oscillat_unison ENVELOPE)
|
||||||
regression_test(test_oscillat_unison_stereo ENVELOPE)
|
regression_test(test_oscillat_unison_stereo ENVELOPE)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
%define BPM 100
|
%define BPM 100
|
||||||
%define INCLUDE_GMDLS
|
|
||||||
|
|
||||||
%include "../src/sointu.inc"
|
%include "../src/sointu.inc"
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
%define BPM 100
|
%define BPM 100
|
||||||
%define INCLUDE_GMDLS
|
|
||||||
|
|
||||||
%include "../src/sointu.inc"
|
%include "../src/sointu.inc"
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
#endif
|
#endif
|
||||||
extern void CALLCONV su_render(void *);
|
extern void CALLCONV su_render(void *);
|
||||||
|
|
||||||
|
#ifdef INCLUDE_GMDLS
|
||||||
|
extern void CALLCONV su_load_gmdls(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int su_max_samples;
|
extern int su_max_samples;
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
@ -59,6 +63,10 @@ int main(int argc, char* argv[]) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef INCLUDE_GMDLS
|
||||||
|
su_load_gmdls();
|
||||||
|
#endif
|
||||||
|
|
||||||
su_render(buf);
|
su_render(buf);
|
||||||
|
|
||||||
snprintf(filename, sizeof filename, "%s%s%s", expected_output_folder, test_name, ".raw");
|
snprintf(filename, sizeof filename, "%s%s%s", expected_output_folder, test_name, ".raw");
|
||||||
|
Reference in New Issue
Block a user