Ejemplo n.º 1
0
AudioSystem::AudioSystem( uint32_t buffer_num, uint32_t source_num ) :
    _allocator( (( sizeof(AudioSource)+sizeof(AudioBuffer))*source_num*2 ) + ((sizeof(string_hash)+sizeof(AudioBuffer))*buffer_num * 2) ),
    _sources( _allocator.allocate( (sizeof(AudioSource)+sizeof(AudioBuffer))*source_num+10, align_of<AudioSource>::value ), (sizeof(AudioSource)+sizeof(AudioBuffer))*source_num+10 ),
    _buffers( _allocator.allocate( (sizeof(string_hash)+sizeof(AudioBuffer))*buffer_num+10, align_of<string_hash>::value ), (sizeof(string_hash)+sizeof(AudioBuffer))*buffer_num+10 )
{
    _device = crap::openAudioDevice();
    _context = crap::createAudioContext( _device );

    crap::setAudioContextCurrent( _context );

    for( uint32_t i=0; i< source_num; ++i )
    {
        AudioSource source;
        createAudioSources( &source, 1 );
        _sources.push_back( source, InvalidAudioBuffer );
    }

    for( uint32_t i=0; i<buffer_num; ++i )
    {
        AudioBuffer buffer;
        createAudioBuffers( &buffer, 1);
        _buffers.push_back(buffer, "" );
    }

    const uint32_t memory = (( sizeof(AudioSource)+sizeof(AudioBuffer))*source_num*2 ) + ((sizeof(string_hash)+sizeof(AudioBuffer))*buffer_num * 2);
    crap::log( LOG_CHANNEL_CORE | LOG_TYPE_INFO | LOG_TARGET_COUT, "AudioSystem with %i bytes memory, max. %i buffers and max. %i sources created", memory, buffer_num, source_num );
    setAudioDopplerEffects(1.f, 1.f);

    //debug
    float32_t zero[3] = {0.f, 0.f, 0.f};
    float32_t one[3] = {1.f, 1.f, 1.f};
    float32_t dir[6] = {0.f, 0.f, 1.f, 0.f, 1.f, 0.f };
    setListenerData( zero, zero, dir );
}
Ejemplo n.º 2
0
 PlayerAudioEmitter::PlayerAudioEmitter(irr::scene::IAnimatedMeshSceneNode* a_AttachedPlayer) : m_AttachedPlayer(a_AttachedPlayer)
 {
     createAudioSources();
 }