Skip to content

Commit

Permalink
Implement max sound count izzyreal/mpc#246
Browse files Browse the repository at this point in the history
  • Loading branch information
izzyreal committed Oct 21, 2024
1 parent 02dbd5c commit 349a226
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/main/VmpcProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,13 @@ void VmpcProcessor::setStateInformation (const void* data, int sizeInBytes)
auto sndData = decodeBase64(candidate);
SndReader sndReader(sndData);

auto sound = mpc.getSampler()->addSound(sndReader.getSampleRate());
auto sound = mpc.getSampler()->addSound(sndReader.getSampleRate(), "");

if (sound == nullptr)
{
return;
}

sound->setMono(sndReader.isMono());
sndReader.readData(*sound->getSampleData());
sound->setName(sndReader.getName());
Expand Down
7 changes: 6 additions & 1 deletion src/main/gui/PadControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ void PadControl::loadFile(const String path, bool shouldBeConverted, std::string
auto layeredScreen = mpc.getLayeredScreen();

SoundLoaderResult result;
auto sound = mpc.getSampler()->addSound();
auto sound = mpc.getSampler()->addSound(screenToReturnTo);

if (sound == nullptr)
{
return;
}

soundLoader.loadSound(file, result, sound, shouldBeConverted);
auto popupScreen = mpc.screens->get<PopupScreen>("popup");
Expand Down

0 comments on commit 349a226

Please sign in to comment.