private static int GetDataLength(ChannelDataFlags flags) { switch (flags) { case ChannelDataFlags.FFT512: return 256; case ChannelDataFlags.FFT1024: return 512; case ChannelDataFlags.FFT2048: return 1024; case ChannelDataFlags.SFFT512: return 512; case ChannelDataFlags.SFFT1024: return 1024; case ChannelDataFlags.SFFT2048: return 2048; default: return 1024; } }
//// Remove a sync from a channel //// handle : channel handle(HMUSIC/HSTREAM) //// sync : Handle of sync to remove //[DllImport("bass.dll", EntryPoint = "BASS_ChannelRemoveSync")] //private static extern int _RemoveSync(IntPtr handle, IntPtr sync); // OK retrun bool //// Retrieves upto "length" bytes of the channel//s current sample data. This is //// useful if you wish to "visualize" the sound. //// handle: Channel handle(HMUSIC / HSTREAM, or RECORDCHAN) //// buffer : Location to write the data //// length : Number of bytes wanted, or a BASS_DATA_xxx flag //// RETURN : Number of bytes actually written to the buffer (-1=error) //[DllImport("bass.dll", EntryPoint = "BASS_ChannelGetData")] //private static extern int _GetData(IntPtr handle, float[] buffer, int Length); // OK return dword /// <summary> /// Retrieves upto "length" bytes of the channel//s current sample data. This is /// useful if you wish to "visualize" the sound. /// </summary> /// <param name="buffer">A buffer to place retrieved data</param> /// <param name="flags">ChannelDataFlags</param> public int GetData([NotNull] float[] buffer, ChannelDataFlags flags) { if (_disposed) throw new ObjectDisposedException(ToString()); int output = Bass.BASS_ChannelGetData(Handle, buffer, (int) flags); if (output < 0) throw new BASSException(); return output; }