Path: chuka.playstation.co.uk!news From: "Nick Slaven" Newsgroups: scee.yaroze.beginners Subject: Re: Found the problem, but need more help!!!! Date: Mon, 8 Feb 1999 20:34:50 -0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 84 Message-ID: <79ni2o$1do3@chuka.playstation.co.uk> References: <36BDFC53.2014A8AC@yahoo.com> <36BF458A.4D0F9814@yahoo.com> NNTP-Posting-Host: mfs-pci-bqk-vty203.as.wcom.net X-Newsreader: Microsoft Outlook Express 4.72.3155.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Ed Fear wrote in message <36BF458A.4D0F9814@yahoo.com>... >I am following the Sound For Dummies tutorial, and to play midi I have to >load a file called std0.vb (I do also have to load a .vh file, but it's only >small...). Unfortunatley, it is 300kb... can anyone suggest a way of >making it smaller or using another method? Please respond in 'plain >English' - I'm just a lowly beginner! > >I can't see that they expect you to give up 300kb for a file that you need. > >To make a soundfile, you have to split it up into a .vb and .vh file. Can I >get a very small sound file and use these as the .vb and .vh file? > Have you considered the fact that the VB portion of your data does not need to be retained in main memory once you have transferred it to sound RAM? My solution to this problem is to load the std0.vb into the memory space that will be occupied by the heap before I initialise the heap. BTW the stdo.vb file is stored on your Yaroze boot disc so you can load it from there inside your code. You need to do something along the lines of main() { LoadSounds(); MakeHeap(); // now use malloc to create areas for the ordered table etc rather than // statically defining them in your code & you will reclaim the area used by // std0.vb when loaded from CD } void MakeHeap(void) { // heap initialisation stuff // heap starts after the main program on a 16-byte boundary unsigned long lclHeapStart=(_end & 0xFFFFFFF0L)+0x10; // heap extends to the bottom of the stack. unsigned long lclHeapSize=((_stack_addr-(_stack_size<<10)) & 0xFFFFFFF0L)-lclHeapStart; InitHeap((unsigned long *)lclHeapStart, lclHeapSize); } // loads sound from cd & sets up vabs etc // NOTE : This is called before InitHeap void LoadSounds(void) { unsigned long LBuff=(_end & 0xFFFFFFF0L)+0x10; // program end // LBuff will now be pointing to the 1st word boundary after your program in memory GetFile("\\data\\sound\\STD0.VB",(ulong*)LBuff); GetFile("\\data\\sound\\STD0.VH",(ulong*)ST_VH); MusicVabID=SsVabTransfer((u_char*)ST_VH,(u_char*)LBuff,-1,1); // the VB file has now been transferred to sound RAM & therefore you can now // initialise the heap over the area it was loaded into } void GetFile(char * File,ulong*LBuff) { unsigned char Result; CdReadFile(File,LBuff,0); CdReadSync(0,&Result); } You can also do something similar with your tim files once they have been loaded into video RAM. Hope this helps Cheers Nick S