Skip to content

Commit 49f1424

Browse files
authored
Merge pull request #155 from renderforest/mute-music
Remove mute music functionality.
2 parents e348cfc + 6b40c52 commit 49f1424

File tree

6 files changed

+49
-18
lines changed

6 files changed

+49
-18
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "renderforest/sdk-php",
33
"description": "Renderforest SDK for PHP",
4-
"version": "0.5.5",
4+
"version": "0.5.6",
55
"homepage": "https://github.com/renderforest/renderforest-sdk-php",
66
"keywords": [
77
"animation maker",

doc/PROJECTS_API.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ $renderforestClient = new \Renderforest\ApiClient(
5959
$projectId = $renderforestClient->addProject(701); // template id
6060
```
6161
- Also, project-data is created with the following list of initial properties:
62-
templateId, title, duration, equalizer, isLego, extendableScreens, fps, projectVersion, screens, muteMusic,
62+
templateId, title, duration, equalizer, isLego, extendableScreens, fps, projectVersion, screens, muteSfx,
6363
currentScreenId, projectColors (optional), themeVariableName (optional), themeVariableValue (optional).
64-
- The "muteMusic" is false initially.
64+
- The "muteSfx" is false initially.
6565
- If template is lego ("isLego": true), then no initial screen is added and "screens" defaults to []. Otherwise, at least one screen is present.
6666
- The "currentScreenId" is the id of the first screen for non-lego templates & null for lego templates.
6767
- The "projectColors" is optional and gets value if the template has default colors. Both lego & non-lego templates might have default colors.

examples/project-data/get-project-data.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
echo 'Is Equalizer - ' . ($projectData->isEqualizer() ? 'True' : 'False') . PHP_EOL;
1717
echo 'Is Extendable Screens - ' . ($projectData->isExtendableScreens() ? 'True' : 'False') . PHP_EOL;
1818
echo 'Is Lego - ' . ($projectData->isLego() ? 'True' : 'False') . PHP_EOL;
19-
echo 'Is Mute Music - ' . ($projectData->isMuteMusic() ? 'True' : 'False') . PHP_EOL;
19+
echo 'Has Sfx - ' . ($projectData->hasSfx() ? 'True' : 'False') . PHP_EOL;
20+
echo 'Is Mute Sfx - ' . ($projectData->isMuteSfx() ? 'True' : 'False') . PHP_EOL;
2021

2122
echo 'Project Colors: ' . PHP_EOL;
2223
foreach ($projectData->getProjectColors() as $projectColor) {

examples/project-data/update-project-data.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
$projectData = $renderforestClient->getProjectData(16165971);
1111

12-
$projectData->setMuteMusic(false);
13-
1412
$projectData
1513
->getScreenByOrder(1)
1614
->getAreaByOrder(1)

examples/projects/get-trial-project.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
echo 'Is Equalizer - ' . ($trialProject->isEqualizer() ? 'True' : 'False') . PHP_EOL;
1212
echo 'Is Extendable Screens - ' . ($trialProject->isExtendableScreens() ? 'True' : 'False') . PHP_EOL;
1313
echo 'Is Lego - ' . ($trialProject->isLego() ? 'True' : 'False') . PHP_EOL;
14-
echo 'Is Mute Music - ' . ($trialProject->isMuteMusic() ? 'True' : 'False') . PHP_EOL;
14+
echo 'Has Sfx - ' . ($trialProject->hasSfx() ? 'True' : 'False') . PHP_EOL;
15+
echo 'Is Mute Sfx - ' . ($trialProject->isMuteSfx() ? 'True' : 'False') . PHP_EOL;
1516

1617
echo 'Project Colors: ' . PHP_EOL;
1718
foreach ($trialProject->getProjectColors() as $projectColor) {

src/ProjectData/ProjectData.php

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class ProjectData extends ApiEntityBase
2626
const KEY_EQUALIZER = 'equalizer';
2727
const KEY_EXTENDABLE_SCREENS = 'extendableScreens';
2828
const KEY_IS_LEGO = 'isLego';
29-
const KEY_MUTE_MUSIC = 'muteMusic';
29+
const KEY_MUTE_SFX = 'muteSfx';
30+
const KEY_HAS_SFX = 'hasSfx';
3031
const KEY_PROJECT_COLORS = 'projectColors';
3132
const KEY_PROJECT_VERSION = 'projectVersion';
3233
const KEY_SCREENS = 'screens';
@@ -42,7 +43,7 @@ class ProjectData extends ApiEntityBase
4243
const WRITABLE_KEYS = [
4344
self::KEY_CURRENT_SCREEN_ID,
4445
self::KEY_EDITING_MODE,
45-
self::KEY_MUTE_MUSIC,
46+
self::KEY_MUTE_SFX,
4647
self::KEY_SOUNDS,
4748
self::KEY_PROJECT_COLORS,
4849
self::KEY_SCREENS,
@@ -83,7 +84,10 @@ class ProjectData extends ApiEntityBase
8384
protected $isLego;
8485

8586
/** @var bool */
86-
protected $muteMusic;
87+
protected $muteSfx;
88+
89+
/** @var bool */
90+
protected $hasSfx;
8791

8892
/** @var ColorCollection */
8993
protected $projectColors;
@@ -266,6 +270,25 @@ public function isLego(): bool
266270
return $this->isLego;
267271
}
268272

273+
/**
274+
* @return bool
275+
*/
276+
public function hasSfx(): bool
277+
{
278+
return $this->hasSfx;
279+
}
280+
281+
/**
282+
* @param bool $hasSfx
283+
* @return ProjectData
284+
*/
285+
public function setHasSfx(bool $hasSfx): ProjectData
286+
{
287+
$this->hasSfx = $hasSfx;
288+
289+
return $this;
290+
}
291+
269292
/**
270293
* @param bool $isLego
271294
* @return ProjectData
@@ -280,18 +303,22 @@ public function setIsLego(bool $isLego): ProjectData
280303
/**
281304
* @return bool
282305
*/
283-
public function isMuteMusic(): bool
306+
public function isMuteSfx(): bool
284307
{
285-
return $this->muteMusic;
308+
return $this->muteSfx;
286309
}
287310

288311
/**
289-
* @param bool $muteMusic
312+
* @param bool $muteSfx
290313
* @return ProjectData
291314
*/
292-
public function setMuteMusic(bool $muteMusic): ProjectData
315+
public function setMuteSfx(bool $muteSfx): ProjectData
293316
{
294-
$this->muteMusic = $muteMusic;
317+
if (true === $this->hasSfx) {
318+
$this->muteSfx = $muteSfx;
319+
} else {
320+
$this->muteSfx = false;
321+
}
295322

296323
return $this;
297324
}
@@ -604,8 +631,11 @@ public function exchangeArray(array $projectDataArrayData)
604631
$isLego = $projectDataArrayData[self::KEY_IS_LEGO];
605632
$this->setIsLego($isLego);
606633

607-
$muteMusic = $projectDataArrayData[self::KEY_MUTE_MUSIC];
608-
$this->setMuteMusic($muteMusic);
634+
$hasSfx = $projectDataArrayData[self::KEY_HAS_SFX];
635+
$this->setHasSfx($hasSfx);
636+
637+
$muteSfx = $projectDataArrayData[self::KEY_MUTE_SFX];
638+
$this->setMuteSfx($muteSfx);
609639

610640
if (array_key_exists(self::KEY_PROJECT_COLORS, $projectDataArrayData)) {
611641
$projectColorsArrayData = $projectDataArrayData[self::KEY_PROJECT_COLORS];
@@ -723,7 +753,8 @@ public function getArrayCopyFull(): array
723753
self::KEY_EQUALIZER => $this->isEqualizer(),
724754
self::KEY_EXTENDABLE_SCREENS => $this->isExtendableScreens(),
725755
self::KEY_IS_LEGO => $this->isLego(),
726-
self::KEY_MUTE_MUSIC => $this->isMuteMusic(),
756+
self::KEY_HAS_SFX => $this->hasSfx(),
757+
self::KEY_MUTE_SFX => $this->isMuteSfx(),
727758
self::KEY_PROJECT_COLORS => $this->projectColors->getArrayCopy(),
728759
self::KEY_PROJECT_VERSION => $this->getProjectVersion(),
729760
self::KEY_SCREENS => $this->screens->getArrayCopy(),

0 commit comments

Comments
 (0)