Skip to content

Commit

Permalink
Merge pull request #8 from Moros1138/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Moros1138 authored Aug 11, 2024
2 parents bfc66db + aba647f commit b52b726
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class Demo : public olc::PixelGameEngine
// returns float 0.0 to 1.0, nearer 1.0 is near the end
seek = ma.GetCursorFloat(song1);

// Gets the current playback position in the provided sample ID (int),
// returns unsigned long long in milliseconds
cursor=ma.GetCursorMilliseconds(song1);

// Draw Instructions and Indicators
Clear(olc::BLACK);

Expand Down Expand Up @@ -137,6 +141,10 @@ class Demo : public olc::PixelGameEngine
DrawStringDecal((center - olc::vi2d{0, 24}) - (olc::vf2d(GetTextSize(ma.name + " Demo")) * scale / 2.0f), ma.name + " Demo", olc::WHITE, {scale, scale});
DrawStringDecal(center - (GetTextSize("Hit <SPACE> To Toggle Playback") / 2), "Hit <SPACE> To Toggle Playback", olc::WHITE);
DrawStringDecal((center + olc::vi2d{0, 16}) - (GetTextSize("Hit <R> TO Reset Pan/Pitch/Volume") / 2), "Hit <R> TO Reset Pan/Pitch/Volume", olc::WHITE);

DrawStringDecal({5, 144}, \
"Cursor (ms): " + std::to_string(cursor),
olc::WHITE, {0.5f, 0.5f});

DrawStringDecal({5, 160}, \
"Music: Joy Ride [Full version] by MusicLFiles\n"
Expand Down Expand Up @@ -167,6 +175,7 @@ class Demo : public olc::PixelGameEngine
float volume = 1.0f;
float distance = 0.0f;
bool backgroundPlay = false;
unsigned long long cursor = 0ull;

};

Expand Down
8 changes: 4 additions & 4 deletions olcPGEX_MiniAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
+-------------------------------------------------------------+
| OneLoneCoder Pixel Game Engine Extension |
| MiniAudio v1.5 |
| MiniAudio v1.6 |
+-------------------------------------------------------------+
NOTE: UNDER ACTIVE DEVELOPMENT - THERE MAY BE BUGS/GLITCHES
Expand Down Expand Up @@ -68,7 +68,7 @@ namespace olc
class MiniAudio : public olc::PGEX
{
public:
std::string name = "olcPGEX_MiniAudio v1.5";
std::string name = "olcPGEX_MiniAudio v1.6";

public:
MiniAudio();
Expand Down Expand Up @@ -429,9 +429,9 @@ namespace olc
{
unsigned long long cursor;
ma_sound_get_cursor_in_pcm_frames(vecSounds.at(id), &cursor);


cursor *= 1000;
cursor /= sampleRate;
cursor /= 1000;

return cursor;
}
Expand Down

0 comments on commit b52b726

Please sign in to comment.