Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Sommersemester 2015
Cpp
Deth Buff Arr
Commits
59189580
Commit
59189580
authored
Oct 11, 2015
by
Thomas Eppers
Browse files
renamed sound to sound_file
parent
12789100
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/asset/asset_loader.hpp
View file @
59189580
...
...
@@ -22,7 +22,7 @@ namespace gdw {
virtual
std
::
shared_ptr
<
const
asset
>
load_asset
(
const
std
::
string
&
name
)
const
=
0
;
virtual
std
::
string
native_name
(
const
std
::
string
&
name
)
const
{
virtual
std
::
string
native_name
(
const
std
::
string
&
)
const
{
return
std
::
string
();
}
};
...
...
include/audio/audio_collection.hpp
View file @
59189580
...
...
@@ -7,7 +7,7 @@
#include <audio/music.hpp>
#include <audio/music_manager.hpp>
#include <audio/sound.hpp>
#include <audio/sound
_file
.hpp>
#include <audio/sound_manager.hpp>
namespace
gdw
{
...
...
include/audio/sound.hpp
→
include/audio/sound
_file
.hpp
View file @
59189580
...
...
@@ -4,13 +4,13 @@
#include <SDL_mixer.h>
namespace
gdw
{
class
sound
{
class
sound
_file
{
private:
Mix_Chunk
*
impl_
;
public:
sound
(
const
char
*
mem
,
int
size
);
~
sound
();
sound
_file
(
const
char
*
mem
,
int
size
);
~
sound
_file
();
Mix_Chunk
*
get
()
const
;
};
...
...
include/audio/sound_manager.hpp
View file @
59189580
#ifndef __GDW_SOUND_MANAGER_HPP__
#define __GDW_SOUND_MANAGER_HPP__
#include <audio/sound.hpp>
#include <audio/sound
_file
.hpp>
#include <util/cached_resource_manager.hpp>
namespace
gdw
{
...
...
@@ -9,13 +9,13 @@ namespace gdw{
}
namespace
gdw
{
using
sound_ptr
=
std
::
shared_ptr
<
const
sound
>
;
using
sound_ptr
=
std
::
shared_ptr
<
const
sound
_file
>
;
class
sound_manager
:
public
cached_resource_manager
<
const
sound
,
sound_manager
>
{
class
sound_manager
:
public
cached_resource_manager
<
const
sound
_file
,
sound_manager
>
{
private:
engine
&
engine_
;
friend
class
cached_resource_manager
<
const
sound
,
sound_manager
>
;
friend
class
cached_resource_manager
<
const
sound
_file
,
sound_manager
>
;
public:
sound_manager
(
engine
&
engine
);
...
...
src/audio/sound.cpp
→
src/audio/sound
_file
.cpp
View file @
59189580
#include <audio/audio_helper.hpp>
#include <audio/sound.hpp>
#include <audio/sound
_file
.hpp>
namespace
gdw
{
sound
::
sound
(
const
char
*
mem
,
int
size
)
{
sound
_file
::
sound
_file
(
const
char
*
mem
,
int
size
)
{
SDL_RWops
*
raw
=
SDL_RWFromConstMem
((
void
*
)
mem
,
size
);
if
(
raw
==
nullptr
)
{
audio_error
(
"could not load music from memory"
);
...
...
@@ -10,13 +10,13 @@ namespace gdw {
impl_
=
Mix_LoadWAV_RW
(
raw
,
1
);
}
sound
::~
sound
()
{
sound
_file
::~
sound
_file
()
{
if
(
impl_
!=
nullptr
)
{
Mix_FreeChunk
(
impl_
);
}
}
Mix_Chunk
*
sound
::
get
()
const
{
Mix_Chunk
*
sound
_file
::
get
()
const
{
return
impl_
;
}
}
src/audio/sound_manager.cpp
View file @
59189580
...
...
@@ -13,6 +13,6 @@ namespace gdw {
return
sound_ptr
();
}
auto
&
content
=
asset
->
content
();
return
std
::
make_shared
<
const
sound
>
(
content
.
data
(),
content
.
size
());
return
std
::
make_shared
<
const
sound
_file
>
(
content
.
data
(),
content
.
size
());
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment