Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
Plugin.cpp
1/*
2Copyright (C) 2017,2018,2025 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
18#include "aeongames/Plugin.hpp"
19#include "aeongames/StringId.hpp"
20#include <memory>
21#include "PortAudioSoundSystem.h"
22#include <iostream>
23#include <portaudio.h>
24
25extern "C"
26{
27 bool PortAudioStartUp()
28 {
29 if ( PaError error_code = Pa_Initialize() != paNoError )
30 {
31 std::cerr << "Error initializing PortAudio: " << Pa_GetErrorText ( error_code ) << std::endl;
32 return false;
33 }
35 []()
36 {
37 return std::make_unique<AeonGames::PortAudioSoundSystem>();
38 } );
39 }
40
41 void PortAudioShutdown()
42 {
44 if ( PaError error_code = Pa_Terminate() != paNoError )
45 {
46 std::cerr << "Error finalizing PortAudio: " << Pa_GetErrorText ( error_code ) << std::endl;
47 }
48 }
49
50 PLUGIN PluginModuleInterface PMI =
51 {
52 "PortAudio Sound System",
53 "Implements a Sound System using the PortAudio Library",
54 PortAudioStartUp,
55 PortAudioShutdown
56 };
57}
Platform-specific macros, includes, and DLL export/import definitions.
Defines the plugin module interface for dynamically loaded plugins.
DLL bool RegisterSoundSystemConstructor(const StringId &aIdentifier, const std::function< std::unique_ptr< SoundSystem >() > &aConstructor)
Registers a SoundSystem loader for a specific identifier.
DLL bool UnregisterSoundSystemConstructor(const StringId &aIdentifier)
Unregisters a SoundSystem loader for a specific identifier.
Interface that every loadable plugin module must expose.
Definition Plugin.hpp:35