filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.2k stars 454 forks source link

not building on vs2019 .net 2.6.1 #438

Open k1ttt-remote opened 3 years ago

k1ttt-remote commented 3 years ago

haven't even got to the ilasm post build stuff... get hundreds of these: Severity Code Description Project File Line Suppression State Error CS1519 Invalid token '=' in class, record, struct, or interface member declaration CSCore D:\SoftwareDev\msdev\Projects\SimpleAudioStreamer\cscore-master\CSCore\AudioSubTypes.cs 15 Active just to get started... 504 errors before it gets to build anything! what am i missing??

filoe commented 3 years ago

What do you mean with .net 2.6.1? .net framework?

k1ttt-remote commented 3 years ago

i didn't say anything about .net 2.6.1, i would have tried under at least 3.5, probably 4.something.

k1ttt-remote commented 3 years ago

hmmm, forgot to read the subject... was 2.6.1 set in your project file or something, that isn't one i would have picked.

k1ttt-remote commented 3 years ago

oops, went back and looked, it is 4.6.1.

filoe commented 3 years ago

So you are building it with .net 3.5? AudioSubTypes gets generated by a t4 template. Could you please post the code which causes any errors? Did you allow to execute the t4 templates?

k1ttt-remote commented 3 years ago

No, building with 4.6.1.

I tried manually telling it to build/transform all t4 templates but that didn’t help.

AudioSubTypes.cs looks like this and the compiler complains about every = sign, then later there are complaints that the names that should be defined in there aren’t found.

using System;

namespace CSCore

{

   public static partial class AudioSubTypes

   {

// ReSharper disable InconsistentNaming

          /// <summary>WAVE_FORMAT_UNKNOWN, Microsoft Corporation</summary>

    Unknown = 0x0000,

    /// <summary>WAVE_FORMAT_PCM            Microsoft Corporation</summary>

    Pcm = 0x0001,

    /// <summary>WAVE_FORMAT_ADPCM          Microsoft Corporation</summary>

    Adpcm = 0x0002,

    /// <summary>WAVE_FORMAT_IEEE_FLOAT Microsoft Corporation</summary>

    IeeeFloat = 0x0003,

    /// <summary>WAVE_FORMAT_VSELP          Compaq Computer Corp.</summary>

    Vselp = 0x0004,

    /// <summary>WAVE_FORMAT_IBM_CVSD IBM Corporation</summary>

    IbmCvsd = 0x0005,

David Robbins K1TTT e-mail: mailto:k1ttt@arrl.net mailto:k1ttt@arrl.net web: http://wiki.k1ttt.net/ http://wiki.k1ttt.net AR-Cluster node: telnet://k1ttt.net:7373/ telnet://k1ttt.net:7373

From: Florian notifications@github.com Sent: Thursday, January 7, 2021 11:44 To: filoe/cscore cscore@noreply.github.com Cc: k1ttt-remote k1ttt@arrl.net; Author author@noreply.github.com Subject: Re: [filoe/cscore] not building on vs2019 .net 2.6.1 (#438)

So you are building it with .net 3.5? AudioSubTypes gets generated by a t4 template. Could you please post the code which causes any errors? Did you allow to execute the t4 templates?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/filoe/cscore/issues/438#issuecomment-756232909 , or unsubscribe https://github.com/notifications/unsubscribe-auth/APLBOPPOWYNZR227UP5EJW3SYXQEHANCNFSM4VEL4KKQ . https://github.com/notifications/beacon/APLBOPJ4NQQR5LIFEE35G63SYXQEHA5CNFSM4VEL4KK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFUJTFTI.gif

filoe commented 3 years ago

There really seems to be a problem with the t4 template. It trsnsforms the WaveEncoding enum to the AudioSubTypes class. The output should look like this https://github.com/filoe/cscore/blob/master/CSCore/AudioSubTypes.cs

I cant really tell you why the t4 template should not work on your conputer.

GellioGao commented 3 years ago

I believe that the cause is Environment.NewLine, which means there \n for the new line in AudioEncoding.cs and you are trying to use it on Windows which the new line is \r\n, so the text cannot be parsed properly. Refer to line 24 in AudioSubTypes.tt.

KalleStae commented 3 years ago

Had the same error: You can correct this error in windows with two lines of code in AudioSubTypes.tt after var enumContent = match.Groups[2].Value;

    enumContent = enumContent.Replace("\r\n", "\n");
              enumContent = enumContent.Replace("\n", "\r\n");