File: AIVocalSetPreview.h

package info (click to toggle)
darkradiant 3.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,080 kB
  • sloc: cpp: 264,743; ansic: 10,659; python: 1,852; xml: 1,650; sh: 92; makefile: 21
file content (62 lines) | stat: -rw-r--r-- 1,315 bytes parent folder | download | duplicates (6)
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
58
59
60
61
62
#pragma once

#include "ieclass.h"
#include <wx/panel.h>

class wxStaticText;
class wxButton;

namespace ui
{

/**
 * greebo: This class provides the UI elements to listen
 * to a a given AI vocal set. On clicking the playback button
 * a random sound is chosen from the vocal set.
 *
 * Use the getWidget() method to pack this into a
 * parent container.
 */
class AIVocalSetPreview :
	public wxPanel
{
private:
	wxButton* _playButton;
	wxButton* _stopButton;
	wxStaticText* _statusLabel;

	// The currently "previewed" vocal set
	IEntityClassPtr _vocalSetDef;

	typedef std::vector<std::string> SoundShaderList;
	SoundShaderList _setShaders;

public:
	AIVocalSetPreview(wxWindow* parent);

	/**
	 * greebo: Sets the vocal set to preview. Set NULL to disable this panel.
	 */
	void setVocalSetEclass(const IEntityClassPtr& vocalSetDef);

private:
	/**
	 * greebo: Returns a random file from the selected vocal set.
	 * @returns: the filename as defined in one of the shaders or "".
	 */
	std::string getRandomSoundFile();

	/** greebo: Creates the control widgets (play button) and such.
	 */
	void createControlPanel();

	/** greebo: Updates the list according to the active soundshader
	 */
	void update();

	// Callbacks
	void onPlay(wxCommandEvent& ev);
	void onStop(wxCommandEvent& ev);
};

} // namespace ui