Need help on looping XA audio tracks
-
LameGuy64 Verified
- Psy-Q Enthusiast
- Posts: 388
- Joined: Apr 10, 2013
- I am a: Hobbyist Game Developer
- Motto: Commercial or not, play it!
- PlayStation Model: H2000/7000
- Location: Philippines
- Contact:
Need help on looping XA audio tracks
Man its been quite a while since I've last posted something here. Anyway, I'm currently working on a PlayStation game project (which I won't explain in detail yet as I want to surprise everyone once CodeBlast '14 starts ) which uses XA audio tracks for music.
I got the game to play the XA tracks properly but the problem is, I don't know of a good way to loop such tracks. Sure you can make a predefined array containing the length of each XA audio channel but that method sounds extremely cumbersome to me. I think this can be done nicely by checking for the 'End of Record' bit inside the subheader structure in each XA audio sector being played but I don't know of a way to extract the subheader during playback.
Any help will be gladly appreciated!
I got the game to play the XA tracks properly but the problem is, I don't know of a good way to loop such tracks. Sure you can make a predefined array containing the length of each XA audio channel but that method sounds extremely cumbersome to me. I think this can be done nicely by checking for the 'End of Record' bit inside the subheader structure in each XA audio sector being played but I don't know of a way to extract the subheader during playback.
Any help will be gladly appreciated!
Please don't forget to include my name if you share my work around. Credit where it is due.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
-
LameGuy64 Verified
- Psy-Q Enthusiast
- Posts: 388
- Joined: Apr 10, 2013
- I am a: Hobbyist Game Developer
- Motto: Commercial or not, play it!
- PlayStation Model: H2000/7000
- Location: Philippines
- Contact:
That seems to be helpful enough... Thanks t0rxe!
Please don't forget to include my name if you share my work around. Credit where it is due.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
-
LameGuy64 Verified
- Psy-Q Enthusiast
- Posts: 388
- Joined: Apr 10, 2013
- I am a: Hobbyist Game Developer
- Motto: Commercial or not, play it!
- PlayStation Model: H2000/7000
- Location: Philippines
- Contact:
I now got a new problem, these lines inside my callback function:
Gives me an Address Error (Command Fetch or Data Load) message when executed.
Code: Select all
XAID = *(unsigned short *)(CdBuffer+3);
// video sector channel number format = 1CCCCC0000000001
XAgotChannel = *((unsigned short *)(CdBuffer+3)+1);
XAgotChannel = (XAgotChannel&31744)>>10;
Please don't forget to include my name if you share my work around. Credit where it is due.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
- t0rxe
- C Programming Expert
- Posts: 139
- Joined: Dec 19, 2012
- Motto: /\OX[]
- PlayStation Model: SCPH-5502
- Location: Australia
Execute each line separately (comment them out) and find the line that is causing the crash.
From there, check your pointers and bit shifts. Maybe output them to a printf to ensure you are getting the results needed. Also check the Psy-Q Library References PDF to make sure the functions do no exceed their data type.
From there, check your pointers and bit shifts. Maybe output them to a printf to ensure you are getting the results needed. Also check the Psy-Q Library References PDF to make sure the functions do no exceed their data type.
"Nostalgia isn't a big enough word to describe the PlayStation from my eyes"
-
LameGuy64 Verified
- Psy-Q Enthusiast
- Posts: 388
- Joined: Apr 10, 2013
- I am a: Hobbyist Game Developer
- Motto: Commercial or not, play it!
- PlayStation Model: H2000/7000
- Location: Philippines
- Contact:
Even when
is the only line being executed, I still get that error.
EDIT: Never mind, I eventually found a way to fix it... Just gotta tweak/clean it up first before I'll release it as an XA player sample with auto-stop and looping.
Code: Select all
XAID = *(unsigned short *)(CdBuffer+3);
EDIT: Never mind, I eventually found a way to fix it... Just gotta tweak/clean it up first before I'll release it as an XA player sample with auto-stop and looping.
Please don't forget to include my name if you share my work around. Credit where it is due.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.
DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.
-
Verified
- Cybdyn Systems
- Posts: 406
- Joined: Jan 13, 2012
- I am a: Embedded Developer (MCU & FPGA)
- PlayStation Model: 5502
- Location: Belarus (Minsk)
I think this can be done nicely by checking for the 'End of Record' bit inside the subheader structure in each XA audio sector being played but I don't know of a way to extract the subheader during playback.
yeah, one of the way is chk for EOR flag in subhader. by CdgetlocL command.
another way, dunno how they make it, but at the end of exact track (file/channell ) they put data frame, so when INT1 or dataready event comes it means it reach end of current xa track.
yeah, one of the way is chk for EOR flag in subhader. by CdgetlocL command.
another way, dunno how they make it, but at the end of exact track (file/channell ) they put data frame, so when INT1 or dataready event comes it means it reach end of current xa track.
I'm guessing that CdBuffer is a unsigned char *, and adding 3 will make it odd.LameGuy64 wrote:Even whenis the only line being executed, I still get that error.Code: Select all
XAID = *(unsigned short *)(CdBuffer+3);
If so then the you'd get an exception because the PlayStation can only access 16 bit values on addresses divisible by 2 (mess enforces that but most emulators don't). Some compilers can be forced into creating code that will work by using a packed struct, otherwise you have to do something like CdBuffer[3] | (CdBuffer[4] << 8). I have no idea about the validity of what you're doing, but that is likely the cause of the exception.
Who is online
Users browsing this forum: No registered users and 3 guests