本文整理汇总了C#中FMOD.Sound类的典型用法代码示例。如果您正苦于以下问题:C# Sound类的具体用法?C# Sound怎么用?C# Sound使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sound类属于FMOD命名空间,在下文中一共展示了Sound类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Sound
internal Sound(FMOD.Sound sound, string file, string name, float volume = 1.0f)
{
_sound = sound;
_file = file;
_name = name;
_volume = volume;
}
开发者ID:Sharparam,项目名称:DiseasedToast,代码行数:7,代码来源:Sound.cs
示例2: createStream
public RESULT createStream(byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, ref Sound sound)
{
RESULT result = RESULT.OK;
IntPtr soundraw = new IntPtr();
Sound soundnew = null;
try
{
result = FMOD_System_CreateStream(systemraw, data, mode, ref exinfo, ref soundraw);
}
catch
{
result = RESULT.ERR_INVALID_PARAM;
}
if (result != RESULT.OK)
{
return result;
}
if (sound == null)
{
soundnew = new Sound();
soundnew.setRaw(soundraw);
sound = soundnew;
}
else
{
sound.setRaw(soundraw);
}
return result;
}
开发者ID:huming2207,项目名称:ghgame,代码行数:32,代码来源:fmod.cs
示例3: playSound
public RESULT playSound(CHANNELINDEX channelid, Sound sound, bool paused, ref Channel channel)
{
RESULT result = RESULT.OK;
IntPtr channelraw;
Channel channelnew = null;
if (channel != null)
{
channelraw = channel.getRaw();
}
else
{
channelraw = new IntPtr();
}
try
{
result = FMOD_System_PlaySound(systemraw, channelid, sound.getRaw(), (paused ? 1 : 0), ref channelraw);
}
catch
{
result = RESULT.ERR_INVALID_PARAM;
}
if (result != RESULT.OK)
{
return result;
}
if (channel == null)
{
channelnew = new Channel();
channelnew.setRaw(channelraw);
channel = channelnew;
}
else
{
channel.setRaw(channelraw);
}
return result;
}
开发者ID:huming2207,项目名称:ghgame,代码行数:41,代码来源:fmod.cs
示例4: FMOD_SoundGroup_GetSound
public RESULT getSound (int index, out Sound sound)
{
sound = null;
IntPtr soundraw;
RESULT result = FMOD_SoundGroup_GetSound(rawPtr, index, out soundraw);
sound = new Sound(soundraw);
return result;
}
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:10,代码来源:fmod.cs
示例5: setSubSound
public RESULT setSubSound(int index, Sound subsound)
{
IntPtr subsoundraw = subsound.getRaw();
return FMOD_Sound_SetSubSound(soundraw, index, subsoundraw);
}
开发者ID:huming2207,项目名称:ghgame,代码行数:6,代码来源:fmod.cs
示例6: FMOD_System_RecordStart
public RESULT recordStart (int id, Sound sound, bool loop)
{
return FMOD_System_RecordStart(rawPtr, id, sound.getRaw(), loop);
}
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:4,代码来源:fmod.cs
示例7: getSubSoundParent
public RESULT getSubSoundParent(out Sound parentsound)
{
parentsound = null;
IntPtr subsoundraw;
RESULT result = FMOD_Sound_GetSubSoundParent(rawPtr, out subsoundraw);
parentsound = new Sound(subsoundraw);
return result;
}
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:10,代码来源:fmod.cs
示例8: createSound
// Sound/DSP/Channel creation and retrieval.
public RESULT createSound(string name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, ref Sound sound)
{
var result = RESULT.OK;
var soundraw = new IntPtr();
Sound soundnew = null;
mode = mode | MODE.UNICODE;
try
{
result = FMOD_System_CreateSound(systemraw, name_or_data, mode, ref exinfo, ref soundraw);
}
catch
{
result = RESULT.ERR_INVALID_PARAM;
}
if (result != RESULT.OK)
{
return result;
}
if (sound == null)
{
soundnew = new Sound();
soundnew.setRaw(soundraw);
sound = soundnew;
}
else
{
sound.setRaw(soundraw);
}
return result;
}
开发者ID:nathan-alden,项目名称:old-text-adventure,代码行数:35,代码来源:fmod.cs
示例9: preloadFSB
// Pre-loading FSB files (from disk or from memory, use FMOD_OPENMEMORY_POINT to point to pre-loaded memory).
public RESULT preloadFSB(string filename, int streaminstance, Sound sound)
{
return FMOD_EventSystem_PreloadFSB(eventsystemraw, filename, streaminstance, sound.getRaw());
}
开发者ID:Guitaroz,项目名称:Arcade-Space-Shooter,代码行数:5,代码来源:fmod_event.cs
示例10: GetSoundName
private string GetSoundName(Sound sound)
{
StringBuilder sb = new StringBuilder(256);
sound.getName(sb, sb.Capacity);
return sb.ToString().Trim();
}
开发者ID:komby,项目名称:vixen,代码行数:6,代码来源:fmod_wrapper.cs
示例11: getSubSound
public RESULT getSubSound(int index, ref Sound subsound)
{
var result = RESULT.OK;
var subsoundraw = new IntPtr();
Sound subsoundnew = null;
try
{
result = FMOD_Sound_GetSubSound(soundraw, index, ref subsoundraw);
}
catch
{
result = RESULT.ERR_INVALID_PARAM;
}
if (result != RESULT.OK)
{
return result;
}
if (subsound == null)
{
subsoundnew = new Sound();
subsoundnew.setRaw(subsoundraw);
subsound = subsoundnew;
}
else
{
subsound.setRaw(subsoundraw);
}
return result;
}
开发者ID:nathan-alden,项目名称:old-text-adventure,代码行数:32,代码来源:fmod.cs
示例12: SoundChannel
public SoundChannel(Sound sound)
{
m_fadeTimer = new System.Timers.Timer(FADE_TIMER_INTERVAL);
m_fadeTimer.Elapsed += new ElapsedEventHandler(fadeTimer_Elapsed);
this.Sound = sound;
}
开发者ID:komby,项目名称:vixen,代码行数:6,代码来源:fmod_wrapper.cs
示例13: GetSoundName
private string GetSoundName(Sound sound)
{
StringBuilder name = new StringBuilder(0x100);
sound.getName(name, name.Capacity);
return name.ToString().Trim();
}
开发者ID:jmcadams,项目名称:vplus,代码行数:6,代码来源:fmodType.cs
示例14: createStream
public RESULT createStream (string name, MODE mode, out Sound sound)
{
CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO();
exinfo.cbsize = Marshal.SizeOf(exinfo);
return createStream(name, mode, ref exinfo, out sound);
}
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:7,代码来源:fmod.cs
示例15: recordStart
public RESULT recordStart(Sound sound, bool loop)
{
return FMOD_System_RecordStart(systemraw, sound.getRaw(), loop);
}
开发者ID:olbers,项目名称:sauip4,代码行数:4,代码来源:fmod.cs
示例16: FMOD_System_PlaySound
public RESULT playSound (Sound sound, ChannelGroup channelGroup, bool paused, out Channel channel)
{
channel = null;
IntPtr channelGroupRaw = (channelGroup != null) ? channelGroup.getRaw() : IntPtr.Zero;
IntPtr channelraw;
RESULT result = FMOD_System_PlaySound(rawPtr, sound.getRaw(), channelGroupRaw, paused, out channelraw);
channel = new Channel(channelraw);
return result;
}
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:12,代码来源:fmod.cs
示例17: LoadSong
//Loads a song into memory given a sample size and file-path to an audio file.
//The most commonly used and accurate Sample Size is 1024.
public void LoadSong(int sSize, string audioString)
{
//Take in Aruguments
sampleSize = sSize;
songString = audioString;
stopW.Start();
areWePlaying = true;
specFlux = 0.0f;
timeBetween = 0;
initialTime = (int)stopW.ElapsedMilliseconds;
currentTime = 0;
currentSeconds = 0;
lastSeconds = 0;
currentMillis = 0;
currentMinutes = 0;
median = 0.0f;
smoothMedian = 0.0f;
beatThreshold = 0.6f;
thresholdSmoother = 0.6f;
started = false;
lastBeatRegistered = new TimeStamp();
audio = new FMOD.Sound();
songChannel1 = new FMOD.Channel();
channelMusic = new FMOD.ChannelGroup();
previousFFT = new float[sampleSize
/ 2 + 1];
for (int i = 0; i < sampleSize / 2; i++)
{
previousFFT[i] = 0;
}
//Brute force for testing
//songString = "Music/drums.wav";
//Create channel and audio
FMODErrorCheck(system.createChannelGroup(null, ref channelMusic));
// CREATESOUNDEXINFO ex = new CREATESOUNDEXINFO();
FMODErrorCheck(system.createStream(songString, FMOD.MODE.SOFTWARE, ref audio));
audio.getLength(ref seconds, FMOD.TIMEUNIT.MS);
audio.getDefaults(ref sampleRate, ref zeroF, ref zeroF, ref zero);
seconds = ((seconds + 500) / 1000);
minutes = seconds / 60;
fullSeconds = (int)seconds;
seconds = seconds - (minutes * 60);
FMODErrorCheck(system.playSound(FMOD.CHANNELINDEX.FREE, audio, true, ref songChannel1));
//hzRange = (sampleRate / 2) / static_cast<float>(sampleSize);
songChannel1.setChannelGroup(channelMusic);
songChannel1.setPaused(true);
Console.WriteLine("Song Length: " + minutes + ":" + seconds);
Console.WriteLine("Sample Rate: " + sampleRate);
//std::cout << "Freq Range: " << hzRange << std::endl;
//songChannel1.setVolume(0);
}
开发者ID:SkuliSheepman,项目名称:BeatDetectorForGames,代码行数:64,代码来源:BeatDetector.cs
示例18: FMOD_Sound_GetSubSound
public RESULT getSubSound (int index, out Sound subsound)
{
subsound = null;
IntPtr subsoundraw;
RESULT result = FMOD_Sound_GetSubSound(rawPtr, index, out subsoundraw);
subsound = new Sound(subsoundraw);
return result;
}
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:10,代码来源:fmod.cs
示例19: loadSongToDelay
//This function is used to add a delay in the detection to playback ratio.
//For example, if an obstacle is spawned to the music, it will be spawned immediately
//upon the song detecting a beat, when oftentimes we want to line up that obstacle
//with the point in the music it plays. So, the obstacle will spawn before the song gets
//to the beat detected point.
//Use milliseconds to express the amount of delay time you want between playback and detection.
public void loadSongToDelay(int milliseconds)
{
delayedSong = true;
songChannel1.setVolume(0);
audio2 = new FMOD.Sound();
FMODErrorCheck(system.createStream(songString, FMOD.MODE.SOFTWARE, ref audio2));
songChannel2 = new FMOD.Channel();
FMODErrorCheck(system.playSound(FMOD.CHANNELINDEX.FREE, audio2, true, ref songChannel2));
songChannel2.setChannelGroup(channelMusic);
timeToDelay = milliseconds;
}
开发者ID:SkuliSheepman,项目名称:BeatDetectorForGames,代码行数:19,代码来源:BeatDetector.cs
示例20: FMOD_Channel_GetCurrentSound
public RESULT getCurrentSound (out Sound sound)
{
sound = null;
IntPtr soundraw;
RESULT result = FMOD_Channel_GetCurrentSound(getRaw(), out soundraw);
sound = new Sound(soundraw);
return result;
}
开发者ID:Cocotus,项目名称:simple-music-player,代码行数:10,代码来源:fmod.cs
注:本文中的FMOD.Sound类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论