Skip to content

Commit a74b968

Browse files
committed
Use double for volume
1 parent 029426f commit a74b968

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

include/scratchcpp/target.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ class LIBSCRATCHCPP_EXPORT Target
6868
int layerOrder() const;
6969
void setLayerOrder(int newLayerOrder);
7070

71-
int volume() const;
72-
void setVolume(int newVolume);
71+
double volume() const;
72+
void setVolume(double newVolume);
7373

7474
IEngine *engine() const;
7575
void setEngine(IEngine *engine);

src/scratch/target.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,13 @@ void Target::setLayerOrder(int newLayerOrder)
338338
}
339339

340340
/*! Returns the volume. */
341-
int Target::volume() const
341+
double Target::volume() const
342342
{
343343
return impl->volume;
344344
}
345345

346346
/*! Sets the volume. */
347-
void Target::setVolume(int newVolume)
347+
void Target::setVolume(double newVolume)
348348
{
349349
impl->volume = newVolume;
350350
}

src/scratch/target_p.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct TargetPrivate
3030
std::vector<std::shared_ptr<Costume>> costumes;
3131
std::vector<std::shared_ptr<Sound>> sounds;
3232
int layerOrder = 0;
33-
int volume = 100;
33+
double volume = 100;
3434
};
3535

3636
} // namespace libscratchcpp

test/scratch_classes/target_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ TEST(TargetTest, Volume)
386386
{
387387
Target target;
388388
ASSERT_EQ(target.volume(), 100);
389-
target.setVolume(50);
390-
ASSERT_EQ(target.volume(), 50);
389+
target.setVolume(52.08);
390+
ASSERT_EQ(target.volume(), 52.08);
391391
}
392392

393393
TEST(TargetTest, Engine)

0 commit comments

Comments
 (0)