Class: FMOD::System
Constant Summary
Constants included
from Enums
Enums::FMOD_CHANNELINDEX, Enums::FMOD_DELAYTYPE, Enums::FMOD_DSP_RESAMPLER, Enums::FMOD_DSP_TYPE, Enums::FMOD_OUTPUTTYPE, Enums::FMOD_RESULT, Enums::FMOD_SOUND_FORMAT
Constants included
from Constants
Constants::FMOD_2D, Constants::FMOD_3D, Constants::FMOD_3D_CUSTOMROLLOFF, Constants::FMOD_3D_HEADRELATIVE, Constants::FMOD_3D_IGNOREGEOMETRY, Constants::FMOD_3D_LINEARROLLOFF, Constants::FMOD_3D_LOGROLLOFF, Constants::FMOD_3D_WORLDRELATIVE, Constants::FMOD_ACCURATETIME, Constants::FMOD_CDDA_FORCEASPI, Constants::FMOD_CDDA_JITTERCORRECT, Constants::FMOD_CREATECOMPRESSEDSAMPLE, Constants::FMOD_CREATESAMPLE, Constants::FMOD_CREATESTREAM, Constants::FMOD_DEFAULT, Constants::FMOD_HARDWARE, Constants::FMOD_IGNORETAGS, Constants::FMOD_INIT_3D_RIGHTHANDED, Constants::FMOD_INIT_DISABLE_MYEARS, Constants::FMOD_INIT_DSOUND_HRTFFULL, Constants::FMOD_INIT_DSOUND_HRTFLIGHT, Constants::FMOD_INIT_DSOUND_HRTFNONE, Constants::FMOD_INIT_DTS_NEURALSURROUND, Constants::FMOD_INIT_ENABLE_PROFILE, Constants::FMOD_INIT_GEOMETRY_USECLOSEST, Constants::FMOD_INIT_NORMAL, Constants::FMOD_INIT_PS2_DISABLECORE0REVERB, Constants::FMOD_INIT_PS2_DISABLECORE1REVERB, Constants::FMOD_INIT_PS2_DONTUSESCRATCHPAD, Constants::FMOD_INIT_PS2_SWAPDMACHANNELS, Constants::FMOD_INIT_PS3_FORCE2CHLPCM, Constants::FMOD_INIT_PS3_PREFERDTS, Constants::FMOD_INIT_SOFTWARE_DISABLE, Constants::FMOD_INIT_SOFTWARE_HRTF, Constants::FMOD_INIT_SOFTWARE_OCCLUSION, Constants::FMOD_INIT_SOFTWARE_REVERB_LOWMEM, Constants::FMOD_INIT_STREAM_FROM_UPDATE, Constants::FMOD_INIT_SYNCMIXERWITHUPDATE, Constants::FMOD_INIT_SYSTEM_MUSICMUTENOTPAUSE, Constants::FMOD_INIT_VOL0_BECOMES_VIRTUAL, Constants::FMOD_INIT_WASAPI_EXCLUSIVE, Constants::FMOD_INIT_XBOX_REMOVEHEADROOM, Constants::FMOD_LOADSECONDARYRAM, Constants::FMOD_LOOP_BIDI, Constants::FMOD_LOOP_NORMAL, Constants::FMOD_LOOP_OFF, Constants::FMOD_LOWMEM, Constants::FMOD_MPEGSEARCH, Constants::FMOD_NONBLOCKING, Constants::FMOD_OPENMEMORY, Constants::FMOD_OPENMEMORY_POINT, Constants::FMOD_OPENONLY, Constants::FMOD_OPENRAW, Constants::FMOD_OPENUSER, Constants::FMOD_SOFTWARE, Constants::FMOD_TIMEUNIT_BUFFERED, Constants::FMOD_TIMEUNIT_MODORDER, Constants::FMOD_TIMEUNIT_MODPATTERN, Constants::FMOD_TIMEUNIT_MODROW, Constants::FMOD_TIMEUNIT_MS, Constants::FMOD_TIMEUNIT_PCM, Constants::FMOD_TIMEUNIT_PCMBYTES, Constants::FMOD_TIMEUNIT_RAWBYTES, Constants::FMOD_TIMEUNIT_SENTENCE, Constants::FMOD_TIMEUNIT_SENTENCE_MS, Constants::FMOD_TIMEUNIT_SENTENCE_PCM, Constants::FMOD_TIMEUNIT_SENTENCE_PCMBYTES, Constants::FMOD_TIMEUNIT_SENTENCE_SUBSOUND, Constants::FMOD_UNICODE, Constants::FMOD_UNIQUE, Constants::FMOD_VIRTUAL_PLAYFROMSTART
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Functions
#error_check
Constructor Details
#initialize(opts = {}) ⇒ System
Returns a new instance of System.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/fmod/system.rb', line 8
def initialize(opts={})
opts = opts.keyword_args(:output_wav,
:sample_rate => 44100)
@sample_rate = opts.sample_rate
@memory = FFI::MemoryPointer.new(:pointer)
error_check(:FMOD_System_Create, @memory)
@pointer = @memory.read_pointer
case
when opts.output_wav
error_check(:FMOD_System_SetOutput, @pointer, :FMOD_OUTPUTTYPE_WAVWRITER_NRT)
error_check(:FMOD_System_SetSoftwareFormat, @pointer, sample_rate, :FMOD_SOUND_FORMAT_PCM16, 2, 6, :FMOD_DSP_RESAMPLER_LINEAR)
error_check(:FMOD_System_Init, @pointer, 100, FMOD_INIT_STREAM_FROM_UPDATE, opts.output_wav)
else
error_check(:FMOD_System_Init, @pointer, 32, FMOD_INIT_NORMAL, nil)
end
end
|
Instance Attribute Details
#pointer ⇒ Object
pointer to the system instance
5
6
7
|
# File 'lib/fmod/system.rb', line 5
def pointer
@pointer
end
|
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
6
7
8
|
# File 'lib/fmod/system.rb', line 6
def sample_rate
@sample_rate
end
|
Instance Method Details
#buffer_size ⇒ Object
77
78
79
80
81
82
|
# File 'lib/fmod/system.rb', line 77
def buffer_size
FFI::MemoryPointer.new(:int) { |size|
error_check(:FMOD_System_GetDSPBufferSize, @pointer, size, nil)
return size.read_int
}
end
|
#driver_count ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/fmod/system.rb', line 37
def driver_count
FFI::MemoryPointer.new(:int) { |count_ptr|
error_check(:FMOD_System_GetNumDrivers, @pointer, count_ptr)
count_ptr.read_int
}
end
|
#dsp_clock ⇒ Object
68
69
70
71
72
73
74
75
|
# File 'lib/fmod/system.rb', line 68
def dsp_clock
FFI::MemoryPointer.new(:int) { |hi|
FFI::MemoryPointer.new(:int) { |lo|
error_check(:FMOD_System_GetDSPClock, @pointer, hi, lo)
return Convert.int32_to_64(hi.read_int, lo.read_int)
}
}
end
|
#hardware_channels ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/fmod/system.rb', line 53
def hardware_channels
FFI::MemoryPointer.new(:int) { |num2d|
FFI::MemoryPointer.new(:int) { |num3d|
FFI::MemoryPointer.new(:int) { |total|
error_check(:FMOD_System_GetHardwareChannels, @pointer, num2d, num3d, total)
{
:num2d => num2d.read_int,
:num3d => num3d.read_int,
:total => total.read_int,
}
}
}
}
end
|
#release ⇒ Object
88
89
90
|
# File 'lib/fmod/system.rb', line 88
def release
error_check(:FMOD_System_Release, @pointer)
end
|
#software_channels ⇒ Object
46
47
48
49
50
51
|
# File 'lib/fmod/system.rb', line 46
def software_channels
FFI::MemoryPointer.new(:int) { |num_ptr|
error_check(:FMOD_System_GetSoftwareChannels, @pointer, num_ptr)
num_ptr.read_int
}
end
|
#update ⇒ Object
84
85
86
|
# File 'lib/fmod/system.rb', line 84
def update
error_check(:FMOD_System_Update, @pointer)
end
|
#version ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/fmod/system.rb', line 28
def version
FFI::MemoryPointer.new(:int) { |version_ptr|
error_check(:FMOD_System_GetVersion, @pointer, version_ptr)
return version_ptr.read_int
}
end
|