rfmod/
error.rs

1/*
2* Rust-FMOD - Copyright (c) 2014 Gomez Guillaume.
3*
4* The Original software, FMOD library, is provided by FIRELIGHT TECHNOLOGIES.
5*
6* This software is provided 'as-is', without any express or implied warranty.
7* In no event will the authors be held liable for any damages arising from
8* the use of this software.
9*
10* Permission is granted to anyone to use this software for any purpose,
11* including commercial applications, and to alter it and redistribute it
12* freely, subject to the following restrictions:
13*
14* 1. The origin of this software must not be misrepresented; you must not claim
15*    that you wrote the original software. If you use this software in a product,
16*    an acknowledgment in the product documentation would be appreciated but is
17*    not required.
18*
19* 2. Altered source versions must be plainly marked as such, and must not be
20*    misrepresented as being the original software.
21*
22* 3. This notice may not be removed or altered from any source distribution.
23*/
24
25pub fn error_string(errcode: ::Status) -> &'static str {
26    match errcode {
27        ::Status::AlreadyLocked => "Tried to call lock a second time before unlock was called.",
28        ::Status::BadCommand => "Tried to call a function on a data type that does not allow this \
29                                 type of functionality (ie calling Sound::lock on a streaming \
30                                 sound).",
31        ::Status::CDDADrivers => "Neither NTSCSI nor ASPI could be initialised.",
32        ::Status::CDDAInit => "An error occurred while initialising the CDDA subsystem.",
33        ::Status::CDDAInvalidDevice => "Couldn't find the specified device.",
34        ::Status::CDDANoAudio => "No audio tracks on the specified disc.",
35        ::Status::CDDANoDevices => "No CD/DVD devices were found.",
36        ::Status::CDDANoDisc => "No disc present in the specified drive.",
37        ::Status::CDDARead => "A CDDA read error occurred.",
38        ::Status::ChannelAlloc => "Error trying to allocate a channel.",
39        ::Status::ChannelStolen => "The specified channel has been reused to play another sound.",
40        ::Status::COM => "A Win32 COM related error occured. COM failed to initialize or a \
41                          QueryInterface failed meaning a Windows codec or driver was not \
42                          installed properly.",
43        ::Status::DMA => "DMA Failure.  See debug output for more information.",
44        ::Status::DSPConnection => "DSP connection error. Connection possibly caused a cyclic \
45                                    dependency. Or tried to connect a tree too many units deep \
46                                    (more than 128).",
47        ::Status::DSPFormat => "DSP Format error.  A DSP unit may have attempted to connect to \
48                                this network with the wrong format.",
49        ::Status::DSPNotFound => "DSP connection error.  Couldn't find the DSP unit specified.",
50        ::Status::DSPRunning => "DSP error.  Cannot perform this operation while the network is in \
51                                 the middle of running. This will most likely happen if a \
52                                 connection or disconnection is attempted in a DSP callback.",
53        ::Status::DSPTooManyConnections => "DSP connection error. The unit being connected to or \
54                                            disconnected should only have 1 input or output.",
55        ::Status::EventAlreadyLoaded => "The specified project or bank has already been loaded. \
56                                         Having multiple copies of the same project loaded \
57                                         simultaneously is forbidden.",
58        ::Status::EventFailed => "An Event failed to be retrieved, most likely due to 'just fail' \
59                                  being specified as the max playbacks behavior.",
60        ::Status::EventGuidConflict => "An event with the same GUID already exists.",
61        ::Status::EventInfoOnly => "An event with the same GUID already exists.",
62        ::Status::EventInternal => "An error occured that wasn't supposed to.  See debug log for \
63                                    reason.",
64        ::Status::EventMaxStreams => "Event failed because 'Max streams' was hit when \
65                                      FMOD_EVENT_INIT_FAIL_ON_MAXSTREAMS was specified.",
66        ::Status::EventMismatch => "FSB mismatches the FEV it was compiled with, the stream/sample \
67                                    mode it was meant to be created with was different, or the FEV \
68                                    was built for a different platform.",
69        ::Status::EventNameConflict => "A category with the same name already exists.",
70        ::Status::EventNeedsSimple => "Tried to call a function on a complex event that's only \
71                                       supported by simple events.",
72        ::Status::EventNotFound => "The requested event, event group, event category or event \
73                                    property could not be found.",
74        ::Status::FileBad => "Error loading file.",
75        ::Status::FileCouldNotSeek => "Couldn't perform seek operation.  This is a limitation of \
76                                       the medium (ie netstreams) or the file format.",
77        ::Status::FileDiskEjected => "Media was ejected while reading.",
78        ::Status::FileEOF => "End of file unexpectedly reached while trying to read essential data \
79                              (truncated data?).",
80        ::Status::FileNotFound => "File not found.",
81        ::Status::FileUnwanted => "Unwanted file access occured.",
82        ::Status::Format => "Unsupported file or audio format.",
83        ::Status::HTTP => "A HTTP error occurred. This is a catch-all for HTTP errors not listed \
84                           elsewhere.",
85        ::Status::HTTPAccess => "The specified resource requires authentication or is forbidden.",
86        ::Status::HTTPProxyAuth => "Proxy authentication is required to access the specified \
87                                    resource.",
88        ::Status::HTTPServerError => "A HTTP server error occurred.",
89        ::Status::HTTPTimeout => "The HTTP request timed out.",
90        ::Status::Initialization => "FMOD was not initialized correctly to support this function.",
91        ::Status::Initialized => "Cannot call this command after System::init.",
92        ::Status::Internal => "An error occured that wasn't supposed to. Contact support.",
93        ::Status::InvalidAddress => "On Xbox 360, this memory address passed to FMOD must be \
94                                     physical, (ie allocated with XPhysicalAlloc.)",
95        ::Status::InvalidFloat => "Value passed in was a NaN, Inf or denormalized float.",
96        ::Status::InvalidHandle => "An invalid object handle was used.",
97        ::Status::InvalidParam => "An invalid parameter was passed to this function.",
98        ::Status::InvalidPosition => "An invalid seek position was passed to this function.",
99        ::Status::InvalidSpeaker => "An invalid speaker was passed to this function based on the \
100                                     current speaker mode.",
101        ::Status::InvalidSyncPoint => "The syncpoint did not come from this sound handle.",
102        ::Status::InvalidVector => "The vectors passed in are not unit length, or perpendicular.",
103        ::Status::MaxAudible => "Reached maximum audible playback count for this sound's \
104                                 soundgroup.",
105        ::Status::Memory => "Not enough memory or resources.",
106        ::Status::MemoryCantPoint => "Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or \
107                                      non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was \
108                                      used.",
109        ::Status::MemorySRAM => "Not enough memory or resources on console sound ram.",
110        ::Status::MusicNoCallback => "The music callback is required, but it has not been set.",
111        ::Status::MusicNotFound => "The requested music entity could not be found.",
112        ::Status::MusicUninitialized => "Music system is not initialized probably because no music \
113                                         data is loaded.",
114        ::Status::Needs2D => "Tried to call a command on a 3d sound when the command was meant for \
115                              2d sound.",
116        ::Status::Needs3D => "Tried to call a command on a 2d sound when the command was meant for \
117                              3d sound.",
118        ::Status::NeedsHardware => "Tried to use a feature that requires hardware support.  (ie \
119                                    trying to play a GCADPCM compressed sound in software on Wii).",
120        ::Status::NeedsSoftware => "Tried to use a feature that requires the software engine. \
121                                    Software engine has either been turned off, or command was \
122                                    executed on a hardware channel which does not support this \
123                                    feature.",
124        ::Status::NetConnect => "Couldn't connect to the specified host.",
125        ::Status::NetSocketError => "A socket error occurred.  This is a catch-all for \
126                                     socket-related errors not listed elsewhere.",
127        ::Status::NetURL => "The specified URL couldn't be resolved.",
128        ::Status::NetWouldBlock => "Operation on a non-blocking socket could not complete \
129                                    immediately.",
130        ::Status::NotReady => "Operation could not be performed because specified sound/DSP \
131                               connection is not ready.",
132        ::Status::OutputAllocated => "Error initializing output device, but more specifically, the \
133                                      output device is already in use and cannot be reused.",
134        ::Status::OutputCreateBuffer => "Error creating hardware sound buffer.",
135        ::Status::OutputDriverCall => "A call to a standard soundcard driver failed, which could \
136                                       possibly mean a bug in the driver or resources were missing \
137                                       or exhausted.",
138        ::Status::OutputEnumeration => "Error enumerating the available driver list. List may be \
139                                        inconsistent due to a recent device addition or removal.",
140        ::Status::OutputFormat => "Soundcard does not support the minimum features needed for this \
141                                   soundsystem (16bit stereo output).",
142        ::Status::OutputInit => "Error initializing output device.",
143        ::Status::OutputNoHardware => "FMOD_HARDWARE was specified but the sound card does not \
144                                       have the resources necessary to play it.",
145        ::Status::OutputNoSoftware => "Attempted to create a software sound but no software \
146                                       channels were specified in System::init.",
147        ::Status::Pan => "Panning only works with mono or stereo sound sources.",
148        ::Status::Plugin => "An unspecified error has been returned from a 3rd party plugin.",
149        ::Status::PluginInstances => "The number of allowed instances of a plugin has been \
150                                      exceeded.",
151        ::Status::PluginMissing => "A requested output, dsp unit type or codec was not available.",
152        ::Status::PluginResource => "A resource that the plugin requires cannot be found. (ie the \
153                                     DLS file for MIDI playback or other DLLs that it needs to \
154                                     load)",
155        ::Status::Preloaded => "The specified sound is still in use by the event system, call \
156                                EventSystem::unloadFSB before trying to release it.",
157        ::Status::ProgrammerSound => "The specified sound is still in use by the event system, \
158                                      wait for the event which is using it finish with it.",
159        ::Status::Record => "An error occured trying to initialize the recording device.",
160        ::Status::ReverbInstance => "Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. \
161                                     Most likely because it is an invalid instance number or the \
162                                     reverb doesnt exist.",
163        ::Status::Subsounds => "The error occured because the sound referenced contains subsounds \
164                                when it shouldn't have, or it doesn't contain subsounds when it \
165                                should have. The operation may also not be able to be performed on \
166                                a parent sound, or a parent sound was played without setting up a \
167                                sentence first.",
168        ::Status::SubsoundAllocated => "This subsound is already being used by another sound, you \
169                                        cannot have more than one parent to a sound. Null out the \
170                                        other parent's entry first.",
171        ::Status::SubsoundCantMove => "Shared subsounds cannot be replaced or moved from their \
172                                       parent stream, such as when the parent stream is an FSB \
173                                       file.",
174        ::Status::SubsoundMode => "The subsound's mode bits do not match with the parent sound's \
175                                   mode bits. See documentation for function that it was called \
176                                   with.",
177        ::Status::TagNotFound => "The specified tag could not be found or there are no tags.",
178        ::Status::TooManyChannels => "The sound created exceeds the allowable input channel count. \
179                                      This can be increased using the maxinputchannels parameter \
180                                      in System::setSoftwareFormat.",
181        ::Status::Unimplemented => "Something in FMOD hasn't been implemented when it should be! \
182                                    Contact support!",
183        ::Status::Uninitialized => "This command failed because System::init or System::setDriver \
184                                    was not called.",
185        ::Status::Unsupported => "A command issued was not supported by this object.  Possibly a \
186                                  plugin without certain callbacks specified.",
187        ::Status::Update => "An error caused by System::update occured.",
188        ::Status::Version => "The version number of this file format is not supported.",
189        ::Status::Ok => "No errors.",
190        _ => "Unknown error."
191    }
192}