2019-04-13 12:21:56 -04:00
|
|
|
/* Copyright (C) 2019 Mr Goldberg
|
|
|
|
This file is part of the Goldberg Emulator
|
|
|
|
|
|
|
|
The Goldberg Emulator is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 3 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The Goldberg Emulator is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the Goldberg Emulator; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
|
2023-12-27 09:21:59 +02:00
|
|
|
#include "dll/steam_music.h"
|
2019-04-13 12:21:56 -04:00
|
|
|
|
|
|
|
Steam_Music::Steam_Music(class SteamCallBacks *callbacks)
|
|
|
|
{
|
|
|
|
playing = 0;
|
|
|
|
volume = 1.0;
|
|
|
|
this->callbacks = callbacks;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Steam_Music::change_playstate(int new_playing)
|
|
|
|
{
|
|
|
|
if (new_playing != playing) {
|
|
|
|
PlaybackStatusHasChanged_t data;
|
|
|
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
playing = new_playing;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Steam_Music::BIsEnabled()
|
|
|
|
{
|
2024-01-20 03:32:01 +02:00
|
|
|
PRINT_DEBUG("TODO Steam_Music::BIsEnabled\n");
|
2019-04-13 12:21:56 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Steam_Music::BIsPlaying()
|
|
|
|
{
|
2024-01-20 03:32:01 +02:00
|
|
|
PRINT_DEBUG("TODO Steam_Music::BIsPlaying\n");
|
2019-04-13 12:21:56 -04:00
|
|
|
return playing > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AudioPlayback_Status Steam_Music::GetPlaybackStatus()
|
|
|
|
{
|
2024-01-20 03:32:01 +02:00
|
|
|
PRINT_DEBUG("TODO Steam_Music::GetPlaybackStatus\n");
|
2019-04-13 12:21:56 -04:00
|
|
|
if (playing == 0) {
|
|
|
|
return AudioPlayback_Idle;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (playing == 1) {
|
|
|
|
return AudioPlayback_Paused;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (playing == 2) {
|
|
|
|
return AudioPlayback_Playing;
|
|
|
|
}
|
|
|
|
|
|
|
|
return AudioPlayback_Idle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Steam_Music::Play()
|
|
|
|
{
|
2024-01-20 03:32:01 +02:00
|
|
|
PRINT_DEBUG("TODO Steam_Music::Play\n");
|
2019-04-13 12:21:56 -04:00
|
|
|
change_playstate(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Steam_Music::Pause()
|
|
|
|
{
|
2024-01-20 03:32:01 +02:00
|
|
|
PRINT_DEBUG("TODO Steam_Music::Pause\n");
|
2019-04-13 12:21:56 -04:00
|
|
|
change_playstate(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Steam_Music::PlayPrevious()
|
|
|
|
{
|
2024-01-20 03:32:01 +02:00
|
|
|
PRINT_DEBUG("TODO Steam_Music::PlayPrevious\n");
|
2019-04-13 12:21:56 -04:00
|
|
|
change_playstate(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Steam_Music::PlayNext()
|
|
|
|
{
|
2024-01-20 03:32:01 +02:00
|
|
|
PRINT_DEBUG("TODO Steam_Music::PlayNext\n");
|
2019-04-13 12:21:56 -04:00
|
|
|
change_playstate(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// volume is between 0.0 and 1.0
|
|
|
|
void Steam_Music::SetVolume( float flVolume )
|
|
|
|
{
|
2024-01-20 03:32:01 +02:00
|
|
|
PRINT_DEBUG("TODO Steam_Music::SetVolume\n");
|
2019-04-13 12:21:56 -04:00
|
|
|
|
|
|
|
if (flVolume > 1.0)
|
|
|
|
flVolume = 1.0;
|
|
|
|
if (flVolume < 0.0)
|
|
|
|
flVolume = 0.0;
|
|
|
|
|
|
|
|
if (flVolume != volume) {
|
|
|
|
VolumeHasChanged_t data;
|
|
|
|
data.m_flNewVolume = volume;
|
|
|
|
callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
volume = flVolume;
|
|
|
|
}
|
|
|
|
|
|
|
|
float Steam_Music::GetVolume()
|
|
|
|
{
|
2024-01-20 03:32:01 +02:00
|
|
|
PRINT_DEBUG("TODO Steam_Music::GetVolume\n");
|
2019-04-13 12:21:56 -04:00
|
|
|
return volume;
|
|
|
|
}
|