comment #+ This is the source-release of "Stoerfall Ost", our winning 4kb multimedia presentation that was first shown at Dialogos 2000. If you have any questions concerning the sourcecode drop us a line at freestyle@freestylas.org. Feel free to visit our webpage at http://www.freestylas.org. Copyright (C) 2001 freestyle This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# ;seEnsemble ; ------------------------------ ENSEMBLE SCRIPT MACROS ------------------------------------ module macro typ:REQ ;use module/macro db typ endm connect macro module:REQ, port:REQ ;establish connection to module [module] on modules outport [port] db ((port and ((1 shl (8-SEM_BFS_MODULE))-1)) shl SEM_BFS_MODULE) + (module and SEM_BFM_MODULE) endm connect_const macro float_index:REQ ;establish connection to the dword at position [float_index] in [script_dword] (see seFloatTab.txt) db semConst db float_index endm sampler macro sample:REQ, flags:REQ ;reads/writes from/to sample_buffer [sample] with looping+syncing ;flags: ; SMP_READ enable reading ; SMP_WRITE enable writing ; SMP_LOOP loop sample ; SMP_SYNC wait for sync db semSampler db sample + flags endm ; -------------------------------------------------------------------------------------------- .data? semFramePtrList dd SEM_NUM_MODULE_MAX*SEM_NUM_MACRO_MAX*2 dup (?) ;list of pointers to module_frames ebp_temp dd ? is_macro db ? module_type db ? .data pre_ens LABEL byte ;precalc ensemble include ensembles\precalc.ens main_ens LABEL byte ;realtime ensemble include ensembles\sound.ens .code ensemble2code proc ;JIT_compiler ;INPUT: ; edi - ptr 2 code (output) ; esi - ptr 2 an ensemble/macro terminated by 'db -1' ; ebp - ptr 2 a lot of free mem (data_segment for modules/macros) ; edx - ptr 2 semFramePtrList ; ;SIZE: 283 @@ensemble_loop: mov [ebp_temp],ebp ;SIZE!!! xor eax,eax lodsb ;get module (proto)type mov ecx,eax and al,SEM_BFM_MODULE mov [module_type],al ;module or macro? mov [is_macro],0 cmp al,(((offset seMacroList)-(offset seModuleList))/(sizeof semInfo)) jl @no_m mov [is_macro],1 @no_m: ;if (module_type==sampler) { setup_sampler } cmp al,semSampler jne @@no_sampler pusha lodsb mov [ebp+semSamplerData.smp_info],eax and eax,1111b lea esi,[eax*(sizeof seSampleInfo)+(offset seSampleList)] mov ebx,[esi+seSampleInfo.smp_length] ;get sample_length mov [ebp+semSamplerData.smp_length],ebx mov ebx,[esi+seSampleInfo.smp_data] ;get sample_ptr mov [ebp+semSamplerData.smp_data],ebx popa inc esi @@no_sampler: lea ebx,[eax*(sizeof semInfo)+(offset seModuleList)] ;get module_info movzx ecx,[ebx+semInfo.num_inport] ;get num_inports mov [edx],ebp ;store mem_frame in FramePtrList! mov eax,ebp cmp [module_type],semOut ;if (semOut) get_input_from_macro_frame(); jne @no_out push edx and edx,not ((SEM_BFM_MODULE shl 2) + 11b) ;set module_index to zero -> index for the current macro/ensemble mov eax,[edx] sub eax,SEM_NUM_OUTPORT_MAX*4 pop edx @no_out: ;store opcode to load modules frame_ptr ... mov byte ptr [edi],0BDh ;'mov ebp,imm32' inc edi stosd ;imm32 movzx eax,[ebx+semInfo.num_memblock] ;get number of memory_blocks used by module shl eax,SEM_MEMSIZE_SHIFT ;num_memblock*(1<