C# Test with C++

C++ code posted by Brockster
created at 31 Oct 16:15, updated at 01 Apr 16:40

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Threading;
using BassWrapper;

namespace ConsolePlayer
{
  class Program
  {
    static void Main(string[] args)
    {
      Console.Clear();
      Console.WriteLine("Simple console mode BassWrapper.NET example : MOD/MPx/OGG/WAV player");
      Console.WriteLine("--------------------------------------------------------------------");
      Console.WriteLine("System: [{0}, {1}]\n", Environment.OSVersion.Platform, Environment.OSVersion );
      
      if( args.Length != 1 )
      {
        Console.Write( "Usage: player.exe [Filename or Location to play via Bass Library]" );
        return;
      }

      string elementToPlayViaBassLibrary = args[0];
      
      BassChannel stream = null;

      BassManager.Initialize(44100, BassDeviceSetups.None, IntPtr.Zero);
      try
      {
        stream = BassStream.FromFile( elementToPlayViaBassLibrary );
      }
      catch
      {
        /*filetype wrong, try next*/
      }
915 Bytes in 2 ms with coderay