Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Various additions
Fix regression caused in https://github.com/djdiskmachine/LittleGPTracker/pull/245
Fix introduced microtonality for single cycle osc, thank you @INFU-AV <3
Purge samples actually purges samples [author: maks](https://github.com/xiphonics/picoTracker/pull/313)
Clear SoundFonts on SamplePool reset

1.6.0-bacon11
Slices decoupled from loop mode
Expand Down
2 changes: 1 addition & 1 deletion docs/wiki/What-is-LittlePiggyTracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ After that you can copy additional wavs to the lgptRoot/lgptProject/samples dire

**Use 8 or 16 Bit wav files, any sampling frequency, mono or stereo**. 8bit samples are converted to 16bit at load time for compatibility with the engine (you can save space in storage but not in RAM).

**Piggy now supports .sf2 Soundfonts. You must add these by hand to your SAMPLES directory, use PROGRAM CHANGE commands to load different patches. Loop points are automatically loaded, but you'll need to make VOLM setting to adjust decay.**
**Piggy now supports .sf2 Soundfonts.** You must add these by hand to your SAMPLES directory, use PROGRAM CHANGE commands to load different patches. Loop points are automatically loaded, but you'll need to make VOLM setting to adjust decay. By default, at most 3 are loaded per project; this limit may be increased by recompiling LittleGPTracker with the compiler flag `-DMAXLOADEDBANKS=X`, where `X` is the desired limit.

## New project

Expand Down
25 changes: 16 additions & 9 deletions sources/Application/Instruments/SamplePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,21 @@ void SamplePool::Load() {

dir->GetContent("*.sf2") ;
IteratorPtr<Path> it2(dir->GetIterator()) ;
int sf_idx = 0;

for(it2->Begin();!it2->IsDone();it2->Next()) {
Path &path=it2->CurrentItem() ;
loadSoundFont(path.GetPath().c_str()) ;
} ;
for (it2->Begin(); !it2->IsDone(); it2->Next(), sf_idx++) {
Path &path=it2->CurrentItem() ;
Trace::Log("Load", "%s", path.GetCanonicalPath().c_str());
loadSoundFont(path.GetPath().c_str()) ;
if (sf_idx == MAX_SOUNDFONTS) {
Trace::Error("Warning maximum soundfont count reached") ;
break ;
} ;
};

delete dir ;
delete dir;

// now sort the samples
// now sort the samples
Sort();
} ;

Expand Down Expand Up @@ -323,9 +329,10 @@ bool SamplePool::loadSoundFont(const char *path) {
sfPresetHdr current=pHeaders[i] ;
wav_[count_]=new SoundFontPreset(id,i) ;
const char *name=pHeaders[i].achPresetName ;
names_[count_]=(char*)SYS_MALLOC(strlen(name)+1) ;
strcpy(names_[count_],name) ;
count_++ ;
Trace::Log("loadSoundFont", "%s", name);
names_[count_] = (char *)SYS_MALLOC(strlen(name) + 1);
strcpy(names_[count_], name);
count_++;
}
}
/*
Expand Down
5 changes: 5 additions & 0 deletions sources/Application/Instruments/SoundFontManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ void SoundFontManager::Reset() {
SAFE_FREE(*it) ;
it=sampleData_.erase(it) ;
} ;

// Unload all SoundFonts
sfBankID i;
for(i = 0; i < MAX_SOUNDFONTS; i++)
sfUnloadSFBank(i);
} ;

sfBankID SoundFontManager::LoadBank(const char *path) {
Expand Down
2 changes: 2 additions & 0 deletions sources/Application/Instruments/SoundFontManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "Externals/Soundfont/ENAB.H"
#include <vector>

#define MAX_SOUNDFONTS MAXLOADEDBANKS

class SoundFontManager:public T_Singleton<SoundFontManager> {
public:
SoundFontManager() ;
Expand Down
2 changes: 2 additions & 0 deletions sources/Externals/Soundfont/ENAB.H
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
// the extent of the internal implementation, (array) of info nodes, one per
// loaded banks. Need more than the default? Change this and you got 'em.

#ifndef MAXLOADEDBANKS
# define MAXLOADEDBANKS 3
#endif

// This is the type of a sfBankID, -1 is an error condition.
typedef SHORT sfBankID;
Expand Down