// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#pragma once
#include "Types.h"
#include "Engine/Tools/AudioTool/AudioDecoder.h"
#include "Engine/Serialization/ISerializable.h"
#include "Engine/Audio/Config.h"
#if COMPILE_WITH_ASSETS_IMPORTER
///
/// Enable/disable caching audio import options
///
#define IMPORT_AUDIO_CACHE_OPTIONS 1
///
/// Importing audio utility
///
class ImportAudio
{
public:
///
/// Importing audio options
///
struct Options : public ISerializable
{
AudioFormat Format;
bool DisableStreaming;
bool Is3D;
int32 BitDepth;
float Quality;
///
/// Initializes a new instance of the struct.
///
Options();
///
/// Gets string that contains information about options
///
/// String
String ToString() const;
public:
// [ISerializable]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
};
public:
///
/// Tries the get audio import options from the target location asset.
///
/// The asset path.
/// The options.
/// True if success, otherwise false.
static bool TryGetImportOptions(String path, Options& options);
///
/// Imports the audio data (with given audio decoder).
///
/// The importing context.
/// The audio decoder.
/// Result.
static CreateAssetResult Import(CreateAssetContext& context, AudioDecoder& decoder);
///
/// Imports the .wav audio file.
///
/// The importing context.
/// Result.
static CreateAssetResult ImportWav(CreateAssetContext& context);
///
/// Imports the .mp3 audio file.
///
/// The importing context.
/// Result.
static CreateAssetResult ImportMp3(CreateAssetContext& context);
#if COMPILE_WITH_OGG_VORBIS
///
/// Imports the .ogg audio file.
///
/// The importing context.
/// Result.
static CreateAssetResult ImportOgg(CreateAssetContext& context);
#endif
};
#endif