summaryrefslogtreecommitdiff
path: root/include/nw4r/snd/snd_StrmSoundHandle.h
blob: 712fb90e995eba944c01528d346efb3ae0485c77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef NW4R_SND_STRM_SOUND_HANDLE_H
#define NW4R_SND_STRM_SOUND_HANDLE_H

/*******************************************************************************
 * headers
 */

#include "common.h" // nullptr

#include "nw4r/snd/snd_SoundHandle.h"
#include "nw4r/snd/snd_StrmSound.h"
#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable

/*******************************************************************************
 * types
 */

// forward declarations
namespace nw4r { namespace snd { namespace detail { class StrmSound; }}}

/*******************************************************************************
 * classes and functions
 */

namespace nw4r { namespace snd
{
	// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x3074e
	class StrmSoundHandle : private ut::NonCopyable
	{
	// methods
	public:
		// methods
		StrmSoundHandle(SoundHandle*);
		~StrmSoundHandle() { DetachSound(); }
		bool IsAttachedSound() const { return mSound != nullptr; }

		void DetachSound();

		void SetVolume(u32 trackFlags, f32 volume, int fadeFrames) {
			if (IsAttachedSound())
				mSound->SetTrackVolume(trackFlags, volume, fadeFrames);
		}

		u32 GetPlaySamplePosition() const {
			if (!IsAttachedSound())
				return -1;
			return mSound->GetPlaySamplePosition();
		}

	// members
	private:
		/* base NonCopyable */			// size 0x00, offset 0x00
		detail::StrmSound	*mSound;	// size 0x04, offset 0x00
	}; // size 0x04
}} // namespace nw4r::snd

#endif // NW4R_SND_STRM_SOUND_HANDLE_H