Advertisement
AnonBaiter

deinterleave.bms

May 31st, 2017
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. set HEADER 0 # change this value to the entire header size in hex numbers
  2. set PRESERVE 0 # set this to 1 if you want to perserve the header
  3. set ADJUST 0 # set this to 1 if you want to adjust something(right now it does nothing else)
  4. set BLOCKSIZE 0 # change this value to the entire blocksize of some audio file in hex numbers
  5. set INTERLEAVE 0 # change this value to the entire interleave of some audio file in hex numbers
  6. set LAYERS 0 # set the number of layers you wan to split into
  7. set SKIP 0 # change this value to the size you want to prevent the script from splitting into in hex numbers
  8.  
  9. if BLOCKSIZE == 0
  10. xmath BLOCKSIZE "(INTERLEAVE * LAYERS) + SKIP"
  11. set INTERLEAVE BLOCKSIZE
  12. endif
  13.  
  14. if INTERLEAVE == 0
  15. xmath INTERLEAVE "BLOCKSIZE / LAYERS"
  16. set BLOCKSIZE INTERLEAVE
  17. endif
  18.  
  19. xmath WRITESIZE "(BLOCKSIZE - SKIP) / LAYERS"
  20. get CYCLES asize
  21. xmath CYCLES "(CYCLES - HEADER) / BLOCKSIZE"
  22.  
  23. get NAME basename
  24. get EXT extension
  25. callfunction DEINTERLEAVE
  26.  
  27. startfunction DEINTERLEAVE
  28. xmath PSIZE "CYCLES * WRITESIZE"
  29. if PRESERVE == 1
  30. math PSIZE += HEADER
  31. goto 0
  32. getdstring HEADERDATA HEADER
  33. endif
  34.  
  35. for l = 1 <= LAYERS
  36. putvarchr MEMORY_FILE PSIZE 0
  37. log MEMORY_FILE 0 0
  38. if PRESERVE == 1
  39. putdstring HEADERDATA HEADER MEMORY_FILE
  40. if LAYERS == 1
  41. string FNAME p= "%s.%s" NAME EXT
  42. else
  43. string FNAME p= "%s_%d.%s" NAME l EXT
  44. endif
  45. endif
  46. xmath BIAS_A "(l - 1) * WRITESIZE"
  47. xmath BIAS_B "BLOCKSIZE - BIAS_A - WRITESIZE"
  48. goto HEADER
  49. for c = 1 <= CYCLES
  50. getdstring DUMMYDATA BIAS_A
  51. getdstring WRITEDATA WRITESIZE
  52. putdstring WRITEDATA WRITESIZE MEMORY_FILE
  53. getdstring DUMMYDATA BIAS_B
  54. next c
  55. get SIZE asize MEMORY_FILE
  56. /*
  57. if ADJUST == 1
  58. callfunction ADJUSTHEADER 1
  59. endif
  60. */
  61. if LAYERS == 1
  62. string FNAME p= "%s.%s" NAME EXT
  63. else
  64. string FNAME p= "%s_%d.%s" NAME l EXT
  65. endif
  66. log FNAME 0 SIZE MEMORY_FILE
  67. next l
  68. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement