Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <PA9.h>
- //#include "all_gfx.h"
- #include <maxmod9.h>
- //#include "soundbank.h"
- //#include "soundbank_bin.h"
- #include <fat.h>
- int main()
- {
- PA_Init();
- PA_InitVBL();
- PA_SetAutoCheckLid(0);
- PA_InitText(0, 1);
- PA_InitText(1, 1);
- fatInitDefault();
- FILE * pFile;
- long lSize;
- char * buffer;
- size_t result;
- //char * results;
- pFile = fopen ("fat:/music/music1.it", "rb");
- if (pFile==NULL) {fputs ("File error",stderr); exit (1);}
- // obtain file size:
- fseek (pFile , 0 , SEEK_END);
- lSize = ftell (pFile);
- rewind (pFile);
- // allocate memory to contain the whole file:
- buffer = (char*) malloc (sizeof(char)*lSize);
- if (buffer == NULL) {fputs ("Memory error",stderr); exit (2);}
- // copy the file into the buffer:
- result = fread (buffer,1,lSize,pFile);
- if (result != lSize) {fputs ("Reading error",stderr); exit (3);}
- /* the whole file is now loaded in the memory buffer. */
- // terminate
- /*fclose (pFile);
- free (buffer);
- return 0;*/
- //results = fread(buffer, 1, lSize, pFile);
- mmInitDefaultMem((mm_addr)buffer);
- mmLoad((mm_word)buffer);
- mmStart( (mm_word)result, MM_PLAY_LOOP );
- while(1)
- {
- PA_WaitForVBL();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment