GithubHelp home page GithubHelp logo

raboof / sfarklib Goto Github PK

View Code? Open in Web Editor NEW
85.0 11.0 24.0 111 KB

Original library for SoundFont compression

License: GNU General Public License v3.0

Makefile 2.46% C++ 82.40% C 14.45% Nix 0.68%

sfarklib's Introduction

sfArkLib

Library for decompressing sfArk soundfonts.

A simple command-line tool to convert sfArk files to sf2 based on this library can be found at https://github.com/raboof/sfArkXTm

Prerequisites

  • Install zlib, e.g. from the zlib1g-dev package

Building

$ make
$ sudo make install
$ sudo ldconfig

Building with nix (no other prerequisites)

$ nix-build

Development shell:

$ nix-shell

sfarklib's People

Contributors

alexoundos avatar asellappen avatar jrussellsmyth avatar mirabilos avatar moltenform avatar raboof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sfarklib's Issues

Apply Debian patches to build system

Hi,
Ruben Undheim [email protected] recently packaged sfArkLib for Debian, and I am about to update to the latest release tag (2.24).
Ruben patched the build system in Debian to add sub-versions for the library name, and to install it correctly in the required location. He also linked to zlib directly so that software that links to sfArkLib so not need to link to zlib themselves.
I would be grateful if you would consider including these patches in the next release of SfArkLib.
A Pull Request is on the way.
Regards,
Ross Gammon

Tagging

Can you tag of a release? I'm working on a debian package.

Make the "install" action more careful

Currently the makefile says:
cp libsfark.so $(DESTDIR)/usr/local/lib
cp sfArkLib.h $(DESTDIR)/usr/local/include

However since I do not have /usr/local/include directory, the makefile copies the sfArkLib.h to a file named /usr/local/include ..

Doesn't compile on mac os x 64 bit

Any plans to make it compile on mac?

c++ -fPIC -D__LITTLE_ENDIAN__ -c -o sfklCoding.o sfklCoding.cpp
sfklCoding.cpp:551:8: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (n < 0 || n > ZBUF_SIZE) // Check for valid block length
~ ^ ~
sfklCoding.cpp:553:78: warning: format specifies type 'long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
sprintf(MsgTxt, "ERROR - Invalid length for Non-audio Block (apparently %ld bytes) %s", n, CorruptedMsg);
~~^ ~
%d
2 warnings generated.
c++ -fPIC -D__LITTLE_ENDIAN__ -c -o sfklDiff.o sfklDiff.cpp
c++ -fPIC -D__LITTLE_ENDIAN__ -c -o sfklLPC.o sfklLPC.cpp
c++ -fPIC -D__LITTLE_ENDIAN__ -c -o sfklZip.o sfklZip.cpp
c++ -fPIC -D__LITTLE_ENDIAN__ -c -o sfklCrunch.o sfklCrunch.cpp
c++ -fPIC -D__LITTLE_ENDIAN__ -c -o sfklFile.o sfklFile.cpp
c++ -fPIC -D__LITTLE_ENDIAN__ -c -o sfklString.o sfklString.cpp
c++ -shared sfklCoding.o sfklDiff.o sfklLPC.o sfklZip.o sfklCrunch.o sfklFile.o sfklString.o -o libsfark.so
Undefined symbols for architecture x86_64:
"sfkl_DisplayNotes(char const_, char const_)", referenced from:
ExtractTextFile(BLOCK_DATA_, unsigned long) in sfklCoding.o
"sfkl_UpdateProgress(int)", referenced from:
sfkl_Decode(char const_, char const_) in sfklCoding.o
"sfkl_GetLicenseAgreement(char const_, char const_)", referenced from:
ExtractTextFile(BLOCK_DATA_, unsigned long) in sfklCoding.o
"sfkl_msg(char const_, int)", referenced from:
ReadHeader(V2_FILEHEADER_, unsigned char_, int) in sfklCoding.o
InvalidEncodeCount(int, int) in sfklCoding.o
DecompressTurbo(BLOCK_DATA_, unsigned short) in sfklCoding.o
CheckShift(short_, unsigned short, short_, short_) in sfklCoding.o
DecompressFast(BLOCK_DATA_, unsigned short) in sfklCoding.o
ProcessNextBlock(BLOCK_DATA_) in sfklCoding.o
ExtractTextFile(BLOCK_DATA_, unsigned long) in sfklCoding.o
...
"adler32", referenced from:
ReadHeader(V2_FILEHEADER
, unsigned char_, int) in sfklCoding.o
ProcessNextBlock(BLOCK_DATA_) in sfklCoding.o
ExtractTextFile(BLOCK_DATA_, unsigned long) in sfklCoding.o
"uncompress", referenced from:
UnMemcomp(unsigned char const
, int, unsigned char_, int) in sfklZip.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libsfark.so] Error 1

Does not handle sfArk V1 files

Some sfArk files trigger the following error (with sfArkXTm)

*** This file was created with sfArk V1, and this program only handles
sfArk V2+ files. Use sfArk instead.
cpu time taken 0 ms
Result: File was created by incompatible sfArk version (not 2.x)
errorcode 5
*** FAILED ***

file that triggered the failure can be retrieved from Hammersound.net at
http://www.hammersound.com/cgi-bin/soundlink.pl?action=view_download_page;ID=644;SoundFont_Location_Selected=Download;SoundFont_Filename_Selected=http://members.brabant.chello.nl/~j.bartels1/JB_ODguitars2.sfArk

Decompression error on 64 bit systems

There is the following error on 64 bit systems:

*** ERROR - Invalid length for .license.txt file (apparently
-7976547325793271497 bytes) - This file appears to be corrupted.
cpu time taken 0 ms

There is a quick patch here which fixes the issue:
http://linux-audio.4202.n7.nabble.com/sfArk-for-Linux-git-repo-access-tp93130p93161.html

I tried it locally, and the patch worked great. But I don't have context on other possible implications.

diff -ur sfArkLib~/sfklCoding.cpp sfArkLib/sfklCoding.cpp 
--- sfArkLib~/sfklCoding.cpp	2013-12-19 00:07:11.000000000 +0100 
+++ sfArkLib/sfklCoding.cpp	2014-09-21 19:29:35.925453244 +0200 
@@ -633,7 +633,7 @@ 
  
 	if (n <= 0  ||  n > ZBUF_SIZE)	// Check for valid block length 
 	{ 
-	sprintf(MsgTxt, "ERROR - Invalid length for %s file (apparently %ld bytes) %s", FileExt, n, CorruptedMsg); 
+	sprintf(MsgTxt, "ERROR - Invalid length for %s file (apparently %d bytes) %s", FileExt, n, CorruptedMsg); 
 	msg(MsgTxt, MSG_PopUp); 
 	GlobalErrorFlag = SFARKLIB_ERR_CORRUPT; 
 	return false; 
@@ -833,7 +833,7 @@ 
 	return EndProcess(GlobalErrorFlag); 
     } 
  
-    sprintf(MsgTxt, "Created %s (%ld kb) successfully.", ReqOutFileName, Blk.TotBytesWritten/1024); 
+    sprintf(MsgTxt, "Created %s (%d kb) successfully.", ReqOutFileName, Blk.TotBytesWritten/1024); 
     msg(MsgTxt, 0); 
      
     return EndProcess(GlobalErrorFlag); 
diff -ur sfArkLib~/sfklZip.cpp sfArkLib/sfklZip.cpp 
--- sfArkLib~/sfklZip.cpp	2013-12-19 00:07:11.000000000 +0100 
+++ sfArkLib/sfklZip.cpp	2014-09-21 19:28:37.014193859 +0200 
@@ -26,7 +26,7 @@ 
 ULONG	UnMemcomp(const BYTE *InBuf, int InBytes, BYTE *OutBuf, int OutBufLen) 
 { 
     // Uncompress buffer using ZLIBs uncompress function... 
-    ULONG	OutBytes = OutBufLen; 
+    unsigned long	OutBytes = OutBufLen; 
     int Result = uncompress(OutBuf, &OutBytes, InBuf, InBytes); 
     if (Result != Z_OK)	// uncompress failed? 
     { 
diff -ur sfArkLib~/wcc.h sfArkLib/wcc.h 
--- sfArkLib~/wcc.h	2013-12-19 00:07:11.000000000 +0100 
+++ sfArkLib/wcc.h	2014-09-21 19:28:37.015193847 +0200 
@@ -67,13 +67,13 @@ 
 // ----- typdefs ----- 
 typedef unsigned short	USHORT; 
 typedef unsigned char	BYTE; 
-typedef unsigned long	ULONG; 
+typedef unsigned int	ULONG; 
 //typedef int	bool; 
  
 typedef short	AWORD;	// Audio word (i.e., 16-bit audio) 
 typedef unsigned short	UAWORD; 
-typedef long	LAWORD;	// "long" audio word i.e. 32 bits 
-typedef unsigned long	ULAWORD; 
+typedef int	LAWORD;	// "long" audio word i.e. 32 bits 
+typedef unsigned int	ULAWORD; 
  
 // Types used by Bit I/O (BIO) routines... 
 typedef USHORT	BIOWORD;   

Build error: Mac OS X 10.8 Architecture x86_64 undefined

Hi guys!
I got an error when I'm trying to build the library on my Mac:
c++ -lz -shared -dynamiclib sfklCoding.o sfklDiff.o sfklLPC.o sfklZip.o sfklCrunch.o sfklFile.o sfklString.o -o libsfark.so
Undefined symbols for architecture x86_64:
"sfkl_DisplayNotes(char const_, char const_)", referenced from:
ExtractTextFile(BLOCK_DATA_, unsigned long) in sfklCoding.o
"sfkl_UpdateProgress(int)", referenced from:
sfkl_Decode(char const_, char const_) in sfklCoding.o
"sfkl_GetLicenseAgreement(char const_, char const_)", referenced from:
ExtractTextFile(BLOCK_DATA_, unsigned long) in sfklCoding.o
"sfkl_msg(char const_, int)", referenced from:
ReadHeader(V2_FILEHEADER_, unsigned char_, int) in sfklCoding.o
InvalidEncodeCount(int, int) in sfklCoding.o
DecompressTurbo(BLOCK_DATA_, unsigned short) in sfklCoding.o
CheckShift(short_, unsigned short, short_, short_) in sfklCoding.o
DecompressFast(BLOCK_DATA_, unsigned short) in sfklCoding.o
ProcessNextBlock(BLOCK_DATA_) in sfklCoding.o
ExtractTextFile(BLOCK_DATA_, unsigned long) in sfklCoding.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libsfark.so] Error 1

Anyone can help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.